2009 Jul 20 00:02:15 hey 2009 Jul 20 00:02:40 aamar, mariorz, around? 2009 Jul 20 00:03:00 hey 2009 Jul 20 00:03:02 hey 2009 Jul 20 00:03:04 hey 2009 Jul 20 00:03:50 everyone good? 2009 Jul 20 00:03:59 did not make to the end 2009 Jul 20 00:04:03 I didn't get too far these last two weeks 2009 Jul 20 00:04:06 not even close, working on 2.24 2009 Jul 20 00:04:09 brb phone call 2009 Jul 20 00:04:18 er 3.24 2009 Jul 20 00:05:38 3.30 2009 Jul 20 00:05:52 busy week for me as well 2009 Jul 20 00:07:09 ive been playing around with clojure and that ate up some of my sicp allocated time :P 2009 Jul 20 00:08:05 been meaning to try out clojure 2009 Jul 20 00:08:09 maybe in an upcoming week 2009 Jul 20 00:08:10 :) 2009 Jul 20 00:09:36 http://paste.lisp.org/display/83831 2009 Jul 20 00:09:41 its cool 2009 Jul 20 00:09:58 but im having trouble wrapping my head around the whole java archtecture 2009 Jul 20 00:10:31 everything feels over engineered i dont know 2009 Jul 20 00:11:30 that builds graph of wikipedia articles 2009 Jul 20 00:11:52 but there is some kind of memory leak 2009 Jul 20 00:12:26 the sax parser seems to want to keep the whole doc in memory 2009 Jul 20 00:15:08 it's not just the node_ids and the nodelinks, but the files themselves? 2009 Jul 20 00:16:18 i think so, the node_ids alone take about 500mb which i foudn believable (the whole file is 2.5 GB) but then on that seond test run for the node links, if completelly fills the heap 2009 Jul 20 00:16:32 a 2GB heap 2009 Jul 20 00:16:49 and well the links are only being stored as keys 2009 Jul 20 00:21:48 -*- inimino finally off the phone 2009 Jul 20 00:22:01 -*- inimino reads 2009 Jul 20 00:22:06 time to start? 2009 Jul 20 00:22:18 yeah, I got to 3.25 only 2009 Jul 20 00:22:46 cool i was worried 2009 Jul 20 00:22:53 its like no child left behind 2009 Jul 20 00:22:58 thanks guys! 2009 Jul 20 00:23:11 hehe 2009 Jul 20 00:23:15 haha 2009 Jul 20 00:23:41 ok, should we start with 3.20 ? 2009 Jul 20 00:23:42 alright, sure, let's start 2009 Jul 20 00:24:34 heh 2009 Jul 20 00:24:49 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.20.svg 2009 Jul 20 00:25:02 oh dman 2009 Jul 20 00:25:17 i didnt do the diagrams 2009 Jul 20 00:28:08 http://github.com/aalearn/aalearn-sicp/blob/6ce0edfd7bf669eaedd50d2249a4433457ee0453/ch3-outline.scm#L449-461 2009 Jul 20 00:28:12 but yours looks right 2009 Jul 20 00:28:48 ok 2009 Jul 20 00:29:11 -*- inimino looks at aamar's 2009 Jul 20 00:29:33 mine's different -- trying to remember what exactly I meant 2009 Jul 20 00:30:51 I think yours is the same idea 2009 Jul 20 00:31:11 okay, more or less similar -- you drew z as a separate environment 2009 Jul 20 00:31:31 but we agree that it points back to the environment associated with x and y 2009 Jul 20 00:31:33 the z has those ()() with only one line coming out which I take as indicating that they both point to x 2009 Jul 20 00:31:33 ok 2009 Jul 20 00:31:35 yeah 2009 Jul 20 00:32:27 I think we should go to 3.21 2009 Jul 20 00:32:38 they point to (x,y) no? 2009 Jul 20 00:32:49 (x . y) 2009 Jul 20 00:33:32 well, I think the line from x in the global environment is going to the wrong place 2009 Jul 20 00:33:50 but yeah, I think we can move on to 3.21 2009 Jul 20 00:34:23 I didn't have any y in this exercise, actually 2009 Jul 20 00:34:59 i got 3.21 wrong didnt noticed until i needed a print-deque 2009 Jul 20 00:35:01 no wait, I did... 2009 Jul 20 00:35:02 there's a y in E1 2009 Jul 20 00:35:13 bfixed print-deque but didnt get back to this one 2009 Jul 20 00:35:22 (I think the line coming from x was meant to point to E1) 2009 Jul 20 00:35:44 ok got it, thanks 2009 Jul 20 00:35:50 okay 3.21 2009 Jul 20 00:35:58 http://github.com/aalearn/aalearn-sicp/blob/6ce0edfd7bf669eaedd50d2249a4433457ee0453/ch3-outline.scm#L463 2009 Jul 20 00:36:14 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.21 2009 Jul 20 00:36:20 oh cool 2009 Jul 20 00:36:32 thats what i have 2009 Jul 20 00:37:20 pushing to github 2009 Jul 20 00:37:25 whoops, guess I could have used front-ptr there for consistency 2009 Jul 20 00:38:58 yeah but works jsut as well 2009 Jul 20 00:39:13 I have trouble remembering to use the "interface" in some of these cases. 2009 Jul 20 00:39:29 yeah, likewise 2009 Jul 20 00:39:37 Seems good though 2009 Jul 20 00:39:41 http://github.com/mariorz/sicp/blob/ea99328e4f06518a4eee554f7e1f80212341c854/3.ss#L510 2009 Jul 20 00:39:52 you end up needing to think about the actual representation to answer most of the exercises 2009 Jul 20 00:40:26 ok, no explicit "display" in mariorz, but with my interpreter it would work fine 2009 Jul 20 00:40:51 ok same answer 2009 Jul 20 00:41:00 t 2009 Jul 20 00:41:05 oh yeah, display 2009 Jul 20 00:41:36 this was the part of the book where I really start to miss algebraic datatypes :/ 2009 Jul 20 00:42:16 how so? 2009 Jul 20 00:42:40 well, using pairs for everything, and then, as aamar was saying trying to remember to use an interface 2009 Jul 20 00:42:59 as opposed to the way you'd do this in Haskell 2009 Jul 20 00:43:31 especially in the deque problem, I found using pairs really inconvenient and error-prone 2009 Jul 20 00:43:44 but if you could say something like 2009 Jul 20 00:44:16 well 2009 Jul 20 00:44:36 I won't try to translate into Haskell, that would be too off-topic 2009 Jul 20 00:45:17 inimino: you do alot of haskell? 2009 Jul 20 00:45:20 but I just really like using data constructors and pattern matching to say exactly what you mean 2009 Jul 20 00:45:49 mariorz: not a lot, I used it a lot about a year ago writing an email spam filter 2009 Jul 20 00:46:14 i should look into it a bit 2009 Jul 20 00:46:46 I really recommend learning it 2009 Jul 20 00:47:13 it's got all the elegance of Scheme but without the icky mutable state stuff we are getting into now :-) 2009 Jul 20 00:47:53 :) 2009 Jul 20 00:48:03 anyway, 2009 Jul 20 00:48:10 k 2009 Jul 20 00:48:15 where were we? 2009 Jul 20 00:48:38 3.22 i think 2009 Jul 20 00:49:29 yeah 2009 Jul 20 00:49:45 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.22 2009 Jul 20 00:50:10 http://github.com/aalearn/aalearn-sicp/blob/6ce0edfd7bf669eaedd50d2249a4433457ee0453/ch3-outline.scm#L472 2009 Jul 20 00:51:04 hm, I think mine is broken 2009 Jul 20 00:51:46 specifically it should fail to insert into an empty queue 2009 Jul 20 00:51:56 i was about to say mine is like inimino's but its literally the same, didnt do this one either 2009 Jul 20 00:52:06 er aamar's 2009 Jul 20 00:53:58 inimino: yeah, an if in inert would take care of that 2009 Jul 20 00:55:01 yeah 2009 Jul 20 00:56:26 I don't see any other consequential differences 2009 Jul 20 00:56:32 me neither 2009 Jul 20 00:56:39 alright, 3.23? 2009 Jul 20 00:57:09 yaya this one i did 2009 Jul 20 00:57:13 was fun 2009 Jul 20 00:57:36 yeah 2009 Jul 20 00:57:44 http://github.com/mariorz/sicp/blob/ea99328e4f06518a4eee554f7e1f80212341c854/3.ss#L510 2009 Jul 20 00:57:56 I wasn't a huge fan of this one 2009 Jul 20 00:58:03 http://github.com/aalearn/aalearn-sicp/blob/6ce0edfd7bf669eaedd50d2249a4433457ee0453/ch3-outline.scm#L512-591 2009 Jul 20 00:58:07 Took a long time for me 2009 Jul 20 00:58:28 same here a couple fo hours yesterday 2009 Jul 20 00:58:38 print-deque took me the longest 2009 Jul 20 01:00:41 yeah it took me a long time too 2009 Jul 20 01:01:01 I didn't even write a print-deque 2009 Jul 20 01:01:59 okay, scanning for differences... 2009 Jul 20 01:02:45 Okay, so we're implementing doubly-linked lists. 2009 Jul 20 01:03:36 mariorz: in front-insert-deque!, I think you also need to set the "previous" pointer to new_pair for whatever used to be at the front of the list. 2009 Jul 20 01:04:19 mariorz: yours looks very similar to mine 2009 Jul 20 01:04:39 aamar: i do that 2009 Jul 20 01:04:46 (set-cdr! (cdr new-pair) (front-ptr deque)) 2009 Jul 20 01:04:57 oh wait 2009 Jul 20 01:05:16 I missed that, but it looks like he's right 2009 Jul 20 01:05:55 eyah 2009 Jul 20 01:06:00 should add 2009 Jul 20 01:06:00 (set-cdr! (cdr (front-ptr deque) new-pair)) 2009 Jul 20 01:06:10 but weird becuase my tests worked 2009 Jul 20 01:06:14 you have a '() where you want (front-ptr deque) in the new-pair I think 2009 Jul 20 01:06:44 true better to do it from the let 2009 Jul 20 01:07:08 but still my tests worked 2009 Jul 20 01:07:22 maybe some other bug compensates? :P 2009 Jul 20 01:07:25 wait scratch that 2009 Jul 20 01:07:35 on line 596 you do set it 2009 Jul 20 01:08:39 I think both rear-insert and front-insert might be correct 2009 Jul 20 01:08:49 but they're asymmetrical 2009 Jul 20 01:09:54 im trying to remember what i did at, some issue presented when writing print-deque made me do that fiz 2009 Jul 20 01:09:57 x 2009 Jul 20 01:10:31 In the case where the queue is not empty, you need to set 3 pointers, by my count. 2009 Jul 20 01:10:34 1. the front-queue 2009 Jul 20 01:10:45 2. "next" on the new-pair 2009 Jul 20 01:11:08 no, I think aamar was right all along and your front-insert is wrong 2009 Jul 20 01:11:18 3. "prev" on the previous front-queue (or alternately on new-pair's next) 2009 Jul 20 01:11:26 agreed 2009 Jul 20 01:11:42 inimino: 596 sets the enx pointer on the new_pair 2009 Jul 20 01:11:58 next 2009 Jul 20 01:11:59 yes, that takes care of ptr 2 in aamar's list 2009 Jul 20 01:12:32 but nothing sets his #3 2009 Jul 20 01:12:56 yes, my tests would not catch it unless y rear-delete all the way to the seocnd pointer 2009 Jul 20 01:13:09 exactly 2009 Jul 20 01:13:15 I think I can construct a test that breaks it -- basically do two front inserts, then two rear-deletes 2009 Jul 20 01:13:18 ok agreed 2009 Jul 20 01:13:20 yeah 2009 Jul 20 01:13:35 right 2009 Jul 20 01:14:19 i catched the opposite bug which was fixed in rear-insert 2009 Jul 20 01:14:27 missed this one 2009 Jul 20 01:14:36 yeah 2009 Jul 20 01:14:47 alright, anything more on 3.23? 2009 Jul 20 01:15:06 it's interesting that we all had basically the same implementation 2009 Jul 20 01:15:38 one more thing... 2009 Jul 20 01:16:13 mariorz on rear-delete-queue -- you should also be setting front-ptr to null in some cases 2009 Jul 20 01:16:18 my version is actually a mess 2009 Jul 20 01:16:35 but inimino has a better solution 2009 Jul 20 01:17:39 same thing with front-delete-queue! -- if empty, set rear-ptr back to '() 2009 Jul 20 01:17:41 oh I got distracted and never finished reading aamar's 2009 Jul 20 01:18:16 yeah I see you added a check for singletons 2009 Jul 20 01:18:51 hi 2009 Jul 20 01:19:51 hello 2009 Jul 20 01:20:04 ok, noted 2009 Jul 20 01:20:20 well, I think we had more similar than different, overall 2009 Jul 20 01:20:22 Ok 2009 Jul 20 01:20:24 3.24 2009 Jul 20 01:20:27 if not the front-ptr keeps point to the prev last 2009 Jul 20 01:20:35 pointing 2009 Jul 20 01:20:47 http://github.com/aalearn/aalearn-sicp/blob/6ce0edfd7bf669eaedd50d2249a4433457ee0453/ch3-outline.scm#L593-618 2009 Jul 20 01:20:48 in the case of only one element 2009 Jul 20 01:20:58 man i was sure i had it right 2009 Jul 20 01:21:40 aamar: I finished reading yours, it does look very similar to mine 2009 Jul 20 01:21:59 im working on this one 2009 Jul 20 01:22:30 ok, cool 2009 Jul 20 01:22:32 I didn't implement it, just the change 2009 Jul 20 01:22:34 http://inimino.org/~inimino/projects/2009/SICP/chap_3/3.24 2009 Jul 20 01:23:27 i guess interface foe next/prev on the deques is def the way to go 2009 Jul 20 01:23:50 aamar yours looks like what I had in mind there 2009 Jul 20 01:24:07 (that's as far as I got also) 2009 Jul 20 01:24:09 inimino: we have identical solutions 2009 Jul 20 01:24:11 ok, 2009 Jul 20 01:24:14 let's hold here... 2009 Jul 20 01:24:15 yes 2009 Jul 20 01:24:57 alright 2009 Jul 20 01:25:11 i feel cool when using cddr and such though 2009 Jul 20 01:25:18 makes me want to grow a beard 2009 Jul 20 01:25:22 haha 2009 Jul 20 01:26:35 studies have shown that consistent use of car and cdr stimulates the facial hair follicles 2009 Jul 20 01:27:40 o i know 2009 Jul 20 01:27:54 and everyone knows beards increase skill 2009 Jul 20 01:27:56 brb 2009 Jul 20 01:28:41 it's a virtuous cycle 2009 Jul 20 01:30:36 back 2009 Jul 20 01:30:55 checked for a beard, definitely coming in a bit thicker lately 2009 Jul 20 01:31:13 hehe 2009 Jul 20 01:31:22 ok, how far should we aim for next time? 2009 Jul 20 01:31:39 I was just going to ask that :-) 2009 Jul 20 01:31:44 3.37 so we can be pretty sure to make it? 2009 Jul 20 01:31:50 maybe finally finish up? 2009 Jul 20 01:31:51 sure 2009 Jul 20 01:31:57 sounds good 2009 Jul 20 01:32:04 agreed 2009 Jul 20 01:32:14 I note that scroll bar still has a ways to go down in my browser window so I think that's about right 2009 Jul 20 01:32:50 heh 2009 Jul 20 01:33:03 lots of reading in the last few sections 2009 Jul 20 01:33:25 yeah 2009 Jul 20 01:33:29 and long exercises 2009 Jul 20 01:35:11 I guess they are getting us ready for "Exer. 4.x. Now write a Scheme interpreter mwahahaha" 2009 Jul 20 01:35:26 so next meeting Aug. 2? 2009 Jul 20 01:35:31 lol 2009 Jul 20 01:35:55 ok, good meeting 2009 Jul 20 01:35:59 i haven't shaved for a week 2009 Jul 20 01:35:59 see you in a week or 2 2009 Jul 20 01:36:18 cool 2009 Jul 20 01:36:19 alright, Aug. 2 it is :-) 2009 Jul 20 01:36:22 see you guys 2009 Jul 20 01:36:24 see you guys