00:48 (quit) corruptmemory: Ping timeout: 255 seconds 00:50 (join) neilv 00:50 (quit) neilv: Changing host 00:50 (join) neilv 01:14 (quit) jonrafkind: Ping timeout: 250 seconds 01:32 (join) evhan 01:34 (quit) evhan_: Ping timeout: 255 seconds 01:46 (join) mheld__ 01:49 (quit) mheld: Ping timeout: 255 seconds 01:49 (nick) mheld__ -> mheld 02:17 (join) Senjai 02:17 Senjai: Hey guys 02:19 Senjai: Can anyone help me understand Binary Search Trees? 02:23 Lajla: Senjai, what do you want to know? 02:24 Senjai: Well, I understand how they work, kind of. 02:24 Senjai: Makes it easier to search for objects using less iterations 02:24 Senjai: But I want to do the exercise in HTDP on creating a function to create a BST from a list of name value pairs 02:25 Lajla: Ahhh 02:25 Senjai: I just, can't get anywhere, I came to the conclusion that the list should be sorted in an ascending matter before attempting to create the tree.. 02:25 Lajla: How much help do you want? =P 02:25 Lajla: No,not at all. 02:25 Lajla: THat defeats the purpose a bit. 02:25 Senjai: I just need a .. push .. in the right direction 02:25 Lajla: Basically, you want your insertion algorithm to work like this: 02:26 Lajla: Basically, you have nodes and 'leaves' 02:26 Lajla: leaves are basically theend of your tree and contain no other branches. 02:26 Senjai: Leaves being the nodes branching off the left and right correct? 02:26 Lajla: No 02:26 Lajla: the inverse 02:26 Senjai: oh.. :/ 02:26 Lajla: leaves don't branch 02:26 Lajla: branches branch 02:26 Senjai: Sorry.. 02:26 Senjai: haha 02:26 Lajla: But like, what you want is an algorithm that does this: 02:27 Senjai: so a Leaf is (make-node key value false false) right/ 02:27 Lajla: yeah! 02:27 Lajla: And there is another type, which is sometimes called a leave. 02:27 Lajla: Which is a null-leave 02:27 Lajla: So a leave which has no value 02:27 Lajla: Test that wit (null-leave? node) 02:28 Senjai: Reference to undefined identifier 02:28 Lajla: So what you want is (if (null-leave? node) (make-leave key value) ...) 02:28 Lajla: And if it's not a null leave 02:28 Senjai: OH 02:28 Senjai: create a helper function 02:29 Lajla: You want to compare the key of the leave to the key of what you insert 02:29 Lajla: If it's less 02:29 Lajla: you just recurse to the left branch 02:29 Lajla: if it's more, then you do to the right branch 02:30 Senjai: I understand. Racket is proving difficult for me, I have some experience in C++ (self taught) which makes the concept of racket.. hard to understand 02:30 Senjai: Now I'm in a comp sci class making us learn Racket, and I'm falling apart.. lol 02:30 Lajla: Senjai, ahhh 02:30 Lajla: I guess what is different here is that you don't want to update values per se. 02:31 Lajla: But this is a task that lends itself well for recursion. 02:31 Senjai: Okay let me write out a template 02:31 Lajla: Basically, you have a function which works like this (tree-with-value tree key value) 02:32 Lajla: What it does is it takes a tree as argument, a key and its value 02:32 Lajla: and produces the new tree with the value inserted 02:32 Lajla: the old tree is persisistent, it does not getmodified. 02:32 Lajla: And that can call itself recursively 02:34 Senjai: So my initial check-expect is (check-expect (create-bst (list 1 2) (list 2 2) (list 3 3)) (make-node 2 2 (make-node 1 2 false false) (make-node 3 3 false false))) 02:37 Senjai: I'm stuck, what should I do from here? http://pastebin.com/GhegQWXL 02:38 Senjai: My theory is still a bit rough I think, If someone wants to search the tree, they would have to start from the top of the tree right? Otherwise they can miss values, but can't there be more than one top of the tree? 02:38 Senjai: Lajla: recursion sucks :/ 02:40 Lajla: Senjai, http://pastebin.com/dLqv7TW0 02:40 Lajla: You want something along the lines of that 02:41 Senjai: That's amazing, I'm unfamiliar with (let) though, and I think that's.. pointers in racket? I am in a Comp Sci class though, (don't worry this isn't a homework question, htdp just doesnt post solutions) I don't think I'm supposed to know that way yet. 02:43 Senjai: Lajla: look at this: http://pastebin.com/v5FXseyk Lecture notes for binary search trees, that's how he wants them done.. 02:43 Senjai: Lajla: or at least the way he taught us 02:44 Lajla: That is not what I call a very clean, simple and elegant way. 02:44 Lajla: And * is part of the variable name 02:44 Lajla: identifiers are very permissive in scheme 02:45 (join) evhan_ 02:45 Lajla: */7236 is okay as a variable name 02:45 Lajla: In fact * and - and / and + are all technically variable names 02:45 Lajla: I basiclaly used key as the key of the node inserted node and key* as the key of the one I'm comparing 02:45 Senjai: Lajla: scary.. See, this issue in C++ would be easy, I'd just create a class for it, and use member functions to deal with it. 02:46 Senjai: What does let do? 02:46 Lajla: And (let ((name value) (name2 value2)) ...) is like {name = value, name2 = value2; ...} in C. 02:46 (join) mheld__ 02:46 Lajla: Senjai, you can use classes in racket too. 02:46 Senjai: isn't that similar to define? 02:46 Senjai: Lajla: we're not allowed to do anything other than (define-struct) lol 02:47 Lajla: No, define defines a variable and binds some definition to it. =P 02:47 Lajla: That is weird, I assume you want to also define functions 02:47 Lajla: Basically, 'functions' and 'values' are the same. 02:47 Lajla: (define foo 3) 02:47 Lajla: foo now houses a number 02:47 Senjai: Yes 02:47 Lajla: (set! foo +) 02:47 Lajla: foo now houses the addition function 02:47 Senjai: Can't use set :P 02:48 Senjai: See if I could LIFE WOULD BE SO EASY 02:48 (quit) evhan: Ping timeout: 255 seconds 02:48 Lajla: Well, I did it without. =P 02:48 Lajla: And also, set! does not change any values 02:48 Senjai: I've talked to my prof.. but he wants us to learn without assigning values 02:48 Lajla: it changes a binding 02:48 Lajla: Good guy, good guy. =P 02:48 Lajla: But look at my code 02:48 (quit) mheld: Ping timeout: 264 seconds 02:48 (nick) mheld__ -> mheld 02:48 Lajla: (let ....) is just a way to create new bindings 02:49 Lajla: The code is not operational by the way, it's more a schematic of the basic algorithm. 02:49 Senjai: yea 02:49 Senjai: I know 02:50 Senjai: That will insert, (i have to review insertion too) but what about reading from a list of lists? 02:50 Senjai: (list (list 1 2) (list 2 4)) etc 02:51 Lajla: Ahhh 02:51 Lajla: Well 02:51 Senjai: Im trying to find the question from htdp, I'll pastebin it, I just want to do it so Im sure I get BST's 02:52 (quit) evhan_: Quit: leaving 02:53 Lajla: Senjai, http://pastebin.com/M4ztDnzb 02:53 Lajla: Bottom part explains the general algorithm 02:53 Lajla: Or wait 02:53 Lajla: I can do better than that 02:55 Senjai: Lajla: Look at this http://htdp.org/2003-09-26/Book/curriculum-Z-H-1.html#node_toc_node_sec_14.2 02:55 rudybot: http://tinyurl.com/6z8vxvm 02:55 Senjai: Exercise 14.2.5. Develop the function create-bst. It consumes a BST B, a number N, and a symbol S. It produces a BST that is just like B and that in place of one false subtree contains the node structure 02:56 Lajla: Senjai, 02:56 Lajla: http://pastebin.com/ntVyNmvY 02:56 Lajla: What does N stand for? 02:56 Senjai: N being the key 02:56 Senjai: S is the value 02:57 Senjai: then the left and right branchest 02:57 Senjai: branches* 02:57 Lajla: Ahh 02:57 Lajla: I just called that key and value 02:58 Lajla: But that is what my tree-with-value thing does right? 02:58 Lajla: It takes a tree, a key and a value 02:58 Senjai: I.. don't know? 02:58 Lajla: and produces the new tree 02:58 Senjai: But this doesnt 02:58 Senjai: err. 02:58 Senjai: it can 02:58 Senjai: but calling (create-bst false 40 "value for key #40) produces a leaf 02:59 Senjai: because a BST can be false, or (make-node key value left right) 02:59 (quit) mheld: Quit: mheld 02:59 Lajla: Senjai, yeah 02:59 Lajla: That's what mine does 02:59 Senjai: I don't udnerstand yours though lol 02:59 Senjai: If you look atth e exercise 02:59 Lajla: Except that I abstract how to represent null-trees. 02:59 Senjai: I have to create create-bst to create a single node. 02:59 Lajla: (define (tree-with-value tree key value) 02:59 Lajla: (if (null-tree? tree) 02:59 Lajla: (make-leave key value)) ; should make a leave node with no branhes 02:59 Lajla: Look at that part of the code 03:00 Senjai: THEN I have to create a function that recursively calls create-bst to create the total tree 03:00 Lajla: Which is what mine does 03:00 Lajla: Look, it calls itself 03:00 Senjai: that makes sense 03:00 Senjai: but i Dont understand this example 03:00 Senjai: create-bst (create-bst false 66 'a) 53 'b) = (make-node 66 'a (make-node 53 'b false false) false) 03:00 Senjai: oops 03:00 Senjai: thats ugly 03:00 Senjai: one sec 03:01 Senjai: http://pastebin.com/5AGkxWmQ 03:01 Senjai: the book says calling it like that, should = the following 03:01 Senjai: So when I design this function, I would assume that it would be Like (pastebinning) 03:03 Lajla: I'm not sure I get what you mean here. 03:06 Senjai: Lajla: so to my understanding the function looks like: http://pastebin.com/nU2e121n 03:06 Senjai: in order to create a single node 03:06 Senjai: according to the book @ http://tinyurl.com/6z8vxvm (look at the exercise) 03:07 Senjai: But even my code doesn't work, I mean how can you assume everything coming off of the branch is a leaf? or.. ught 03:07 Senjai: It gives me the correct answer though.. 03:13 Lajla: Senjai: http://pastebin.com/4NLne2kY 03:15 Senjai: Lajla: reading 03:15 Lajla: Senjai, it's more the C++ esque code there that should perhaps explain the algorithm better 03:16 Senjai: Lajla: SO much better, I understand the pseudocode perfectly, but it appears I'm missing my logic on recursion is all 03:16 Senjai: I guess I can't wrap my hea don recusive functions 03:16 Senjai: I was one of those programs who always used loops, never recursions, and recursions are INTEGRAL in racket. 03:17 Lajla: Senjai, it takes time I suppose to get a feel for the recursive approach 03:17 Senjai: programmers* sorry its late 03:17 Lajla: Senjai, but the C++ code is in essense the same as the racket code 03:17 Senjai: Lajla: Yea, I just didnt get all the functions you used is all lol, and its the recursion that is getting me, give me a moment, I need to stare at this for like a minute 03:18 Lajla: Senjai, well, a lot of the functions I used in either don't really exist yet, it's up to you to make them. =P 03:18 Lajla: It's just the general algorithm 03:18 Lajla: But yeah, let it sink. 03:18 Senjai: Can i write this out in the way I know how and see if it's correct 03:18 Senjai: Hence pseudocode :P 03:19 Senjai: Let me write this up 03:19 Senjai: btw, thank you SO much for taking the time to write pseudocode for me. 03:19 Senjai: Can i check it with you after I write it/ 03:22 Lajla: Sure 03:22 Lajla: and it's the morning 03:22 Lajla: I just woke up, doing stuff like this helps me clear my mind for the day. 03:22 Lajla: So it's not a problem. 03:28 (quit) sethalves: Ping timeout: 276 seconds 03:28 Senjai: Lajla: http://pastebin.com/LvBjqWWK 03:28 Senjai: Lajla: Thank you so much :) 03:31 Lajla: Senjai, yeah, that looks like what you need. 03:32 Lajla: I praefer to ue the let-block to keep stuff more organized though, but it doesn't really matter 03:32 Senjai: Lajla: I prefer that as well, though my prof would probably not allow it. 03:32 Lajla: He doesn't like the let block? 03:32 Senjai: Lajla: still trying to get my head around the recursion, No, he just hasnt taught us it yet, so he doesnt want us to use it 03:32 Lajla: Ahhh 03:33 Lajla: I was never a fan of that technique 03:33 Senjai: He is trying to get us to program with *minimal bindings/definitions* 03:33 Senjai: So we only use (define) and (define-struct) that is IT 03:33 Senjai: lol 03:34 Senjai: I encountered a problem 03:34 Lajla: What? 03:36 Senjai: Lajla: http://pastebin.com/0baNkw20 03:36 Senjai: I did some tests at the bottom and included the results 03:38 Lajla: Senjai, you inverted the left and the right 03:38 Lajla: You want to inserted it to the left when the < case applies, not the right 03:39 Senjai: O..M..G 03:39 Senjai: Im a loser 03:40 Senjai: That fixed that ine 03:40 Senjai: That fixed that one*, Ill try a more complicated one. 03:41 Senjai: I just kinda clued in a bit to my recursion issues 03:41 Lajla: Well, I didn't notice it when I looked the first time. =P 03:41 Senjai: Because the input is a BST, then you can assume that the BST is already properly sorted 03:41 Lajla: But it's one of the first thngs you look at when it's inserted at the wrong end I suppose. 03:41 Senjai: Beecause it has to be if it is a BST :P 03:41 Lajla: Senjai, yeah 03:41 Lajla: The algorithm does work on that assumption 03:42 Senjai: Ima try a more complicated oe :) 03:43 Senjai: err.. actually 03:44 Senjai: typing it out would be too complicated haha, Ill try making a function now to consume a list of name value pairs and produce a tree from that... This is the hard part 03:44 Senjai: Because I don't know if the list is sorted by key or not.. 03:47 (quit) neilv: Ping timeout: 252 seconds 03:48 (join) neilv 03:48 (quit) neilv: Changing host 03:48 (join) neilv 03:48 Senjai: How should I start 03:52 Lajla: Senjai, oh, it doesn't have to be sorted actually 03:52 (quit) misterm: Read error: Operation timed out 03:52 Lajla: What you basically want is 03:53 Lajla: for the empty list return a null-tree 03:53 Senjai: Lajla: Then how can I do it? Im thinking of recursing ovver groups of three, and passing them onto the recursed. 03:53 Senjai: got that done 03:53 Senjai: (empty? lokvp) false 03:53 Senjai: OH 03:54 Lajla: Well, the recursion step would be (create-bst (lokvp->bst (rest lokvp)) (first-key lokvp) (first-value lokvp)) 03:54 Lajla: Not sure if I'mdoing too much for you here. 03:55 Senjai: hmm 03:55 Senjai: It's so easy for you to do this lol 03:55 Lajla: Well, I am brilliant after all. 03:55 Lajla: NAhh, you'll get the hang of thinking recursively in a while. 03:56 Senjai: Ugh its that assumption that (lokvp->bst) returns a bst lol 03:56 Senjai: urgh 03:57 Senjai: But.. how do you position the nodes? 03:57 Senjai: E.g. make sure they go where they are supposed to 03:57 Lajla: It does so automatically. =P 03:57 Lajla: create-bst ensures it 03:57 Lajla: Basically, the logic is 03:58 Lajla: create-bst will return a correctly formed tree if its first argument is a correctly formed tree, right? 03:58 Lajla: A null tree is correctly formed. 03:58 Lajla: And lovkp->bst returns a correctly formed tree because it always returns a call to create-bst 03:59 Lajla: And therefore create-bst always consumes a correctly formed tree 03:59 Lajla: so the tree returned willalways be correctly formed 04:00 Senjai: yea makes sense 04:01 Senjai: so is it like this: http://pastebin.com/djSxTnXL 04:01 Senjai: is it really that simple? 04:07 Senjai: Lajla: If you look at the code, I copied my profs render tree function and rendered it out: http://imagebin.org/141411 << the image result 04:09 (join) mheld 04:09 Senjai: Lajla: What I don't understand about recursion is that (create-bst (lokvp->bst (rest lokvp)) ... ....) 04:10 Senjai: I know we're supposed to think: Okay, lokvp->bst always produces a bst, and create-bst inserts it properly, etc. 04:10 Senjai: but it actually doesn't 04:11 Senjai: I mean, create-bst should recieve the first node, but it just receives a list of nodes.. 04:16 Senjai: Lajla: still there? 04:21 Lajla: Senjai, let me look 04:21 Lajla: was drinking coffee 04:21 Lajla: the one drug legalized since the dawn of man 04:22 Lajla: Senjai, it doesn't in what case? 04:23 Lajla: create-bst always receives a tree as first argument 04:23 Senjai: Lajla: lol funny, I'm drinking indulging in coffee as well, but it is night here, morning for you lol 04:23 Lajla: GMT+1 baby 04:23 Senjai: I know but where does lokvp actually supply an individual tree? 04:23 Senjai: GMT-8 :) 04:23 Lajla: Senjai, supply? 04:23 Lajla: What do you mean? 04:23 Lajla: lokvp->bst 04:24 Lajla: evaluates to either the null-tree (false) 04:24 Senjai: create-bst requires a tree right? 04:24 Lajla: Or to a call to create-bst, rigt? 04:24 Senjai: yes 04:24 Lajla: Okay, so in the first case, it's a well-formed tree 04:24 Lajla: trivially 04:24 Lajla: In the second case, it also is, because create-bst returns a well-formed tree provided it gets one 04:25 Senjai: create-bst requires a tree to function, lokvp->bst provides that, but I don't see where it provides just an individual tree 04:25 Lajla: And it gets a well-formed tree because (lokvp->bst ...) returns one. 04:25 Lajla: It always evaluates to an individual tree 04:25 Lajla: either a null-tree, or a call to create-bst 04:25 Senjai: At least Im starting to locate my problems with recursion 04:25 Lajla: both of which return individual trees 04:26 Senjai: but the call to create-bst doesnt get a single bst, it gets (lokvp->bst (rest lokvp)) which will supply create-bst with a stream of trees right? But were does that functionalyity take place? 04:26 Lajla: No, that will return a single tree 04:27 Lajla: Not a list of trees 04:27 Lajla: Just look at how lokvp->bst is defined 04:27 Senjai: I understand 04:27 Lajla: it either returns a null-tree (a single tree) or whatever the call to create-bst returns, which is also a single tree 04:27 Senjai: But how? Where? 04:28 Lajla: http://pastebin.com/djSxTnXL there, at the top 04:28 Lajla: you defined it 04:28 Senjai: but there is something happening under the covers that when the call to create-bst takes place 04:28 Senjai: lokvp magically supplies it individual trees right? because all lokvp->bst can do is produce random nodes 04:29 Senjai: create-bst has to sort them 04:29 Lajla: Yes, create-bst is the part that ensures that the trees are sorted 04:29 Senjai: What I'm asking is how the compiler, at runtime, does this recursion 04:29 Senjai: The stepper is too.. burdening to look through 04:30 Lajla: Ehh, it generates functions that call itself. =P 04:30 Senjai: renames them right? 04:30 Lajla: Senjai, no, not that I know 04:30 Lajla: function names no longer exist at run time. 04:30 Senjai: like with (local) it renames and lifts 04:30 Lajla: They are just identifiers used by the compiler to establish bindings at compile time 04:31 Senjai: hmm yea, renaming them would be inefficient actually, for large iterations it would suck up unneccesary ram' 04:31 Senjai is installing Adobe CS5 Master Collection ;) 04:32 Senjai: but do you see what my issue is? (create-bst (lokvp->bst (rest lokvp)) passes trees, one by one, to create-bst.. I understand that. But how, If I were to handwrite the execution, it would always be calling (rest lokvp) until it hits empty. 04:33 Lajla: Yeah 04:33 Senjai: I don't see where (create-bst) actually gets the individual trees is all 04:33 Lajla: Well, that is what lokvp->bst does 04:33 Lajla: It consumes a list of lists 04:33 Lajla: And produces a tree 04:33 Lajla: Basically, see it like this 04:34 Senjai: but if you look at the code, there is no (create-bst (makebst (first lokvp))), that makes sense to me 04:34 Lajla: We have a list of lists A := ((40 john) (30 claire) (50 Bill)) 04:34 Senjai: because it is passed ONE value, before the recursion happens 04:34 Lajla: So, lokvp->bst on that creates a tree based on that right? 04:34 Lajla: Well, how does it do that 04:35 Lajla: It first simplifies to (create-bst (lokvp->bst '((30 claire) (50 bill))) 40 'john) 04:35 Lajla: Do you follow that step? 04:38 Lajla: Senjai? 04:39 Senjai: hold on 04:39 Senjai: Lajla: Yes im following 04:40 Senjai: Lajla: I just created pseudocode for how I would do it: http://pastebin.com/4iAWdkdz in C++ 04:40 Senjai: Lajla: I'm stuck in that way of thinking 04:40 Lajla: No need to sort it like that, it will go okay on itself. 04:40 Lajla: Okay, but 04:40 Lajla: That wil simplify to this: 04:41 Lajla: (create-bst (create-bst (lokvp->bst '((50 bill))) 30 'claire) 40 'john) 04:41 Lajla: And that will then simplify to this: 04:42 Senjai: Ok yes I see 04:42 Lajla: (create-bst (create-bst (create-bst (lokvp->bst '()) 50 'vill) 30 'claire) 40 'john) 04:42 Lajla: And finally, the base case: 04:42 Lajla: (create-bst (create-bst (create-bst false 50 'bill) 30 'claire) 40 'john) 04:42 Senjai: Oh 04:42 Senjai: Wow that makes a lot of sense actually 04:42 Lajla: As you can see, it expands in the end to multiple calls to create-bst, starting with a null-list and then just inserting all the elements. 04:43 Lajla: Each one feeding its result to the new call. 04:43 Lajla: Beautiful, isn't it? 04:43 Senjai: I forgot the key and value arguements allow create-bst to seperate the nodes 04:44 Senjai: Then after lokvp->bst recurses, create-bst works BOTTOM up.. to make sure everything is in the right place? 04:44 Senjai: I was thinking top down.. :/ 04:45 Senjai: I need toast (too much coffee on an empty stomach 04:45 Lajla: coffee is good to help you adjust to recursion 04:45 Senjai: at 1:45 AM 04:45 Senjai: lol 04:45 Senjai: brb 04:46 Lajla: A fixed sleeping rhythm is for people who atually do some-thing productive with their life lol. 04:47 neilv: sleep rhythms are important, short-term and long-term. if you kick caffeine, in two weeks you'll be more consistently productive 04:48 Lajla is sitting comfortably on a few hours of sleep each 3-4 days for some time now. 04:48 Lajla: I can reccomend it, you get so much more stuff done by actually not spending half of your time onconscious 04:49 Lajla: Now all I have to do is is find stuff to get done. 04:49 Senjai: Lol, I havent slepped for a day or so 04:49 Senjai: You gain weight though, with caffeine, and not sleeping 04:49 Senjai: A lot of weight 04:50 neilv: ok, i'm off to code some racket 04:50 (quit) neilv: Quit: Leaving 04:50 Lajla: feeling important are we. 04:51 Lajla: Senjai, I have been sitting comfortably on about 55 kg for some time now. 04:51 Lajla: I wouldn't recommend that though 04:54 Senjai: lol 04:54 Senjai: Thats ddecent 04:54 Senjai: Why code racket Lajla ? 04:54 Lajla: Senjai, I don't really. 04:54 Lajla: I code in Scheme 04:54 Lajla: I use racket and icarus as implementations 04:54 Senjai: Lajla: difference? 04:55 Lajla: but racket also supports a scheme-ish language commonly called 'racket' 04:55 Lajla: Senjai, scheme is much, much, much, much, much, much smaller. 04:55 Senjai: So why use scheme instead of racket 04:55 Lajla: racket can be called a 'dialect of scheme', though it's not a superset of any official scheme standard 04:55 Lajla: Well, scheme is supported by more than one implementation. 04:56 Senjai: As in? 04:56 Lajla: And most of the things racket offers you can make yourself anyway. 04:56 Senjai: Scripting? I know emacs uses lisp 04:56 Lajla: As in icarus, stalin, bigloo, chez, chicken, guile, to name a few. 04:56 Senjai: is lisp the same as scheme? 04:56 Lajla: No. 04:56 Senjai: But what do they do? 04:56 Lajla: scheme is a 'dialect of lisp' 04:56 Senjai: Oh wow.. 04:56 Senjai: This is getting confusing 04:56 Lajla: Senjai, well, racket started off as a scheme implementation but it begain adding extensions and at some points breaking compatibility with some standards 04:57 Lajla: Senjai, well, the different dialects of lisp are as divergent as Java and C really 04:57 Lajla: There are currently three popular dialects, common lisp, scheme, and clojure. 04:57 Senjai: sameish syntax but different libraries? 04:57 Lajla: Syntax is similar, semantics are fastly different. 04:57 Lajla: Most prominently, in common lisp, functions and values are not the same as they are in clojure and scheme 04:58 Senjai: Why use any of them though? I mean racket is amazing for a learner, to be able to test so quickly, but doesnt hold a time to C in power, speed, or efficiency 04:58 Senjai: dime* 04:58 Lajla: Senjai, well, racket is not an implementation geared for speed 04:58 Lajla: If you try out stalin ... 04:58 Lajla: It gets its name because it 'brutally' optimizes. =P 04:58 Lajla: Icarus is also pretty fast 04:59 Lajla: Scheme is also far more expressive than C and makes for easier to maintain code. 04:59 Lajla: And its a language that suits me I guess. 04:59 Senjai: But what do you use these dialects for? You know, every dialect has their niche community, java and opensource/web/portability, C#/.NET/Windows lovers etc 05:00 (join) lithpr 05:00 Lajla: Depends on praeference, though in the end Common Lisp and Clojure are more geared towards a business perspective than Scheme in the end. 05:00 Senjai: Business applications? 05:00 Lajla: Scheme has a tendency to not sacrifice elegance for speed. 05:00 Senjai is a Commerce major, good to know :)) 05:00 Lajla: Or less so than Clojure 05:00 Lajla: But Common Lisp is ooold, and it shows 05:00 Lajla: It's not really as robust as a more modern language like Clojure. 05:01 Lajla: Each has its strength and weaknesses I suppose. 05:01 Lajla: Most importantly though, Scheme is the only dialect to allow fully hygienic macros. 05:01 Senjai: Can these dialects still produce executable files? or is it more similar to scripts run by a service on the system? Can they use the Win32 API, or a graphics library like OpenGL 05:01 Lajla: Which basically means that you can write new syntax which is as expressive as primitive syntax. 05:01 Senjai: Macros are scary things 05:01 Lajla: racket comes with a compiler. 05:01 Lajla: Not scheme macros. 05:02 Lajla: They are fully hygienic, they really never break. 05:02 Lajla: A lot of syntax you've been using in racket are actually macros. 05:02 Senjai: Wow, Id have to look into it then, but about the other question 05:02 Lajla: Well, racket comes with a compiler, like most implementations 05:02 Senjai: Racket can, but not without linking a crapload of DLL files, etc, 05:02 Lajla: Scheme and Clojure are easier to compile I would say than common lisp because of the lexical scope. 05:03 Lajla: Well, you can create standalone stuff and include them of course. 05:03 Senjai: meaning it does not "compile" its like racket packages it with a framework that reads the script 05:03 Lajla: No, it doesn't read the script. 05:03 Lajla: variable names and stuff like that is all gone 05:03 Senjai: Well I mean, the preprocessed version 05:03 Lajla: Clojure compiles to java bytecode and .net common language I believe. 05:03 Senjai: but its not machine code, or morphed into assembly right? 05:04 Lajla: Yes, it is. 05:04 Senjai: Really? 05:04 Lajla: Yeah 05:04 Senjai: Wow, i was wrong 05:04 Lajla: there is no reason scheme could not. 05:04 Senjai: Hey, I'll be right back, I have to reboot chrome to finish CS5 Installation (using webbased irc) 05:04 Lajla: Lisp has been at the vanguard of compiliation technology since 1950's or something. 05:04 Senjai: Give me a sec? 05:04 Lajla: Sure. 05:05 (quit) Senjai: Quit: Page closed 05:07 (join) Senjai 05:07 Senjai: Back :) 05:08 Senjai: Lajla: still here? 05:08 Lajla: Senjai, sure 05:09 Lajla: Senjai: http://en.wikipedia.org/wiki/Ikarus_Scheme#Design 05:09 Lajla: I think this is generally accepted as one that delivers the fastest code. 05:09 Lajla: Stalin delivers faster but also takes 30 billion years to compile. 05:10 Senjai: haha ptimization? 05:11 Senjai: optimization? 05:11 Lajla: Sure 05:11 Lajla: Stalin is one of the most optimizing compilers on the planet. =P 05:11 Lajla: It was basically created with the idea 'let's see how far optimization is possible' 05:11 Lajla: It's a scheme -> C compiler but it generates completely unreadable and indeciphrable C code. 05:11 Lajla: But it's fast, apparently. 05:12 Lajla: A lot faster than what is usually possible by writing the C program by hand 05:12 Senjai: Well it doesnt have to be neat if a human isnt intended to read it right? 05:12 Lajla: Yeah 05:12 Lajla: And Scheme code (to me at least) is much more readable than C code. 05:12 Lajla: It just takes a year to compile 05:12 Senjai: I feel uneasy by having anything more than What I Code In -> asm -> machine 05:12 Senjai: Like if something involves more steps than that I don't like it 05:13 Senjai: So if Stalin -> C -> asm -> machine I much rather would use C instead 05:13 Senjai: I like control over my code 05:13 Senjai: For every layer you add, you trust another programmer to do his job properly 05:13 Lajla: Well 05:13 Senjai: More steps, more places to break 05:14 Lajla: internally, almost every compiler uses a lot of intermediate steps. 05:14 Senjai: Well yea 05:14 Lajla: Which is actually what guarantees correctness more. 05:14 Lajla: Because each step can be done by a specialist in that field. 05:14 Senjai: But in terms of translating code to code. It's never going to be better, because you lose control over memory management, etc. 05:14 Lajla: I once read about how the GHC worked, that was a plethora of intermediate languages, most designed specifically for the GHC. 05:14 Senjai: like higher level to higher level is pointless. I think 05:14 Lajla: No, not really. 05:15 Senjai: GHC? 05:15 Lajla: It actually optimizes beter 05:15 Lajla: Glasgow Haskell Compiler 05:15 Lajla: A pretty impressive beast 05:15 Senjai: Wow I suck.. lol 05:15 Lajla: Never heard of it? 05:15 Senjai: Haskell is another type of code 05:15 Senjai: Ive heard of Haskell 05:15 Senjai: but I dont know anyone who usees it 05:16 Lajla: I sometimes 'use' it. 05:16 Lajla: I'm not a big fan of it though 05:16 Lajla: Like, it's whitespace significant 05:16 Lajla: It uses indentation rather than good old { ... } to determine block structure 05:16 Lajla: I'm always uncomfortable with that 05:16 (join) jake 05:17 DT``: afaik the forced indentation in Haskell is optional, you can use {}. 05:17 Senjai: Eww! 05:17 Senjai: I would screw that up all the time!~ 05:17 Lajla: DT``, yeah, but then I get even more confused. 05:18 Lajla: What I often use in C is that I don't use { ... } if I only have one expression 05:18 Lajla: No matter the people who complain about the style. 05:18 Lajla: And it'smore the let ... in syntax's indentation rules that I'm not really comfortable with yet. 05:19 (quit) jake: Client Quit 05:19 Senjai: Im so stoked I have Adobe CS5 lol 05:20 (quit) lithpr: Remote host closed the connection 05:21 Lajla: Senjai, you mean photoshop? 05:22 (join) lithpr 05:23 Senjai: No 05:23 Senjai: I mean the whole collection 05:23 Lajla: Ahhh 05:23 Lajla: I have some of that 05:23 Lajla: pirated, ofc. 05:23 Senjai: Photoshop Dreamweaver, browserlap, after effects, premeire, flash 05:23 Lajla: And it's even legal where I live. 05:23 Senjai: the whole thing :) 05:23 Lajla: Eewl, dreamweaver. 05:23 Senjai: My Uni lets i=us have it for free 05:23 Senjai: dreamweaver is AMAZING 05:23 Senjai: The new flash, you can make flash apps without code. 05:24 Senjai: it's done really well for none-coders 05:24 Senjai: and you can export to iphone formats etc.. 05:24 Senjai: Back to racket! 05:24 Senjai: must learn.. study.. 05:25 cpach: Lajla: pirating is legal where you live...? 05:27 Senjai: cpach, probably in sweden? 05:28 cpach: i'm in sweden. pirating is not legal here. 05:29 Senjai: Shit your in sweden, lucky.. 05:30 Senjai: Technically, piracy is legal as it is defined. Modifying and distributing software is not. Sharing is. The problem comes when you cant distinguish the difference 05:30 Senjai: I agree with free software for personal use, and charge commercial users. 05:31 Senjai: If your not making money with a product, then dont charge for it. Though it would be hard to set that up 05:31 Senjai: Impossible even 05:31 rapacity_: it's hard to find legal software in my country, as most of the stores sell pirated software/films 05:31 Senjai: rapacity_: where are you from 05:32 cpach: i thought that bsa et al had cracked down on things like that, but apparently not 05:32 rapacity_: secret :p but it's ranked in the top 40 worldwide for piracy 05:32 Senjai: Lajla: still here? 05:32 (quit) mheld: Quit: mheld 05:33 Senjai: rapacity_: you cant even say the country name? Crap you have a hostmask and using ssl 05:33 Senjai: lol 05:33 cpach: Senjai: when the winter season is taken into account, i'm not sure i would consider myself lucky to be here ;-) 05:33 Senjai: cpach: take a look at the girls dude.. haha 05:33 Senjai is Canadian 05:35 cpach: Senjai: i knew that would come up! i never really understood that thing. maybe i should spend less time staring at a terminal window :) 05:35 Senjai: lol cpach 05:36 Lajla: cpach, yeah. 05:36 Senjai: are you a racket user? What distro you use? (assuming linux, you said terminal, could be mac) 05:36 Lajla: Basically, the logic is quite simple 05:36 Lajla: If I give you a bike or a cake or whatever 05:36 Lajla: Is it then your responsibility to check if Ilegallyobtained that 05:36 Lajla: or if I havethe intellectual property secured to give you that? 05:36 Lajla: No, it's not, it's mine. 05:36 Senjai: Lajla: Logic win :) 05:37 Lajla: In the Netherlands, the same principle applies to stuff 'given' to you online. 05:37 cpach: oh. 05:37 cpach: that's curious :) 05:37 Senjai has never seen this channel so active 05:37 Lajla: If you see a random link on the net, it's not your responsibility to go check if the site who offers that link has all legal stuff done properly. 05:37 Lajla: cpach, well,admit, it's actually quite sensible. 05:37 cpach: convenient at least :) 05:37 Lajla: cpach: http://akiscode.com/projects/SOS/86random-f1.1.gif 05:37 Lajla: If you click that link 05:38 Lajla: you download it 05:38 Lajla: Who knows 05:38 Lajla: it might be copyrighted? 05:39 Senjai: lol 05:41 cpach: i guess intent is often taken into account though. eg if you want to download something via the pirate bay, you most likely are actively searching for it. 05:41 cpach: Senjai: i'm trying to learn racket. i'm on ubuntu. 05:42 Senjai: cpach, haha I have ubuntu :) 05:42 Senjai: cpach on windows atm though 05:42 Senjai: cpach Im learning it too, you using htdp? I have to learn it for my course 05:42 cpach: i haven't used htdp that much so far. 05:43 Senjai: lol 05:43 DT``: cpach, sicp? 05:43 Senjai: Should have seen Lajla and I's intense BST discussion 05:44 cpach: Senjai: i saw that :) was those examples based on htdp? 05:44 Lajla: cpach, Dutch law doesn't feature 'intent' in that way very often, I guess because you can't prove that. 05:44 cpach: Lajla: cool :) 05:44 Lajla: We also have very little 'victim-less crimes' 05:44 Senjai: cpach yes 05:44 Senjai: the book 05:44 Lajla: The only thing is that recently sex with animals has again been criminalized, I can't say I agree. 05:45 cpach: DT``: yeah, i've worked through a small part of sicp. i really like that book. 05:45 Senjai: scip? 05:45 Senjai: sicp* 05:47 cpach: Senjai: http://mitpress.mit.edu/sicp/full-text/book/book.html 05:48 Senjai: Nice! 05:48 (join) lucian 05:49 cpach: definitively worth having a look at, imho. 05:50 cpach: i also really enjoyed working through _the little schemer_. it was a great way to get familiar with recursion. 05:50 (quit) lithpr: Remote host closed the connection 05:51 Senjai: I hatae recursion 05:51 Senjai: hate* 05:52 DT``: even tail-recursion? 05:53 bremner_: Senjai: scheme/racket may not be the language for you if you hate recursion. 05:53 Lajla: recursion is awesome. 05:53 Senjai: bremner_: I need to get better at it anyway, I'm just so accustomed to looping. I have to learn racket, its taught in our comp sci ocurse 05:54 Lajla: (define (recursion) (recursion)) 05:54 Senjai: Lajla: once you figure it out 05:54 Lajla: Senjai, have they explained tail-recursion to you? 05:54 Senjai: Lajla: lol! 05:54 Senjai: Lajla: I dont remember 05:54 DT``: Lajla, ((λ (λ) (λ λ)) (λ (λ) (λ λ))) 05:54 Lajla: Senjai, well, you end up using recursion n mathematical definitions either. 05:54 Lajla: Senjai, that's another cool part of scheme 05:54 Lajla: You have no reserved words 05:55 Lajla: He just used an identifier that is commonly a keyword as a bound variable in a function 05:55 (join) lithpr 05:55 bremner_: just because you can do something... 05:55 DT``: that helps so much when writing obfuscated code. 05:56 bremner_: Is there an obfuscated scheme contest, like the old obfuscated C contest? 05:56 Senjai: Lajla: do you have an exampl? 05:56 DT``: I don't know, but it's possible. 05:57 DT``: Senjai, of tail-recursion? 05:58 Senjai: DT``: yea 05:58 Lajla: Senjai, well (define (recursion) (recursion)) 05:58 Senjai: Okay but what is the point? 05:58 Senjai: How is that different from regular recursion? 05:59 lithpr: the neat thing about tail-recursion in scheme is that it runs in constant memory space 06:00 lithpr: so you don't use memory stack after memory stack 06:00 DT``: Senjai, the difference is: 06:00 lithpr: it's the "pure scheme" form of iteration 06:00 Lajla: Senjai, a simple example: (define (list-ref l k) (if (zero? k) (car l) (list-ref (cdr l) (- k 1))) 06:00 Lajla: This guy runs in constant space. 06:00 DT``: it's the last function called, you don't ``delay'' any computation after the recursion. 06:00 DT``: it's just a loop, written in ``functional'' style. 06:01 DT``: bremner_, http://paste.lisp.org/display/120250 06:01 Senjai: what does (car) and (cdr) do? 06:02 lithpr: Senjai: you should check out the "racket guide". It explains this stuff very well (imo) 06:02 DT``: they are list accessors. 06:02 DT``: maybe you know them as ``first'' and ``rest''. 06:02 Senjai: DT``: yes I do 06:02 DT``: or head and tail. 06:02 Senjai: car is first? cdr is rest? 06:02 DT``: yeah. 06:03 Lajla: Senjai, yeah 06:03 Lajla: but car and cdr is so much cooler 06:03 Senjai: What do they stand for? 06:03 DT``: my car and my other car. 06:03 Lajla: contents of acessor part of register / contents of decrement part of register 06:03 Lajla: If I'm correct. 06:03 DT``: you're correct. 06:04 Lajla: Basically, the first lisp implementation was implemented on a machine that had these assembly instructions and it used it to implement lists 06:04 DT``: *address part 06:04 Senjai: My computer is lagging audio 06:04 DT``: Senjai, http://en.wikipedia.org/wiki/Car_and_cdr 06:04 Senjai: Lajla: you know everything lol 06:04 Lajla: and it was like 'Eurr, I need a name for them, let's just call them after the assembly' 06:04 Lajla: name them after* 06:04 Lajla: Senjai, never say that when chandler is around again. 06:05 Senjai: huhwhat? 06:06 Lajla: Senjai, well, let's just say that anyone with basic knowledge appears to know a lot when you're just starting to learn it yourself. 06:06 (quit) lucian: Read error: Operation timed out 06:07 Senjai: Yea 06:07 Senjai: At least i have a basic understanding from other languages 06:08 Lajla: So do I, I guess. 06:08 Lajla: Senjai, but basically 06:08 Lajla: to explain it 06:08 Lajla: say you have your call stac 06:08 Lajla: and you have a function foo 06:08 (join) lucian 06:08 Lajla: and it ends on return bar (x,y); 06:09 Lajla: As a random example. 06:09 Lajla: Why would you add another stack frame? 06:09 Lajla: Obviously foo will just return what bar returns. 06:09 Senjai: Yea 06:09 Lajla: So, nothing goes wrong if the stack frame of bar just raplces that of foo. 06:09 Senjai: Makes sense 06:09 Lajla: This is basically in a nutshell what happens with tail-call-optimization 06:10 Senjai: DrRacket has a memory leak.. :/ 06:10 Lajla: And an added benefit is that when it ends on return foo(x,y); 06:10 Lajla: Is that it compiles into a loop, baiscally. 06:10 Senjai: Because there are no conditional statements that loop can execute without delays right? 06:10 lithpr: (define (got-milk? lst) 06:10 lithpr: (cond 06:10 lithpr: ((null? lst) #f) 06:10 lithpr: ((eq? 'milk (car lst)) #t) 06:11 lithpr: (else (got-milk? (cdr lst))))) 06:11 lithpr: 06:11 Lajla: Senjai, well, if you have (define (recursion) (recursion)), which in C++ like code would be int recursion() {return recursion();} 06:11 lithpr: just something concrete to refer to :) 06:11 Lajla: In C++ you will get a stack overflow, depending on your compiler 06:11 Lajla: In Scheme, the thing will just enter an infinite loop 06:12 DT``: That's just how you write loops in Scheme. 06:12 Lajla: You usually end up doing that 06:12 Lajla: but there are some loop macros 06:12 Lajla: but they are just implemented on top of tail-recursion basically 06:13 Senjai: Lajla, recursion is also a better way to program, so ive heard 06:14 lithpr: iteration is often preferable to recursion because is uses less ram- that's why there is tail recursion 06:15 lithpr: so you can "think recursively" but use iteration when possible 06:16 Lajla: Senjai: http://codepad.org/N61gNczc 06:16 DT``: Senjai, if you want to read something on this, you can read the first chapter of SICP. 06:16 Lajla: THat's also a funny trick 06:16 Lajla: mutual tail recursion 06:16 Lajla: Senjai, some would say that it keeps stuff clearer 06:16 Lajla: or at least, not mutating stuff 06:16 Lajla: Maintaining 'referential transparency' 06:17 Senjai: Yea ill read the sicp chapter 06:17 Senjai: its interesting for sure 06:19 Senjai: Mutual Recursion.. eww 06:19 Lajla: Senjai, a mistake a lot of people make though is that they just end up using tail recursion to simulate loops when they shouldn't 06:19 Lajla: Senjai, why? 06:19 Lajla: Your tree function used mutual recursion 06:20 Senjai: Lajla, Mutual recursion occurs when one recursive function calls another right? 06:20 Senjai: Lajla, Mutual recursion occurs when one recursive function calls another (that also has a recursion) 06:21 Lajla: Senjai, not exactly 06:21 Senjai: create-bst did not call lokvp->bst like your codepad example 06:21 Senjai: btw, codepad seems awesome for pastes 06:21 Lajla: mutal recursion occurs when a foo calls a function bar that calls foo. 06:21 Lajla: Or actually, there can be indefinite steps between it. 06:21 Lajla: A parser I've written for some other dialect of lisp is mutually recursive. 06:22 Senjai: You wrote a parser? 06:22 Senjai: No big deal.. crazy person 06:22 Senjai: lol 06:22 DT``: Parsing Lisp is easy. 06:22 DT``: (not counting reader macros) 06:23 Senjai: For you guys it is 06:24 Lajla: Senjai, naahh, lisp is written to parse easily. 06:24 Lajla: the grammar is pretty simple as you should have noticed by now. 06:24 Lajla: No special rules for keywords and all that. 06:25 Lajla: It was so simple, no need for al that yacc or LARL or whatever stuff 06:25 Lajla: It was basically recursing through 06:25 Senjai: lol 06:25 DT``: it's like writing a brainfuck or forth parser. 06:25 Senjai: HAHA 06:30 Lajla: Well, the parsers are fairly simple. 06:31 (join) MayDaniel 06:39 (join) lucian_ 06:40 Senjai: Lajla 06:40 Senjai: Or anyone: http://codepad.org/0cPB2hRh can someone help me with the error/ 06:41 (quit) lucian: Ping timeout: 264 seconds 06:41 Senjai: line 36: car: expects argument of type ; given empty 06:41 bremner_: Senjai: I guess you are missing a #lang line at the top 06:42 Lajla: bremner_, no, he means an error racket gave him 06:42 Senjai: bremner_: it's not that, I have it set to intermediate student 06:42 Lajla: Senjai, well, car doesn't work on emtpy lists 06:42 Lajla: car works on nonempty lists 06:42 Lajla: It's an alias of first 06:42 Lajla: you cannot get the first of an empy list 06:42 Lajla: (car (rest lob) 06:42 Lajla: That part is where it goes wrong 06:42 Senjai: Lajla: I know :) its not that, its that ball-r is attempting to get the radius of empty, thats the error 06:42 Lajla: If lob is a list of length one 06:42 Senjai: Lajla: I just dont know how to fix it 06:43 Senjai: Lajla: your right im wrong 06:43 Lajla: Senjai, well, what you want is this case is to add an extra case 06:43 Senjai: Lajla: oops, but still, How do I fix this 06:43 Lajla: if lob is of length 1 06:43 Senjai: I tried 06:43 Senjai: oh 06:43 Lajla: Basically, you have 2 base cases 06:43 Senjai: okay 06:43 Lajla: of length 0 06:43 Lajla: in this case return the empty list 06:43 Lajla: and of length 1 06:43 Lajla: Well, how do we sort a list of length 1? 06:44 Lajla: You want an extra case in your cond 06:44 Senjai: just return the one item 06:44 Senjai: Lajla: I tried, but wont it fail to cons onto the recursed list? 06:45 DT``: if (< (length lob) 2) lob 06:45 Senjai: (and (ball? (car lob)) (empty? (cdr lob))) (car lob) 06:46 DT``: Senjai, you can just change the (empty?) case in (< (length lob) 2), and return lob. 06:46 Lajla: DT``, that could be done, but it's not very efficient 06:46 DT``: Lajla, then, (or (null? lob) (null? (cdr lob)) 06:47 DT``: *empty? 06:47 Lajla: Senjai, I think (cond [(empty? lob) empty] [(empty? (rest lob)) lob) [else ...]) 06:47 Lajla: works okay 06:47 Lajla: DT``, yeah 06:47 Senjai: DT``: Lajla Now I have anothe rerror on (cons (car lob) (sortlob (cdr lob))) 06:47 Lajla: Because it will actually go recurse through the entire list obtaining the length 06:47 Senjai: cons: second argument must be of type , given (make-ball 40 "blue") and (make-ball 50 "yellow") 06:47 Lajla: Senjai, which? 06:48 Senjai: Lajla: line 37 06:48 Senjai: throws that argument 06:48 Lajla: (cons (sortlob (cdr lob)) (car lob)))])) 06:48 Lajla: that one 06:48 Lajla: is the error I think 06:48 Lajla: You got your arguments to cons reversed there 06:48 Senjai: yes 06:48 Senjai: I have to 06:48 Lajla: Or wait 06:48 Lajla: You want to add it to the end of the list? 06:48 Senjai: yes 06:49 Lajla: (define (extend-list l . xs) (append l xs)) 06:49 Senjai: (cons (car lob) (sortlob (cdr lob))) gives the error 06:49 Lajla: Not sure if your language allows that 06:49 Lajla: Yeah, it doesn't add an element to the end in that way. 06:49 Lajla: My extend-list procedure takes a list and some arguments and adds the argument to the end of the list. 06:49 Lajla: But I'm not sure if the language you have to use allows for that one. 06:49 Senjai: hmm 06:50 Senjai: (append) maybe? 06:50 DT``: with just (append), you'd need to wrap the second argument in (list). 06:50 Senjai: Lajla: I think its fine that way, it is saying that sortlob is giving two balls bnot a list 06:51 Lajla: Senjai, what append does is join lists together 06:51 Lajla: So if you want to extend a list, you can use (append a-list (list 1)) 06:51 (join) lucian 06:51 Lajla: Adds 1 at the end of a-list 06:52 (quit) lucian_: Ping timeout: 252 seconds 06:52 Senjai: (cons (car lob) (list (sortlob (cdr lob)))) adding list fixed it 06:53 Senjai: maybe racket could not determine the type (sortlob) was returning? 06:53 Senjai: But if you wrap list for that you get a nasty error later on ball-r: expects argument of type ; given (list (make-ball 30 "green") (list (make-ball 40 "blue") (make-ball 50 "yellow"))) 06:54 (join) tfb 06:55 Senjai: The answer key says to use an insert helper function 06:55 (join) lucian_ 06:55 Senjai: Doing this requires operating on arbitrary sized data (the result of the natural recursion), so we have to use a helper function to do it. 06:56 Senjai: Doing this requires operating on arbitrary sized data (the result of the natural recursion), so we have to use a helper function to do it. 06:56 Senjai: Ooops: so now we have the first ball (first lob) and the result of the natural recursion. we know the result of the natural recursion is already sorted, so all we have to do is put (first lob) in the right place 06:56 (quit) lucian: Ping timeout: 246 seconds 06:57 (join) lucian 06:58 Lajla: Senjai, the last one does something different 06:58 Lajla: (list (sortlob (cdr lob)) returns a list inside a list. 06:59 Lajla: And it also adds the (car lob) element to the front. 06:59 Senjai: Yea 06:59 Senjai: Lajla: http://codepad.org/ML2D4oNM 07:00 (quit) lucian_: Ping timeout: 252 seconds 07:01 Lajla: Senjai, does it give an error? 07:03 Senjai: Lajla: that code doesn't 07:03 Senjai: It's the answer key, the insertion sorting method 07:05 Senjai: "Terminology This particular program for sorting is known as insertion sort in the programming literature." 07:06 Senjai: http://codepad.org/mufRk54p 07:06 Senjai: It eliminates that empty problem, checkes empty twice 07:11 (join) lucian_ 07:12 (quit) lucian_: Remote host closed the connection 07:13 (quit) lucian: Ping timeout: 260 seconds 07:13 (quit) Senjai: Ping timeout: 245 seconds 07:16 (join) Senjai 07:16 Senjai: Wow 07:16 Senjai: Just blue screened of death 07:17 Senjai: Lajla: still here? 07:17 Senjai: Ugh.. I hate new drivers.. 07:17 Lajla: Senjai, yeah 07:17 Lajla: Are you allowed to use 'inner functions'? 07:17 Senjai: How do you mean? 07:18 Senjai: like lambda? 07:19 DT``: define inside a define. 07:20 DT``: (define (fun x) (define (fun2 x y) ...) (fun2 x 1)) 07:20 Lajla: Senjai, also, it seems you have your <= inverted again 07:21 Senjai: Lajla: We can use local. 07:21 Senjai: DT``: we use (local [(define ...)]) 07:21 Senjai: I havent read up on it yet but we can use it 07:24 Senjai: DT``: Lajla do either of you know about cross products of types comments? or about prefix functions? http://codepad.org/lcpiVx8J (the whole lecture notes, I missed that class) 07:24 Lajla: Senjai: http://codepad.org/rytnww4p 07:27 Senjai: Lajla: that is so cool, nice and neat 07:27 Lajla: Senjai, one of the things C does not support 07:27 Lajla: inner functions 07:27 Lajla: The function isn't visible outside of it. 07:27 Lajla: stops you from breaking code or conflicting names 07:28 Senjai: Lajla: not true 07:28 Senjai: you can use static and force the function to exist in every instance the function is called 07:28 Senjai: or use {} scoping 07:28 Lajla: that's a method in C++ 07:28 Senjai: static can also force variable data to be saved/updated within any instance of te function being called. 07:29 Lajla: And you still cannot define a function inside a function 07:29 Senjai: er.. yea 07:29 DT``: Lajla, you can in GNU C. 07:29 Lajla: DT``, I read so yeah 07:29 Senjai: Lajla: yes you can :) int myfunc() { int yourfunc() { } return myfunc();} 07:29 Lajla: I wonder how that works with passing function pointers 07:30 Lajla: Senjai, not in standard C though 07:30 Lajla: But GCC supports that nonstandard extension 07:30 Senjai: Oh god, callbacks are just as bad as recursions.. lol.. Lajla Im talking about C++, I'm not fluent in C 07:31 Senjai: Then there is good ol goto :) 07:43 Senjai: Hey guys, Im gonna head in, get a few hours sleep, Lajla gonna be around later? 07:43 Lajla: Senjai, don't know 07:44 Lajla: But I'm usually there 07:44 Senjai: How often are you usually on/ 07:44 Lajla: as I am sitting comfortably on a couple of hours of sleeps everty few days 07:44 Lajla: Often 07:44 Senjai: Cool, do you want to exchange emails by any chance? 07:44 lithpr: LORD HAVE MERCY I'M FINALLY THROUGH THE FOURTH CHAPTER OF THE RACKET GUIDE 07:45 Senjai: lithpr, are you doing the exercises? 07:45 lithpr: some 07:45 lithpr: i'm doing a lot of fidling wiht the code though, trying to understand 07:46 Senjai: Lajla: before I go, check this out, this is my profs version of what you did http://codepad.org/U9jWFLfa 07:46 Lajla: Senjai, I'd rather not give emails if you don't mind. 07:47 Lajla: Senjai, you mean losing 'local'? 07:47 Senjai: Lajla: no worries, thats fine 07:47 Senjai: You just defined the function in the function, my prof used local 07:47 Senjai: is there a difference? 07:47 cpach: are there exercises in the racket guide? 07:48 Lajla: I'm not sure how local works. =P 07:48 DT``: Senjai, local is a syntactic sugar for let and letrec. 07:48 Lajla: As I said, I don't use racket, as in, the language, that must. 07:48 DT``: inner define is a syntactic sugar for let and letrec. 07:48 Lajla: or letrec is for inner definitions 07:48 Lajla: No one knows 07:49 Lajla: But (letrec ((name value) ...) body) is identical to (let () (define name value) ... body) I believe 07:50 DT``: (let ((name # 07:50 Lajla: That too. 07:51 Lajla: I once implemented letrec with a horrendously convoluted variadic fixedpoint operator. 07:51 Lajla: It took me like 2 days to construct that thing. 07:51 DT``: variadic fixedpoint operator? 07:51 Lajla: It needed to converge even in a call-by-value setting. 07:51 Lajla: Yeah 07:51 DT``: is that something like loeb? 07:51 Lajla: What is loeb? 07:52 DT``: I don't know, really. 07:52 DT``: wait. 07:53 Lajla: It was an operator such that (fix f x ...) evaluated to (f (fix (f x) ...)) I believe 07:55 DT``: I don't get the ... part. 07:55 Senjai: ... means other code there.. 07:55 Senjai: like etc. 07:55 DT``: What would ((fix f g h) x) do? 08:05 Lajla: It would evaluate to ((f (fix f (f g) (f h))) x) if I recall correctly. 08:08 (join) tauntaun 08:09 lithpr: (struct posn (x y)) 08:09 lithpr: stdin::4765: struct: illegal use of signature form in: (struct posn (x y)) 08:10 lithpr: that's copy-pasta from the guide 08:10 DT``: > (struct posn (x y)) 08:10 DT``: > 08:10 DT``: what #lang are you using? 08:10 DT``: *which 08:11 lithpr: well, i'm using the racket repl in emacs, it throws an error when i try to set a language with # 08:12 lithpr: #lang racket 08:12 lithpr: stdin::4822: read: #lang not enabled in the current context 08:13 lithpr: > reference to undefined identifier: racket 08:13 lithpr: i actually asked about this last night, but no one replied 08:14 DT``: the can't-define-structs-from-emacs problem is a known problem (I read it somewhere, but I don't remember now). 08:14 lithpr: okay 08:14 DT``: you can't set a language from the repl. 08:15 DT``: you have to invoke racket with ``racket -il language'' 08:15 DT``: > racket -ilq typed/racket 08:15 DT``: Welcome to Racket v5.1. 08:15 DT``: > 2 08:15 DT``: - : Positive-Fixnum 08:15 DT``: 2 08:16 lithpr: okay, i'm reading racket --help 08:16 lithpr: thank you 08:19 (join) corruptmemory 08:27 tauntaun: lithpr: my workaround is to use define-struct instead, even though it's deprecated. 08:27 tauntaun: (I think) 08:28 (join) mceier 08:29 (join) masm 08:43 (quit) Senjai: Ping timeout: 245 seconds 08:43 lithpr: ahhh, racket -i 08:49 lithpr: no, that wasn't it- i was using mzscheme 08:49 lithpr: all good now :) 08:51 (quit) MayDaniel: Read error: Connection reset by peer 08:59 (quit) mario-goulart: Read error: Operation timed out 09:00 (join) mario-goulart 09:14 (join) MayDaniel 09:14 (quit) mceier: Quit: leaving 09:45 (join) dnolen 10:54 (join) mceier 10:55 (quit) tauntaun: Quit: Ex-Chat 10:55 (join) tauntaun 10:57 (join) mheld 11:05 (join) mheld__ 11:07 (quit) mheld: Ping timeout: 240 seconds 11:07 (nick) mheld__ -> mheld 11:27 (quit) dnolen: Quit: dnolen 11:37 (join) jonrafkind 11:45 (quit) mheld: Ping timeout: 260 seconds 12:15 (join) anRch 12:24 (quit) amoe_: Quit: leaving 12:38 (quit) anRch: Quit: anRch 12:42 (join) mheld 12:51 (quit) lithpr: Remote host closed the connection 12:51 (join) anRch 13:14 (quit) corruptmemory: Ping timeout: 255 seconds 13:15 (join) lithpr 13:19 (nick) Lajla -> GreenPride 13:25 (quit) coyotama|2: Read error: Connection reset by peer 13:28 (join) coyo 13:28 (quit) coyo: Changing host 13:28 (join) coyo 13:50 (quit) tauntaun: Ping timeout: 240 seconds 14:01 (quit) MayDaniel: Read error: Connection reset by peer 14:03 (join) tauntaun 14:11 (quit) tauntaun: Quit: Ex-Chat 14:18 (quit) tfb: Ping timeout: 260 seconds 14:28 (join) MayDaniel 14:35 (quit) anRch: Quit: anRch 14:41 (join) mheld__ 14:44 (quit) mheld: Ping timeout: 255 seconds 14:44 (nick) mheld__ -> mheld 14:44 (nick) rapacity_ -> rapacity 14:51 (join) RyanRN 14:54 (join) lucian 15:26 (quit) RyanRN: Ping timeout: 264 seconds 15:46 (join) lucian_ 15:48 (quit) lucian: Ping timeout: 250 seconds 15:59 (nick) lucian_ -> lucian 16:24 (quit) lucian: Read error: Operation timed out 16:31 (join) lucian 16:31 (quit) em: Ping timeout: 240 seconds 16:33 (join) em 16:34 (join) lucian_ 16:36 (quit) lucian: Ping timeout: 260 seconds 16:38 (nick) lucian_ -> lucian 16:44 (join) zimio 16:45 zimio: heeeey 16:45 zimio: does R5S5 has for loops? 16:48 (quit) lithpr: Remote host closed the connection 16:50 (join) Nanakhiel 16:51 (join) lithpr 16:51 (join) DT-sama 16:52 (join) Demosthenex 16:52 Nanakhiel: zimio, define 'for loop' 16:52 Nanakhiel: It has a do ""loop"" 16:52 (quit) Demosthenes: Ping timeout: 250 seconds 16:52 (quit) GreenPride: Ping timeout: 250 seconds 16:52 (quit) DT``: Ping timeout: 250 seconds 16:52 (join) tauntaun 16:52 (quit) mattmight: Ping timeout: 250 seconds 16:52 zimio: oh thanks 16:53 (join) mattmight 16:53 Nanakhiel: http://pauillac.inria.fr/cdrom_a_graver/www/bigloo/manual/r5rs-5.html 16:53 Nanakhiel: look for 'do is an iteration construct' 16:57 (join) misterm 17:01 (join) RyanRN 17:01 (quit) lucian: Ping timeout: 250 seconds 17:10 (quit) MayDaniel: 17:10 (join) MayDaniel 17:12 (quit) RyanRN: Read error: Connection reset by peer 17:13 (join) RyanRN 17:23 (quit) lithpr: Read error: Connection reset by peer 17:25 (join) lithpr 17:25 (quit) RyanRN: Ping timeout: 276 seconds 17:26 (join) RyanRN 17:29 (quit) RyanRN: Client Quit 17:29 (join) lucian 17:35 (join) RyanRN 17:35 (quit) RyanRN: Client Quit 17:49 (part) shofetim: "ERC Version 5.3 (IRC client for Emacs)" 17:51 (quit) zimio: Read error: Connection reset by peer 17:52 (quit) masm: Quit: Leaving. 18:11 lithpr: is it possible to distribute a program developed in racket to someone who doesn't have racket installed? 18:11 DT-sama: raco exe 18:12 lithpr: ty 18:19 (join) corruptmemory 18:36 (quit) lucian: Remote host closed the connection 18:55 (quit) MayDaniel: Read error: Connection reset by peer 19:04 (join) jim__ 19:05 (quit) corruptmemory: Ping timeout: 246 seconds 19:06 (join) common_tragedian 19:16 (join) dnolen 19:17 (join) mheld__ 19:19 (quit) mheld: Ping timeout: 255 seconds 19:19 (nick) mheld__ -> mheld 19:50 (join) evhan 20:05 (quit) dnolen: Quit: dnolen 20:14 (quit) mye^: Ping timeout: 255 seconds 20:15 (quit) tauntaun: Quit: Ex-Chat 20:25 (join) Senjai 20:26 Senjai: Hey all 20:38 (quit) mceier: Quit: leaving 20:54 Senjai: Ayone around? 20:55 jonrafkind: do you have a question? 20:55 Senjai: I will :P but I'm also just gauging whos around. 20:56 Senjai: I'm studying racket for a comp sci class, I'm sure as I work through the book Ill have questions :P BST's last night were a pain.. 20:58 (join) coyotama|2 21:01 (quit) coyo: Ping timeout: 276 seconds 21:01 (join) tauntaun 21:15 (quit) tauntaun: Quit: Ex-Chat 21:18 (nick) zakwilson_ -> zakwilson 21:26 (quit) evhan: Quit: leaving 21:27 (join) evhan 21:29 (quit) evhan: Client Quit 21:36 (join) evhan 21:48 (quit) jonrafkind: Ping timeout: 255 seconds 21:57 (quit) common_tragedian: Remote host closed the connection 22:24 (join) tauntaun 22:31 (join) common_tragedian 22:36 (quit) common_tragedian: Remote host closed the connection 23:05 (quit) tauntaun: Quit: Ex-Chat 23:07 (quit) jim__: Quit: Leaving 23:07 (join) corruptmemory 23:31 (quit) mheld: Quit: mheld 23:34 (join) tauntaun 23:35 tauntaun: I'm trying to understand better how the word "reflection" is used in the context of other programming languages. Does Scheme's 'apply' endow the language with a capacity for reflection? Or would that be another word? 23:44 Senjai: tauntaun: sorry dude, the channel can be a bit dry sometiems, I don''t know thee answer but wait a bit someone might come by