2009 Aug 02 23:56:57 aamar, mariorz, you guys around? 2009 Aug 02 23:57:10 (anyone else?) 2009 Aug 02 23:58:01 hey inimino 2009 Aug 02 23:58:07 hey aamar 2009 Aug 03 00:03:02 sup 2009 Aug 03 00:03:33 hey 2009 Aug 03 00:03:51 barely finished i think 2009 Aug 03 00:04:21 I finished about a half hour ago 2009 Aug 03 00:04:32 this section was long 2009 Aug 03 00:04:52 indeed 2009 Aug 03 00:05:44 so should we start? 2009 Aug 03 00:05:58 sure 2009 Aug 03 00:06:04 3.24? 2009 Aug 03 00:06:10 hey inimino, offtopic, have you played with bespin? 2009 Aug 03 00:06:51 a little bit, yeah, when it came out 2009 Aug 03 00:07:49 looks interesting will try and install it locally later 2009 Aug 03 00:07:57 http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L717 2009 Aug 03 00:08:23 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.24 2009 Aug 03 00:08:56 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L593-624 2009 Aug 03 00:09:28 same all around 2009 Aug 03 00:10:20 these look the same, yeah 2009 Aug 03 00:10:23 ok 2009 Aug 03 00:10:25 3.25? 2009 Aug 03 00:10:41 http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L767 2009 Aug 03 00:10:52 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.25 2009 Aug 03 00:10:55 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L626-657 2009 Aug 03 00:13:40 mine doesnt work 2009 Aug 03 00:14:20 just moved on 2009 Aug 03 00:16:33 it looks about right 2009 Aug 03 00:16:42 inimino -- will yours always return nil? 2009 Aug 03 00:16:56 sigh 2009 Aug 03 00:17:02 have to go guys 2009 Aug 03 00:17:04 since you have a construct like (if x (recur) x) 2009 Aug 03 00:17:18 ill catch up with the logs 2009 Aug 03 00:17:22 :( 2009 Aug 03 00:17:37 :( 2009 Aug 03 00:17:41 :( 2009 Aug 03 00:17:48 oh hell why not 2009 Aug 03 00:17:49 :( 2009 Aug 03 00:18:15 alright mariorz see you next time 2009 Aug 03 00:18:54 aamar: I don't think so 2009 Aug 03 00:18:58 catch you in a couple weeks, mariorz 2009 Aug 03 00:19:11 sure guys, sorry to miss it, unforseen airport trip 2009 Aug 03 00:19:20 3.4 in 2 weeks i presume? 2009 Aug 03 00:19:29 yeah, sounds good to me 2009 Aug 03 00:19:52 allright laters! 2009 Aug 03 00:20:00 later 2009 Aug 03 00:20:44 aamar: it shouldn't, because eventually the path will be empty and it won't reach that 2009 Aug 03 00:21:06 (or it will return #f at some point) 2009 Aug 03 00:21:13 inimino -- i see it now 2009 Aug 03 00:21:59 reading yours now 2009 Aug 03 00:22:24 Yes, I expect that will work. 2009 Aug 03 00:23:41 yours looks good 2009 Aug 03 00:24:24 make-branch is more explicit than the way that happens in mine 2009 Aug 03 00:27:33 very similar though 2009 Aug 03 00:28:14 alright, anything more on this one? 2009 Aug 03 00:28:30 no, let's go on to 3.26 2009 Aug 03 00:28:35 alright 2009 Aug 03 00:28:46 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.26 2009 Aug 03 00:29:40 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L659-669 2009 Aug 03 00:30:08 similar idea... 2009 Aug 03 00:30:14 -=- rudybot_ is now known as rudybot 2009 Aug 03 00:30:18 I wasn't really sure what they were asking for here 2009 Aug 03 00:30:25 seemed like kind of a vague question 2009 Aug 03 00:31:07 looks like we have the same answer 2009 Aug 03 00:31:13 each node is a list of 4 items 2009 Aug 03 00:31:19 key, value, left, right 2009 Aug 03 00:31:28 yeah 2009 Aug 03 00:31:45 alright, next one? 2009 Aug 03 00:32:00 okay to move on to 3.27? 2009 Aug 03 00:32:04 sure 2009 Aug 03 00:32:10 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.27 2009 Aug 03 00:33:10 here is mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L875 2009 Aug 03 00:34:08 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L671-686 2009 Aug 03 00:37:36 looks the same 2009 Aug 03 00:37:37 still not convinced I'm drawing the Environment diagrams correctly, but I feel I do understand what is going on conceptually. 2009 Aug 03 00:37:46 I think we agree on how it works. 2009 Aug 03 00:37:54 Is that Haskell code at the bottom of yours? 2009 Aug 03 00:37:58 yeah I'm not sure about how to draw those exactly 2009 Aug 03 00:38:00 yeah 2009 Aug 03 00:38:08 really cool how that works, actually 2009 Aug 03 00:38:34 it's like the memoized version, but seeded with 0 and 1. 2009 Aug 03 00:39:04 yes, that's interesting... thinking about picking up a book on Haskell 2009 Aug 03 00:39:10 fibs is an infinite list that's generated as needed 2009 Aug 03 00:39:38 it's a fun language 2009 Aug 03 00:39:56 and it memoizes as it goes, i.e. computes as much of the list as needed and retains them in the stack? 2009 Aug 03 00:40:15 interesting... 2009 Aug 03 00:40:24 because it's lazy, the list is computed as needed, yeah 2009 Aug 03 00:40:44 and once computed doesn't need to be recomputed 2009 Aug 03 00:40:57 ok, next we start on all these circuit-logic problems 2009 Aug 03 00:41:04 yeah 2009 Aug 03 00:41:45 I enjoyed these 2009 Aug 03 00:42:14 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.28 2009 Aug 03 00:43:00 Yes, I liked working through these. 2009 Aug 03 00:43:01 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L688-703 2009 Aug 03 00:43:14 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L955 2009 Aug 03 00:43:46 same 2009 Aug 03 00:44:01 these seem to be identical yes 2009 Aug 03 00:44:08 3.29? 2009 Aug 03 00:44:36 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L688-703 2009 Aug 03 00:44:40 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.29 2009 Aug 03 00:45:03 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L969 2009 Aug 03 00:45:48 mariorz added a procedure and two add-action! calls I didn't have 2009 Aug 03 00:46:05 you and I both forgot the add-action! calls -- mariorz remembered 2009 Aug 03 00:46:45 are they needed? 2009 Aug 03 00:47:21 I would have thought the inverter and and-gate procedures would have taken care of it 2009 Aug 03 00:47:23 not sure... 2009 Aug 03 00:47:35 yes, you're right 2009 Aug 03 00:47:47 they're not needed when you're constructing this out of other gates 2009 Aug 03 00:47:51 though I admit I got confused about where the lines were between some parts of this particular system... 2009 Aug 03 00:48:14 agreed 2009 Aug 03 00:48:32 and we agreed on the delay 2009 Aug 03 00:48:35 next one? 2009 Aug 03 00:48:36 yes 2009 Aug 03 00:48:38 ok 2009 Aug 03 00:49:02 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L716-731 2009 Aug 03 00:49:25 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.30 2009 Aug 03 00:49:59 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L989 2009 Aug 03 00:51:54 I think you and I have the same answer for the delay on this one 2009 Aug 03 00:52:20 you and I got the same answer for delay time for half-adder, but different answers for full adder, I think. 2009 Aug 03 00:52:36 my syntax is abysmal, sorry about that 2009 Aug 03 00:52:44 oh, I'll look closer 2009 Aug 03 00:54:09 hm 2009 Aug 03 00:54:16 my answer for full adder delay on "S" output = 2A + 2 * max(A+I,O) 2009 Aug 03 00:54:50 ah 2009 Aug 03 00:55:10 and full adder delay on "C" output = 2A + max(A+I,O) + O 2009 Aug 03 00:55:59 oh, hm 2009 Aug 03 00:56:16 I seem to have oversimplified this one 2009 Aug 03 00:56:46 I think I treated the half-adder as only having one delay 2009 Aug 03 00:57:03 instead of considering the outputs separately 2009 Aug 03 00:58:28 so everything after that in mine is wrong 2009 Aug 03 00:58:44 yours looks like it might be more correct, now that I'm reading it properly 2009 Aug 03 00:59:18 I'll have to go back and rework that one 2009 Aug 03 00:59:32 I'm not that confident that my answer is right, because it does get a little hairy. 2009 Aug 03 00:59:53 okay, let me know if you get a different answer sometime! 2009 Aug 03 01:00:41 alright, we can look at it next time 2009 Aug 03 01:00:47 mariorz and I seem to have the same code 2009 Aug 03 01:01:00 except for doing the steps in a different order 2009 Aug 03 01:02:15 I seem to have missed out on that part of the problem altogether... 2009 Aug 03 01:02:33 but your answers look like they agree 2009 Aug 03 01:02:44 yeah 2009 Aug 03 01:03:06 alright, 3.31? 2009 Aug 03 01:03:24 yes 2009 Aug 03 01:03:31 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L733-737 2009 Aug 03 01:03:51 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.31 2009 Aug 03 01:05:07 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L1150 2009 Aug 03 01:06:06 yours and mariorz's answers are the same but I'm not quite sure if it agrees with mine or not 2009 Aug 03 01:06:21 -*- aamar thinks 2009 Aug 03 01:10:26 For example, creating a half-adder circuit and then setting the A input to 1 would not change the output of the inverter (E in figure 3.25), since the input to the inverter would still be 0. 2009 Aug 03 01:10:35 exactly 2009 Aug 03 01:10:47 oh I wrote that :/ 2009 Aug 03 01:10:49 I'm not sure I agree with that point yet, in your answer. 2009 Aug 03 01:10:55 -*- inimino blushes 2009 Aug 03 01:10:58 ok 2009 Aug 03 01:11:04 Can you explain why it wouldn't propagate, if A were set to 1? 2009 Aug 03 01:11:12 ok I'll try 2009 Aug 03 01:12:37 ok, when the half-adder was set up, the inverter was set up on wires C and E (in that same figure) 2009 Aug 03 01:13:34 this means that an action was attached to wire E, but it wasn't run yet, because the procedure isn't being imediately applied anymore 2009 Aug 03 01:14:01 so the value on E is still 0 2009 Aug 03 01:14:33 and the input on C to the inverter is also still 0, since only A changed (and C is coming out of the and-gate) 2009 Aug 03 01:14:56 since the inverter input is the same, the procedure won't be run now either 2009 Aug 03 01:15:33 so E will still be set to 0 and the output of the half-adder will be wrong even after we set the A input. 2009 Aug 03 01:15:47 but once A is changed, that would trigger the and-gate change, wouldn't it? 2009 Aug 03 01:16:31 as soon as that change is triggered then everything else would also be triggered ? 2009 Aug 03 01:16:35 yes, but the action attached to wire C will only run if the input value changed 2009 Aug 03 01:17:32 that's in make-wire 2009 Aug 03 01:17:35 (if (not (= signal-value new-value)) 2009 Aug 03 01:17:35 (begin (set! signal-value new-value) 2009 Aug 03 01:17:37 (call-each action-procedures)) 2009 Aug 03 01:17:50 and that value would only trigger if A's actions were triggered 2009 Aug 03 01:18:17 So the point is, it goes back to whether or not A's actions are triggered initially. 2009 Aug 03 01:18:22 so actually it's in the and-gate where the propagation will stop 2009 Aug 03 01:19:15 basically 2009 Aug 03 01:19:19 wires start at 0 2009 Aug 03 01:19:26 so when you hook everything up... 2009 Aug 03 01:19:32 all the wires are still at 0 2009 Aug 03 01:19:45 including the ones before and after the inverter 2009 Aug 03 01:20:01 ok that's fine 2009 Aug 03 01:20:03 unless you run the procedure when you attach it to the wire 2009 Aug 03 01:20:08 if you set A to 1 2009 Aug 03 01:20:34 then if you set A to 1, the and gate output is still 0 2009 Aug 03 01:20:59 Once you set A to 1, you do think that will trigger the And gate to operate, right? 2009 Aug 03 01:21:08 -*- inimino thinks 2009 Aug 03 01:21:40 partly, yes 2009 Aug 03 01:22:06 but it won't trigger the inverter to do anything, because of that equality test in make-wire 2009 Aug 03 01:22:24 oh I see 2009 Aug 03 01:22:31 (= (signal-value new-value)) will be true 2009 Aug 03 01:22:42 so the inverter will happily sit there with 0 input and 0 output 2009 Aug 03 01:22:43 The point is that B won't be propagated into the and-gate 2009 Aug 03 01:22:47 Is that right? 2009 Aug 03 01:23:41 well B is still 0, so even if it was, the inverter would still be in an inconsistent state 2009 Aug 03 01:23:45 Oh ok. 2009 Aug 03 01:24:35 so the system would sort of work in that if you 'flushed' everything through one time, it would continue to propagate correctly after that 2009 Aug 03 01:25:47 but getting everything going the first time would be hard 2009 Aug 03 01:25:49 Okay, got it 2009 Aug 03 01:25:57 alright 2009 Aug 03 01:27:32 So we conceptually agree that the problem is setting up the initial states, but we have identified different failure points; perhaps both are right. 2009 Aug 03 01:28:08 yes I think both are partly right 2009 Aug 03 01:29:06 if you think about it more and have further insight that I missed let me know because it was a hard problem I thought 2009 Aug 03 01:29:27 ok, will do 2009 Aug 03 01:29:40 ok, next one? 2009 Aug 03 01:29:43 lots of reading about logic circuits, not many exercises 2009 Aug 03 01:29:49 3.32? 2009 Aug 03 01:30:38 yes 2009 Aug 03 01:30:41 ok 2009 Aug 03 01:30:49 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.32 2009 Aug 03 01:33:40 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L739-749 2009 Aug 03 01:34:13 our answers agree 2009 Aug 03 01:34:14 seems to be the same answer 2009 Aug 03 01:34:19 yep 2009 Aug 03 01:34:29 alright, next one? 2009 Aug 03 01:35:11 ok 2009 Aug 03 01:35:22 http://github.com/aalearn/aalearn-sicp/blob/98b4b565a3363d8ed9a70a1e1ca64ed7f9f7343e/ch3-outline.scm#L739-749 2009 Aug 03 01:35:22 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.33 2009 Aug 03 01:35:54 ha, mine is very wrong 2009 Aug 03 01:35:55 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L1452 2009 Aug 03 01:37:20 mariorz's and mine agree, yours is similar 2009 Aug 03 01:37:47 except it looks like you forgot to use constant 2009 Aug 03 01:39:09 I definitely did forget to use that. 2009 Aug 03 01:39:17 Okay, I'll fix that... 2009 Aug 03 01:39:29 ok 2009 Aug 03 01:40:42 ok, got a bit further 2009 Aug 03 01:40:45 3.34 ? 2009 Aug 03 01:40:49 sure 2009 Aug 03 01:41:02 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.34 2009 Aug 03 01:41:08 a little slowness on github... 2009 Aug 03 01:41:09 http://github.com/aalearn/aalearn-sicp/blob/1714e6508e50bc9fd6756e439a1b634dbfb65b88/ch3-outline.scm#L765-769 2009 Aug 03 01:41:51 all agreed 2009 Aug 03 01:42:47 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L1470 2009 Aug 03 01:43:02 yep, these look the same 2009 Aug 03 01:43:28 3.35? 2009 Aug 03 01:43:38 ok 2009 Aug 03 01:43:44 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.35 2009 Aug 03 01:43:55 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L1487 2009 Aug 03 01:44:01 http://github.com/aalearn/aalearn-sicp/blob/1714e6508e50bc9fd6756e439a1b634dbfb65b88/ch3-outline.scm#L771-798 2009 Aug 03 01:44:55 hm, I needed to add a test for (has-value? a) 2009 Aug 03 01:45:04 some minor differences... 2009 Aug 03 01:45:09 I forgot to use get-value 2009 Aug 03 01:45:21 I think you forgot it in the (square a) call... 2009 Aug 03 01:45:37 Also, you don't have a process-new-value call at the end of process-forget-value, which I think you need. 2009 Aug 03 01:46:42 hm, probably 2009 Aug 03 01:47:42 I wasn't sure about that, but I guess that's right 2009 Aug 03 01:48:17 I wasn't sure if it would ever have both inputs set at the same time 2009 Aug 03 01:48:32 but that could happen as an error and then you'd want to fix it and recover 2009 Aug 03 01:49:31 mariorz left off the process-new-value there also 2009 Aug 03 01:49:57 what about the case if neither is set? 2009 Aug 03 01:51:03 probably should not call set-value! on b in that case. 2009 Aug 03 01:51:27 if neither is set then process-new-value would never be called 2009 Aug 03 01:51:35 (unless something else is broken) 2009 Aug 03 01:52:10 basically a connecter would have to send 'I-have-a-value when it doesn't actually have a value, I think 2009 Aug 03 01:52:12 true, ok 2009 Aug 03 01:52:47 although in my code, you could call forget-value on all, which would trigger a call to process-new-value 2009 Aug 03 01:53:31 hm, true 2009 Aug 03 01:53:59 I guess the question here is what are the acceptable states for the connectors we are connected to to be in 2009 Aug 03 01:54:09 and what are the possible state transitions 2009 Aug 03 01:54:31 I wasn't quite sure what those were supposed to be in this section 2009 Aug 03 01:54:53 perhaps because I didn't spend enough time on it 2009 Aug 03 01:56:17 I didn't actually try out any of this code to see if it would work... not clear how many edge cases to handle. 2009 Aug 03 01:56:30 Let's go forward to last few? 2009 Aug 03 01:56:31 neither did I 2009 Aug 03 01:56:32 sure 2009 Aug 03 01:57:01 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.36.svg 2009 Aug 03 01:58:04 http://github.com/aalearn/aalearn-sicp/blob/36612f8644dac89c8e6ea5fc63415639855475a9/ch3-outline.scm#L800-836 2009 Aug 03 01:58:17 I agree with your diagram for 3.36 2009 Aug 03 01:58:34 I should have drawn an additional box for set-my-value, missed that 2009 Aug 03 01:59:22 ok, looks mainly the same 2009 Aug 03 01:59:34 here's mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L1516 2009 Aug 03 01:59:54 also quite similar and has the same explanation as yours 2009 Aug 03 02:00:01 partial diagram 2009 Aug 03 02:00:17 yes 2009 Aug 03 02:00:18 (nothing will happen, which I should have also pointed out) 2009 Aug 03 02:00:23 okay, 3.37 was fairly easy 2009 Aug 03 02:00:45 http://github.com/aalearn/aalearn-sicp/blob/36612f8644dac89c8e6ea5fc63415639855475a9/ch3-outline.scm#L817-836 2009 Aug 03 02:00:48 yeah 2009 Aug 03 02:00:49 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.37 2009 Aug 03 02:01:07 mariorz's: http://github.com/mariorz/sicp/blob/1d08d2f0a431c1891ad7965e30d19fd0f9baa76b/3.ss#L1539 2009 Aug 03 02:01:12 same answers 2009 Aug 03 02:01:57 mariorz missed cv, otherwise we all have exactly the same 2009 Aug 03 02:02:19 okay, good session 2009 Aug 03 02:02:22 gotta run... 2009 Aug 03 02:02:27 alright 2009 Aug 03 02:02:27 all of 3.4 for next time, right? 2009 Aug 03 02:02:34 sure, lets go for it 2009 Aug 03 02:02:51 good meeting, see you in two weeks :-) 2009 Aug 03 02:02:53 great, talk to you pretty soon