2009 Oct 12 00:04:32 -*- inimino looks around 2009 Oct 12 00:05:35 hey 2009 Oct 12 00:05:42 hey aamar 2009 Oct 12 00:06:17 I think chapter 4 is going to be fun 2009 Oct 12 00:07:05 Yeah, pretty interesting so far. 2009 Oct 12 00:07:13 yeah 2009 Oct 12 00:07:23 should we start? 2009 Oct 12 00:07:28 Sure 2009 Oct 12 00:07:31 ok 2009 Oct 12 00:07:36 3.78... 2009 Oct 12 00:07:46 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.78 2009 Oct 12 00:08:34 http://github.com/aalearn/aalearn-sicp/blob/master/ch3-outline.scm#L1492-1500 2009 Oct 12 00:09:04 exactly the same 2009 Oct 12 00:09:36 yep 2009 Oct 12 00:09:55 alright, next one? 2009 Oct 12 00:10:10 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.79 2009 Oct 12 00:10:33 http://github.com/aalearn/aalearn-sicp/blob/master/ch3-outline.scm#L1503-1508 2009 Oct 12 00:10:40 also the same 2009 Oct 12 00:10:51 very similar to the previous one 2009 Oct 12 00:11:12 3.80? 2009 Oct 12 00:11:30 oh, looks like I skipped 3.80 2009 Oct 12 00:12:22 nit on 3.79 -- you have some extra parameters you don't need 2009 Oct 12 00:13:13 wasn't too confident on 3.80 2009 Oct 12 00:13:25 oh... you're right 2009 Oct 12 00:13:37 I typed those in again for some reason 2009 Oct 12 00:14:30 3.80 looked complicated, but the ideas seemed about the same as 3.78 2009 Oct 12 00:14:55 that and the poor reproduction of the formulas are the reasons I skipped it 2009 Oct 12 00:15:01 should we go to 3.81 2009 Oct 12 00:15:17 Ha! yes, they're hard to read! 2009 Oct 12 00:15:52 yeah 2009 Oct 12 00:15:56 ok sure 3.81 2009 Oct 12 00:16:07 http://github.com/aalearn/aalearn-sicp/blob/master/ch3-outline.scm#L1537-1559 <- 3.81 2009 Oct 12 00:16:50 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.81 2009 Oct 12 00:16:53 this one took some time 2009 Oct 12 00:19:26 I punted on part of it -- my 'reset doesn't accept a specified value 2009 Oct 12 00:20:29 ah 2009 Oct 12 00:21:30 I didn't think to require passing either 'generate or a pair ('reset x) 2009 Oct 12 00:21:32 I'm not sure why I used a pair to reset, should have used a list (reset x) 2009 Oct 12 00:21:42 That's probably the right way to handle it. 2009 Oct 12 00:22:21 it's a kind of awkward interface no matter how you slice it, I think 2009 Oct 12 00:22:40 seems like if you have the ability to create a new stream you don't really need to give a way to reset the one you have 2009 Oct 12 00:23:49 good point 2009 Oct 12 00:24:21 -*- inimino fixed his to use a list 2009 Oct 12 00:24:50 I think both of these should work 2009 Oct 12 00:25:09 looks like you tested yours, so I'm more confident in that one :-) 2009 Oct 12 00:25:23 interesting how you use that stream-map 2009 Oct 12 00:25:43 I kind of like that solution 2009 Oct 12 00:26:46 how the stream of both requests and generated random numbers produces the rest of the stream 2009 Oct 12 00:28:23 the more direct approach you used seems more obvious, not sure why it didn't occur to me to do it that way 2009 Oct 12 00:29:23 I still find the stream stuff somewhat unintuitive 2009 Oct 12 00:29:43 well, anything else on 3.81? 2009 Oct 12 00:29:47 yes, it's definitely a mental workout 2009 Oct 12 00:29:51 yeah 2009 Oct 12 00:30:08 Not really 2009 Oct 12 00:30:24 I'd kind of be curious to see the author's solution to this one 2009 Oct 12 00:32:13 well, 3.82? 2009 Oct 12 00:32:24 sure 2009 Oct 12 00:32:27 ok 2009 Oct 12 00:32:34 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.82 2009 Oct 12 00:32:43 -*- aamar was browsing for an online official solution to 3.81 but no dice 2009 Oct 12 00:32:47 ah, this one also took me some time 2009 Oct 12 00:32:52 yeah me too 2009 Oct 12 00:33:06 I found the instructor's manual but looks like it's not online 2009 Oct 12 00:33:16 http://github.com/aalearn/aalearn-sicp/blob/master/ch3-outline.scm#L1562-1602 2009 Oct 12 00:33:36 yes, this one had a lot of pieces 2009 Oct 12 00:35:14 I used the stream-based random number generator from the previous exercise 2009 Oct 12 00:35:40 I think it make the solution less obvious 2009 Oct 12 00:36:14 I should note that I didn't implement 'clamp', or test any of this ;) 2009 Oct 12 00:36:58 not familiar with clamp :) 2009 Oct 12 00:37:29 it just takes whatever the random stream gives you, and turns it into something between the other two values 2009 Oct 12 00:38:26 so if the stream of random numbers is between 0..MAX_INT or something, it distributes those numbers over the range you actually want 2009 Oct 12 00:38:48 got it, ok 2009 Oct 12 00:39:16 your random number stream that is already clamped is more elegant 2009 Oct 12 00:39:25 however, I wanted to only use one stream 2009 Oct 12 00:40:09 the previous random-stream generator would only be initialized once, so it doesn't really give you a good way of getting more than one random stream 2009 Oct 12 00:40:29 oh, you could have used map-successive-pairs from the book 2009 Oct 12 00:40:37 (since random-init is the same) 2009 Oct 12 00:40:42 I had that for a moment, but seem to have abandoned that approach at some point 2009 Oct 12 00:40:54 oh, I must have forgotten about map-successive-pairs 2009 Oct 12 00:41:12 sounds like that would have saved me some lines 2009 Oct 12 00:41:22 In your monte-carlo-xy, you use test -- do you mean experiment there? 2009 Oct 12 00:42:47 whoops, yes I did 2009 Oct 12 00:43:40 -*- inimino fixes 2009 Oct 12 00:44:10 also in (define successes...) I think you need an "experiment-results" near the end 2009 Oct 12 00:46:37 in addition to the one that's there? 2009 Oct 12 00:47:20 n/m -- bad reading on my part! 2009 Oct 12 00:48:22 I probably shouldn't have put that comment where I did, makes it hard to follow the bracketing 2009 Oct 12 00:51:35 I updated mine to use your map-successive-pairs 2009 Oct 12 00:52:27 I was thinking about how to generalize this to allow experiments that use any number of random numbers from the stream 2009 Oct 12 00:52:53 but I couldn't see any good way which is why I called mine monte-carlo-xy 2009 Oct 12 00:54:18 Hm... 2009 Oct 12 00:54:44 your solution makes monte-carlo a function over streams of results which is probably a better way to do it 2009 Oct 12 00:55:00 I think if you want to extract out the two-variable nature of it, you have to pass monte-carlo an experiment-stream 2009 Oct 12 00:55:04 (and closer to the way the original exercise worked) 2009 Oct 12 00:55:20 I think so 2009 Oct 12 00:55:44 oh, that idea isn't mine! 2009 Oct 12 00:55:56 It's in the book -- above Exercise 3.81 2009 Oct 12 00:56:04 I missed it at first, but nearly replicated it. 2009 Oct 12 00:56:06 or you could have each experiment pass back the random stream to use for the next experiment 2009 Oct 12 00:56:09 oh 2009 Oct 12 00:56:30 oh, I see 2009 Oct 12 00:56:41 I must have missed that entirely 2009 Oct 12 00:58:44 I should have re-read the section an extra time or two while doing the exercise :) 2009 Oct 12 00:59:52 well, I think your estimate-integral works identically... 2009 Oct 12 01:00:01 Should we go to Ch. 4? 2009 Oct 12 01:00:16 yeah 2009 Oct 12 01:00:57 http://github.com/aalearn/aalearn-sicp/blob/master/ch4-outline.scm 2009 Oct 12 01:01:34 http://inimino.org/~inimino/projects/2009/SICP/chap_4/4.1 2009 Oct 12 01:02:55 looks the same to me 2009 Oct 12 01:03:40 yeah, same answer 2009 Oct 12 01:04:13 hm, looks like I forgot to pass the env to eval 2009 Oct 12 01:04:36 apart from that, and variable names, they are identical, I think 2009 Oct 12 01:04:44 oh, good catch 2009 Oct 12 01:04:58 also to list-of-values 2009 Oct 12 01:05:04 yeah 2009 Oct 12 01:06:19 -*- inimino fixes 2009 Oct 12 01:06:28 alright 2009 Oct 12 01:08:14 what should we do for next time? 2009 Oct 12 01:08:18 -*- inimino looks ahead 2009 Oct 12 01:09:01 4.14 might work 2009 Oct 12 01:09:17 ok, looks good 2009 Oct 12 01:09:42 4.14 it is :) 2009 Oct 12 01:11:22 cool, see you in a couple weeks! 2009 Oct 12 01:13:53 cool, see yout hen