2009 Jun 01 00:36:35 hey 2009 Jun 01 00:36:50 hi 2009 Jun 01 00:37:18 hey aamar 2009 Jun 01 00:37:38 hey inimino 2009 Jun 01 00:37:44 anyone else? 2009 Jun 01 00:37:46 mariorz: you around? 2009 Jun 01 00:38:53 The exercises in this section were harder than expected. 2009 Jun 01 00:39:02 I only got through 2.85 2009 Jun 01 00:39:12 ok, yeah I didn't finish either 2009 Jun 01 00:39:25 I got through 2.87 2009 Jun 01 00:39:51 I found them hard also 2009 Jun 01 00:41:06 well, should we start? 2009 Jun 01 00:41:13 ok sure 2009 Jun 01 00:41:17 alright 2009 Jun 01 00:41:27 2.73 I guess is where we got to last time 2009 Jun 01 00:42:14 http://mibbit.com/pb/yL7TYI 2009 Jun 01 00:42:57 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.73 2009 Jun 01 00:47:44 these look pretty similar 2009 Jun 01 00:48:06 yes, not sure how to make out (a), but otherwise I think they're essentially the same. 2009 Jun 01 00:48:12 it's amazing how little I remember of this already 2009 Jun 01 00:48:19 yes 2009 Jun 01 00:48:44 2.74 ? 2009 Jun 01 00:48:49 ok 2009 Jun 01 00:48:56 http://mibbit.com/pb/n94Fbz 2009 Jun 01 00:49:02 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.74 2009 Jun 01 00:50:47 ah, ok 2009 Jun 01 00:50:59 I see what you did on a) 2009 Jun 01 00:51:25 I'm not sure it's right... checking the text 2009 Jun 01 00:52:17 ok, basic difference is whether the division packages have automatic access to their filename 2009 Jun 01 00:52:37 I assumed yes, but you passed in the file contents explicitly. 2009 Jun 01 00:52:55 seems okay either way -- much seems unspecified in the question. 2009 Jun 01 00:53:25 alright, yeah 2009 Jun 01 00:53:42 yeah apart from divisions/filenames we have basically identical solutions 2009 Jun 01 00:54:03 next one? 2009 Jun 01 00:54:14 ok 2009 Jun 01 00:54:29 http://mibbit.com/pb/erlQ3b 2009 Jun 01 00:54:34 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.75 2009 Jun 01 00:55:23 ok, same, except +1 on use of lambda 2009 Jun 01 00:55:52 yeah, looks same 2009 Jun 01 00:56:33 the error message is borrowed from the lambdabot in the haskell channel :-) 2009 Jun 01 00:56:35 http://mibbit.com/pb/edVY2U -- 2.76 2009 Jun 01 00:56:49 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.76 2009 Jun 01 01:00:06 similar answers I think 2009 Jun 01 01:00:18 yes, more or less the same 2009 Jun 01 01:00:41 alright, next one? 2009 Jun 01 01:00:46 http://mibbit.com/pb/mTWQQc -- 2.77 2009 Jun 01 01:00:54 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.77 2009 Jun 01 01:01:55 ok, same answer again 2009 Jun 01 01:02:05 ok 2009 Jun 01 01:02:14 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.78 2009 Jun 01 01:02:20 http://mibbit.com/pb/ZIqvMW -- 2.78 2009 Jun 01 01:02:56 same 2009 Jun 01 01:03:29 here is where it started getting long and difficult 2009 Jun 01 01:03:56 alright looks the same 2009 Jun 01 01:03:58 yeah 2009 Jun 01 01:04:07 http://mibbit.com/pb/9AUGEJ -- 2.79 2009 Jun 01 01:04:18 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.79 2009 Jun 01 01:04:24 my code is embedded inside the packages from the book 2009 Jun 01 01:04:31 these ones started getting less fun I found 2009 Jun 01 01:04:44 I didn't actually run any of the code from the rest of the chapter 2009 Jun 01 01:04:59 me neither, my scheme does not have put implemented 2009 Jun 01 01:05:01 so some if it is simplified and I didn't actually implement some of the redundant stuff 2009 Jun 01 01:05:13 hey guys 2009 Jun 01 01:05:16 couldn't track down an easy fix 2009 Jun 01 01:05:19 hey mariorz 2009 Jun 01 01:06:45 oh hey mariorz 2009 Jun 01 01:07:06 sorry for latenes 2009 Jun 01 01:07:08 s 2009 Jun 01 01:07:13 mine is the same as inimino 2009 Jun 01 01:07:15 http://github.com/mariorz/sicp/blob/fc767bf61d3e0da97e286420ea4ec1d07471b48f/2.ss#L2019 2009 Jun 01 01:07:17 inimino: your put has incorrect names for the last arguments complex-eq should be complex-eq? and rational-eq should be rat-eq? 2009 Jun 01 01:07:37 aamar: oh you're right 2009 Jun 01 01:08:20 i didnt get the code running either 2009 Jun 01 01:08:21 fixed 2009 Jun 01 01:09:03 you guys preger if i link to pasties insted of the huge github file? 2009 Jun 01 01:09:08 prefer* 2009 Jun 01 01:09:40 either is ok 2009 Jun 01 01:10:13 mariorz: oh yours is shorter, I like putting everything in the installer 2009 Jun 01 01:10:19 yeah, either is fine for me 2009 Jun 01 01:10:55 numer and denom would have to be 'exposed' in the rational package, right? 2009 Jun 01 01:11:12 ok 2009 Jun 01 01:11:13 anyway, that's a small change 2009 Jun 01 01:11:41 oh, yeah 2009 Jun 01 01:12:03 I couldn't actually remember the interface of the rational package by the time I wrote this 2009 Jun 01 01:12:13 exposed? 2009 Jun 01 01:12:40 well, numer and denom are defined inside a package 2009 Jun 01 01:13:05 so unless your code is also inside that package, as far as I understand, it wouldn't be recognized 2009 Jun 01 01:13:29 er, I mean, you'd get something like "Unbound variable: numer" 2009 Jun 01 01:13:40 oh 2009 Jun 01 01:13:41 yeah, so you'd have to modify the original package and add those lambdas to each of the three installers 2009 Jun 01 01:13:59 well, that one at least 2009 Jun 01 01:14:00 yeak makes sense to put those inside of each's package i guess 2009 Jun 01 01:14:03 seemed a lot fo work 2009 Jun 01 01:15:01 yeah, I just wrote the answers, and I wasn't going to do all that to test it 2009 Jun 01 01:15:07 agreed 2009 Jun 01 01:15:15 ok, next one? 2009 Jun 01 01:15:19 ok 2009 Jun 01 01:15:32 oh 2009 Jun 01 01:15:36 my answer is short 2009 Jun 01 01:15:39 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.80 2009 Jun 01 01:15:50 I skipped this one :-) 2009 Jun 01 01:15:51 same issue on next one for me 2009 Jun 01 01:16:02 http://mibbit.com/pb/fwYysa -- 2.80 2009 Jun 01 01:16:10 http://github.com/mariorz/sicp/blob/fc767bf61d3e0da97e286420ea4ec1d07471b48f/2.ss#L2039 2009 Jun 01 01:16:10 ha 2009 Jun 01 01:16:11 seemed too similar to the previous and the implementation was obvious 2009 Jun 01 01:16:12 ok 2009 Jun 01 01:16:45 yours looks right aamar 2009 Jun 01 01:16:58 yeah 2009 Jun 01 01:17:06 ok, pretty similar to 2.79 2009 Jun 01 01:17:34 yeah, mariorz's too 2009 Jun 01 01:17:40 alright, 2.81? 2009 Jun 01 01:17:47 ok 2009 Jun 01 01:17:56 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.81 2009 Jun 01 01:18:04 http://mibbit.com/pb/HicFHW -- 2.81 2009 Jun 01 01:18:18 http://github.com/mariorz/sicp/blob/fc767bf61d3e0da97e286420ea4ec1d07471b48f/2.ss#L2090 2009 Jun 01 01:19:18 i didnt notice the endless recussion 2009 Jun 01 01:19:31 or dont remember why i didnt write bout it 2009 Jun 01 01:19:42 ok 2009 Jun 01 01:21:47 mariorz -- I think you have the endless recursion in (c) as well 2009 Jun 01 01:21:59 aamar: yours and mine look very close 2009 Jun 01 01:22:13 we just put the equal-type check in a different place 2009 Jun 01 01:22:15 inimino: yes, look very similar to me as well 2009 Jun 01 01:22:53 aamar: i cant see the infinite recussion 2009 Jun 01 01:23:55 if you call apply-generic 'exp '(complex complex) 2009 Jun 01 01:24:55 mariorz: I think your apply-generic is the same, but the indentation is weird 2009 Jun 01 01:25:11 (either that or I got lost in the parens and it's actually different) 2009 Jun 01 01:25:16 just noticed the indentation, maybe I'm counting parens wrong 2009 Jun 01 01:26:07 I'm not sure I'm following it correctly 2009 Jun 01 01:26:26 okay, yes, the parens are right, but the indentation seems wrong 2009 Jun 01 01:26:41 continuing with my example above... 2009 Jun 01 01:26:43 where is the identation wrong? the conds? 2009 Jun 01 01:27:00 (if (equal? type1 type2)) 2009 Jun 01 01:27:06 line 2115 2009 Jun 01 01:27:08 I think 2009 Jun 01 01:28:08 So if exp is not defined on complex numbers, then proc will be false, and it will run that (if (equal? type1 type2) ... ), which will evaluate to true 2009 Jun 01 01:28:09 i see (if (equal? type1 type2) 2009 Jun 01 01:28:27 mariorz: yes, that is the correct line, sorry, I added an extra parens 2009 Jun 01 01:28:43 The parens seem to be right, but that line should be indented over to the right 2009 Jun 01 01:29:01 aamar: ahh yes true 2009 Jun 01 01:29:25 dont know why github did that 2009 Jun 01 01:29:35 I cut and pasted into vi which helps match the parens 2009 Jun 01 01:29:44 well, vim 2009 Jun 01 01:30:59 ah ok on the infinte recursion 2009 Jun 01 01:31:01 hm, yeah I concur about the infinite recursion 2009 Jun 01 01:32:19 it should trhow the error on line 2116 2009 Jun 01 01:33:12 yeah 2009 Jun 01 01:34:18 okay 2.82? 2009 Jun 01 01:34:22 ok 2009 Jun 01 01:34:32 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.82 2009 Jun 01 01:35:17 http://mibbit.com/pb/er6bz4 -- 2.82 2009 Jun 01 01:37:07 its messing up all the idents ill jsut use pastie 2009 Jun 01 01:38:19 ok 2009 Jun 01 01:38:45 http://paste.lisp.org/display/81139 2009 Jun 01 01:41:11 mine is very difficult to read -- should have split it out into smaller pieces 2009 Jun 01 01:41:25 aamar: I think I read yours successfully though 2009 Jun 01 01:41:28 this one was hard 2009 Jun 01 01:41:38 I rewrote mine at least once 2009 Jun 01 01:42:12 aamar: so yours attempts to coerce to the type of the first argument only? 2009 Jun 01 01:43:05 yes exactly 2009 Jun 01 01:44:06 ok 2009 Jun 01 01:44:07 inimino: yours calls get-coerced-args with only one argument at one point 2009 Jun 01 01:44:39 oh, so it does 2009 Jun 01 01:45:02 i have to go guys 2009 Jun 01 01:45:07 off to watch star trek 2009 Jun 01 01:45:41 ok: mariorz -- later 2009 Jun 01 01:45:44 are we doing 3.1 in 2 weeks? 2009 Jun 01 01:45:47 mariorz: oh alright, see you 2009 Jun 01 01:45:54 ok, let's try to make it 2009 Jun 01 01:45:58 mariorz: yeah, let's try 2009 Jun 01 01:46:05 cool, take care 2009 Jun 01 01:46:12 enjoy the movie 2009 Jun 01 01:46:17 thanks 2009 Jun 01 01:47:00 alright aamar I fixed that mistake 2009 Jun 01 01:47:33 ok minor 2009 Jun 01 01:47:52 yeah, but it made it harder to follow 2009 Jun 01 01:48:08 so, the premise is you keep trying to coerce to the first type in the list that you find is possible 2009 Jun 01 01:48:36 I'm not typing very clearly today; 2009 Jun 01 01:48:55 I think I do understand what you're doing -- it succeeds in many more cases than mine. 2009 Jun 01 01:49:11 and your explanation is helpful; hadn't thought about that. 2009 Jun 01 01:49:27 should we go to 2.83? 2009 Jun 01 01:49:34 ok sure 2009 Jun 01 01:50:03 http://mibbit.com/pb/aNxHPM -- 2.83 2009 Jun 01 01:50:09 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.83 2009 Jun 01 01:51:15 oh I forgot to use (contents x) 2009 Jun 01 01:52:00 I guess / is probably integer division there in Scheme 2009 Jun 01 01:52:09 so mine probably won't work 2009 Jun 01 01:52:33 oh, it just returns a Scheme rational number of course... 2009 Jun 01 01:52:48 yes 2009 Jun 01 01:52:52 yours works 2009 Jun 01 01:53:46 ok, otherwise pretty similar 2009 Jun 01 01:53:47 2.84 2009 Jun 01 01:53:53 ok 2009 Jun 01 01:53:57 fixed mine 2009 Jun 01 01:54:03 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.84 2009 Jun 01 01:54:07 http://mibbit.com/pb/6lRMqy -- 2.84 2009 Jun 01 01:54:13 this one took me a while 2009 Jun 01 01:55:29 overall, a similar approach! 2009 Jun 01 01:55:45 yeah, looks similar 2009 Jun 01 01:56:24 ah, I see how you did it 2009 Jun 01 01:57:33 wow, yeah, very similar 2009 Jun 01 01:58:25 yep, good 2009 Jun 01 01:58:29 we put that let in a different function, that's about the only difference 2009 Jun 01 01:58:47 alright, how far did you say you got? 2009 Jun 01 01:58:59 -*- inimino scrolls up 2009 Jun 01 01:59:03 2.85 2009 Jun 01 01:59:08 ok, so we can do the next one 2009 Jun 01 01:59:12 right, last one 2009 Jun 01 01:59:47 ok 2009 Jun 01 01:59:49 http://inimino.org/~inimino/projects/2009/SICP/chap_2/2.85 2009 Jun 01 02:00:02 I see already I forgot to deal with type tags again 2009 Jun 01 02:00:20 um, in the one that I actually did ;-) 2009 Jun 01 02:00:25 http://mibbit.com/pb/IxIVNH -- 2.85 2009 Jun 01 02:01:56 hm, projection of reals onto rationals is a hard one 2009 Jun 01 02:02:05 maybe I should have done the whole problem 2009 Jun 01 02:03:04 I was curious how to handle that -- doubt there's a perfect solution, but there might be a good one. 2009 Jun 01 02:03:34 I'm not sure yet that the recursion works in yours 2009 Jun 01 02:04:23 hm 2009 Jun 01 02:04:49 basically let's say you start with something that doesn't define project, e.g. integer 2009 Jun 01 02:05:07 since IEEE floats are finite, you can actually project anything onto rational 2009 Jun 01 02:05:48 so I guess the idea is not to make the function too good ... seems unsatisfying 2009 Jun 01 02:05:57 oh, hm 2009 Jun 01 02:06:12 (drop 5) will return false I think 2009 Jun 01 02:06:16 but it should return 5 2009 Jun 01 02:06:33 oh 2009 Jun 01 02:06:39 yeah you're right 2009 Jun 01 02:06:49 I should return x there where I have return false 2009 Jun 01 02:06:58 right 2009 Jun 01 02:07:06 ok, otherwise looks right 2009 Jun 01 02:07:11 fixed 2009 Jun 01 02:07:12 ok 2009 Jun 01 02:08:05 also I think I have to use apply-generic as you did 2009 Jun 01 02:08:37 but I kind of imagine this as actually being built into the language so you wouldn't have to worry about that stuff I guess 2009 Jun 01 02:09:17 right -- what is and what isn't built into the language is pretty unclear, guess it depends on which implementation of scheme one uses 2009 Jun 01 02:09:27 yeah 2009 Jun 01 02:09:31 one definitely hopes that you don't have to use apply-generic all over the place 2009 Jun 01 02:09:37 right 2009 Jun 01 02:10:02 I also found myself forgetting stuff that we defined earlier in this section 2009 Jun 01 02:10:20 ok, that's as far as I got :( 2009 Jun 01 02:10:22 there seemed a lot of picky details to keep track of 2009 Jun 01 02:10:43 I only got to 2.87 2009 Jun 01 02:11:04 so do you want to meet in a week and go oven the rest of these? 2009 Jun 01 02:11:26 or just go ahead on with 3.1 for the next meeting? 2009 Jun 01 02:11:53 I found it harder to motivate myself to do these exercises compared to the ones in previous chapters 2009 Jun 01 02:12:05 I'm not quite sure why 2009 Jun 01 02:12:21 well, it was highly unsatisfying to not be able to run this code 2009 Jun 01 02:12:56 and also, it felt annoying to be implementing a type system from scratch 2009 Jun 01 02:13:04 yeah 2009 Jun 01 02:13:07 anyway, yeah, this section was no fun at all 2009 Jun 01 02:13:15 Let's go to 3.1 2009 Jun 01 02:13:16 glad it wasn't just me :) 2009 Jun 01 02:13:20 ok, cool 2009 Jun 01 02:13:29 onward and upward :) 2009 Jun 01 02:13:48 great 2009 Jun 01 02:14:02 alright, so see you in two weeks then 2009 Jun 01 02:14:16 I'll send the log to the mailing list as usual 2009 Jun 01 02:14:52 sounds good -- talk to you then