00:11 (quit) cousin: Quit: Page closed 00:16 (quit) tauntaun: Ping timeout: 246 seconds 00:24 (quit) evhan: Quit: leaving 00:59 danking: I noticed a bug in the docs for scribble: http://docs.racket-lang.org/scribble/getting-started.html?q=doc#(part._first-example) 01:00 danking: Actually, this link is more to the point. Note the "quoteordered" http://docs.racket-lang.org/scribble/getting-started.html?q=doc#(part._.Text_.Mode_vs__.Racket_.Mode_for_.Arguments) 01:05 jonrafkind: mattmight, there might be some parameters set by drracket you could look at, but thats sort of a hack 01:45 (quit) jonrafkind: Ping timeout: 250 seconds 03:07 DT``: There's a typo in the docs: http://docs.racket-lang.org/reference/portstructs.html 03:07 DT``: ?An input port (for prop:input-port) or output port (for prop:input-port)? 03:58 (quit) misterm: Ping timeout: 246 seconds 04:21 (quit) ckrailo: Quit: Computer has gone to sleep. 05:27 (quit) jao: Ping timeout: 246 seconds 06:34 (join) masm 06:50 (join) jao 07:24 (join) tauntaun 07:44 (quit) masm: Ping timeout: 255 seconds 07:46 (join) masm 08:06 (quit) tauntaun: Ping timeout: 240 seconds 08:26 (join) MayDaniel 08:37 (join) dnolen 08:37 (quit) dnolen: Excess Flood 08:40 (quit) MayDaniel: Read error: Connection reset by peer 08:43 (join) dnolen 09:05 (quit) masm: Ping timeout: 276 seconds 09:27 (join) masm 09:36 (join) evhan 09:48 (join) jblz 09:50 (quit) jblz: Remote host closed the connection 09:51 (join) jblz 09:51 (quit) jblz: Remote host closed the connection 09:52 (join) jblz 10:22 offby1: *gasp* 10:22 aerschvergrijp inserts air into offby1's mouth. 10:22 (quit) jblz: Remote host closed the connection 10:24 offby1: oh thanks 10:24 (join) jblz 10:24 offby1: eww gross 10:24 aerschvergrijp: offby1, anythibng for your survival baby. 10:24 aerschvergrijp: offby1, I think you should name rudybot ultrabot. 10:28 (nick) offby1 -> ultrabot 10:29 ultrabot whistles innocently 10:29 (nick) ultrabot -> rudybot` 10:35 (quit) dnolen: Quit: dnolen 10:36 (quit) jblz: Remote host closed the connection 10:47 (quit) jao: Ping timeout: 246 seconds 10:48 (part) clklein 10:48 (join) anRch 10:56 (join) jao 10:56 (quit) jao: Changing host 10:56 (join) jao 11:04 (join) corruptmemory 11:07 (join) tauntaun 11:10 tauntaun: Does "let over lambda" specifically mean (let (lambda +))? 11:10 (quit) corruptmemory: Quit: Leaving 11:13 DT``: tauntaun, it's a let over a lambda, so yes. 11:15 tauntaun: Yes I realize it's a let over a lambda. I was just wondering if the phrase "let over lambda" (which you probably know is also the title of a recent book) is the *unique* name for that syntax. Thanks. 11:18 (join) ckrailo 11:19 (join) clklein 11:20 (nick) rudybot` -> offby1 11:25 (join) MayDaniel 11:33 (join) jblz 11:34 (join) lucian 11:43 aerschvergrijp: tauntaun, that intro on that site about it gives me goosebumps. 11:44 tauntaun: which site? Why are you so bent on obscuring the antecedents of your prepositions? 11:44 tauntaun: pronouns, rather. 11:44 (quit) jao: Ping timeout: 240 seconds 11:48 (quit) tauntaun: Quit: Ex-Chat 11:51 (quit) anRch: Quit: anRch 11:52 (join) mceier 12:08 (join) jonrafkind 12:09 (quit) masm: Ping timeout: 276 seconds 12:26 (nick) aerschvergrijp -> Lajla 13:02 (join) masm 13:08 Demosthenes: is there a simple way to make a racket script print nothing except what i choose to display? 13:09 DT``: ? 13:09 jonrafkind: put all your code in a function 13:10 jonrafkind: everything at the top level in a module gets printed automatically 13:11 Demosthenes: sure, what can i return from the function that won't print? 13:11 DT``: (void) 13:24 Demosthenes: awesome! thanks. 13:37 Lajla: if you return no values, are they then printed? 13:37 Lajla: woot, nope. 13:37 bremner applauds with one hand 13:37 Lajla: That's much cleaner I find. 13:38 Lajla can clap with one hand. 13:39 Lajla: Demosthenes, I think you should use (values) instead of (void) 13:40 bremner: is one more portable than the other or something, or is this purely an aesthetic comment? 13:41 Lajla: Well, I don't think any scheme standard defines (void) 13:41 Lajla: Though most implementations have something similar. 13:41 Lajla: But (values) is much cooler 13:42 Lajla: that (void) isn't printed is also some-what of a hack some would say. 13:42 DT``: Lajla, 13:42 Lajla: me 13:42 DT``: with (values): 13:42 Lajla: (with-values ...) 13:42 DT``: > (+ 2 (f)) 13:42 DT``: context expected 1 value, received 0 values 13:42 DT``: (if (f) returns (values)) 13:43 Lajla: DT``, yap. 13:43 DT``: > (define (f) (void)) 13:43 DT``: > (+ 2 (void)) 13:43 DT``: +: expects type as 2nd argument, given: #; other arguments were: 2 13:43 DT``: you can test for (void), but you can't test for (values). 13:43 Lajla: Actually, you can write a macro which does test how many values a context returns. 13:43 (join) Blkt 13:44 jeapostrophe: call-with-values 13:44 Lajla: But the point about (values) is that you end functions on it which are not supposed to return anything and are only called for side-effects. 13:44 Lajla: Yeah 13:44 Lajla: Basically let it expand to (call-with-values (lambda () ) (lambda xs (length xs))) 14:06 Demosthenes: Lajla: well, my main is called for side effects only ;] 14:08 Lajla: Demosthenes, then why wrap it into a function? 14:09 Lajla: and I camp with the camp who says ending it on (values) is better practice than ending it on (void) 14:09 jonrafkind: jonrafkind> put all your code in a function 14:09 jonrafkind: everything at the top level in a module gets printed automatically 14:10 Lajla: Ohhh 14:10 Lajla: Then 14:10 Lajla: why don't put begin around it? 14:11 Lajla: To just put ((lambda () ....)) around it seems prettysilly. 14:11 Lajla: Especially since it basically comes down to (begin ...) 14:12 Lajla: Also, I also camp with the camp who says that side effect functions should be separated and return either (void) or (values). 14:12 Lajla: And this camp is pretty cool, like, our toilets aren't unbelievably disgusting. 14:12 jonrafkind: even with begin things still get printed 14:13 jonrafkind: because begin is spliced into whatever expression context surrounds it 14:14 Lajla: I had no idea. 14:14 Lajla: Theeen 14:14 Lajla: (define (ignore . xs) (void)) 14:14 Lajla: Ehhh 14:14 Lajla: Nononono 14:14 clklein: Scheme ran out of identifiers. There was no other option than to reuse `begin'. 14:14 DT``: Lajla, 14:15 DT``: (void) just eats all his arguments. 14:15 DT``: (void 2 3 4 5) 14:15 DT``: returns void. 14:15 Demosthenes: wow... 14:15 Demosthenes: i tried begin, which is why i had to ask when it still output ;] 14:15 Lajla: DT``, I had no idea. 14:15 Lajla: DT``, and oh yeah, in racket the order is always left tor igt. 14:15 jonrafkind: `void' computes the meaning of life but doesn't return it to you 14:15 Lajla: I wanted to write a macro that guaranteed that. 14:16 Lajla: the meaning of life is void man. 14:16 Lajla: nihilism is for the cool kids. 14:16 Lajla: All your morals and purpose is all an illusion man. 14:16 Lajla: There is no god, no right nor wrong, no purpose, no meaning. 14:18 Demosthenes: good. now that you've cleared that up, i have a program to write ;] 14:19 Demosthenes: for no reason ;] 14:19 DT``: that's the spirit! 14:20 Lajla: The only reason you write programs is because it couldn't happen in another way. 14:20 Lajla: We have no free will, no purpose, all your actions are just the result of the laws of physics. 14:20 Lajla: There is no 'alive' or 'lifeless', only matter. 14:20 Demosthenes: you're such a joy ;] 14:20 Lajla: Though, to be fair, indeterminacy could be a part of it. 14:20 Lajla: But that doesn't mean free will! 14:21 Lajla: Demosthenes, I am so goth man. 14:25 Demosthenes: i'm sorry, we're fresh out of black eye liner. how's pink? 14:26 Lajla: that's emo man. 14:26 Lajla: Know your subcultures. 14:26 Lajla: I'm actually not goth. 14:26 Lajla: But I've noticed that a lot of those walking make-up boxes seem to not be that convinced of the existence of this so called 'purpose' or 'meaning'. 14:41 (quit) mceier: Read error: Operation timed out 14:43 (join) mceier 14:46 (nick) Lajla -> sherlock 14:46 (nick) sherlock -> Lajla 14:46 (join) jao 14:56 (join) lucian_ 14:56 (quit) jao: Ping timeout: 246 seconds 14:58 (quit) lucian: Ping timeout: 255 seconds 15:02 (join) jao 15:12 (quit) askhader: Ping timeout: 260 seconds 15:12 (nick) lucian_ -> lucian 15:15 (join) askhader 15:23 (quit) jao: Ping timeout: 246 seconds 15:24 (quit) Blkt: Remote host closed the connection 15:43 (quit) Lajla: Ping timeout: 260 seconds 15:50 (join) Lajla 15:56 (quit) MayDaniel: 16:04 (join) shofetim 16:07 (join) dude_ 16:07 dude_: hi 16:07 dude_: Does anyone know how I can unload a module in Racket? 16:10 jonrafkind: you mean you did (require foo) and you want to unrequire it? 16:11 dude_: Yeah 16:12 dude_: I am trying to write an autotester using rackunit on many different files that implement the same modules. 16:13 dude_: So I would like to be able to load one of them, run the tests on it using rackunit, output the results to another file. When I am done with that one, I would like to unload it and load another one. 16:13 jonrafkind: I dont think you can dynamically unload a module 16:13 jonrafkind: you might have to use units with dynamic-require 16:13 jonrafkind: which you can instantiate multiple times 16:13 dude_: I know it is possible to hack something together using another language and combine it with Racket. I was just wondering if Racket provides this functionality. 16:13 dude_: Okay 16:13 dude_: Thanks. 16:14 (nick) samth_away -> samth 16:22 (join) saint_cypher 16:22 samth: dude_, in what sense do multiple files implement the same modules? 16:24 dude_: Well for example, suppose I have two directories, each of which contains a file with the same name that implements the same procedures (but the implementation is not necessarily the same). 16:25 dude_: e.g. dir1/file.rkt and dir2/file.rkt 16:25 dude_: I want to run the same tests on dir1/file.rkt and dir2/file.rkt 16:25 (quit) ckrailo: Quit: Computer has gone to sleep. 16:26 dude_: Does that make sense? 16:47 samth: yeah, but there's no need for unloading in that case 16:47 samth: if you want to dynamically load the second one, then you can use `dynamic-require', as jonrafkind mentiond 16:47 samth: but you shouldn't even need that 16:49 (join) cow-orker 16:49 dude_: Why shouldn't I need that? 16:49 samth: why not just require both modules from the beginning, and test them both 16:49 samth: ? 16:50 dude_: Because I don't necessarily know at the beginning how many there will be. 16:50 samth: oh, ok 16:50 samth: then yes, `dynamic-require' is the correct choice 16:50 dude_: Ok 16:50 dude_: I am reading about dynamic-require now in the documentation 16:51 dude_: But I am having some trouble understanding exactly how I should be using it 16:51 samth: here's an example of using this idiom in the typed racket test suite: https://github.com/plt/racket/blob/master/collects/tests/typed-scheme/main.rkt 16:51 rudybot: http://tinyurl.com/4mekv5c 16:51 dude_: Thanks :) 16:53 samth: basically, if you want to load the "foo/bar.rkt" file, and get the value of `x' from that module, you should do this: 16:53 samth: (dynamic-require "foo/bar.rkt" 'x) 16:55 dude_: Ok thanks :) 16:55 dude_: I have another question 16:56 dude_: Actually I don't really. 16:56 dude_: It makes sense now 16:56 dude_: Thanks for the help :) 17:00 (quit) lucian: Remote host closed the connection 17:02 Lajla: dude_, your nickname remindes me of BASEketball. 17:04 (join) tauntaun 17:05 dude_: :) 17:06 dude_: That movie came out a long time ago, although I have not actually seen it 17:06 (nick) tauntaun -> tauntaun_away 17:06 (quit) jonrafkind: Ping timeout: 246 seconds 17:13 (quit) tauntaun_away: Quit: Ex-Chat 17:16 Lajla: dude_, well, there is a climacting dialogue at the end where both just say 'dude' to each other the entire time. 17:16 Lajla: But at the end finally come to an understanding. 17:16 Lajla: dude_, http://www.youtube.com/watch?v=RL1Vcn8yX1g 17:22 dude_: :) 17:34 (join) lucian 17:36 (join) tauntaun 17:56 (join) jonrafkind 18:00 (quit) dude_: Quit: Page closed 18:01 (join) Blkt 18:25 (quit) Blkt: Remote host closed the connection 18:28 (join) Blkt 18:36 (quit) masm: Ping timeout: 246 seconds 18:45 Lajla: tauntaun, with 'it' I meant the book. 18:50 (join) EM03 18:50 EM03: only 45 people? hehe 18:51 Lajla: I don't count as a person. 18:51 Lajla: I am Dutch. 18:52 EM03: oh 18:52 bremner: ChanServ is also Dutch 18:53 bremner: err, I mean, not a person 18:53 Lajla: That's reversing the antecedent. 18:53 Lajla: logical fallacy. 18:53 Lajla: dutch(x) -> ¬person(x) does not mean ¬person(x) -> dutch(x) 18:53 Lajla: Dutch people never make logical fallacies. 18:53 jonrafkind: the only things i hate in this world is cultural intolerance, and the dutch 18:53 Lajla: A trait most often associated with machines. 18:54 Lajla: By the way? 18:54 Lajla: Are we known internationally as culturally tolerant? 18:54 Lajla: Because that's what they taught me at school. 18:54 Lajla: Bil O'Reily seems to know us mainly as insanes. 18:54 jonrafkind: seems to be true thus far 18:55 Lajla: jonrafkind, you think I'm insane? 18:55 jonrafkind: no, when did I say that 18:55 jonrafkind: you must be going insane 18:56 Lajla: You troll me. 18:56 Lajla: But 18:57 Lajla: we speak 4 languages 18:57 Lajla: hah 18:57 jonrafkind: racket, java, C, bash? 18:57 Lajla: No 18:57 Lajla: Dutch, French, English, German (some also Frissian Latin and Greek) 18:57 Lajla: Well, speak, speak. 18:57 Lajla: read the latter two. 18:58 Lajla: We are sooo educated. 18:58 Lajla: unlike you monolingual yanks. 18:58 jonrafkind: i can say a few things in spanish 19:00 Lajla: I am talking to you in your native language. 19:00 Lajla: This is just how much more educated we are. 19:00 Lajla: Though, to be fair, we do have this Geert Wilders guy. 19:00 (join) masm 19:05 tauntaun: Lajla: funny that the book's website gave you goosebumps. All it did to me was roll my eyes. 19:06 Lajla: tauntaun, isn't that sort of the same? 19:06 Lajla: I don't mean goosebumps in a positive way. 19:07 Lajla: More like being some-what disgusted. 19:07 tauntaun: See how intolerant you Dutch are? 19:08 Lajla: But we had same sex marriage in like 1995 already. =( 19:08 tauntaun: And that makes you sad? 19:08 Lajla: No 19:08 Lajla: that makes me happy 19:08 Lajla: THat you insult us makes me sad. 19:08 Lajla: To be honest, I'm against state-sanctioned marriage. 19:09 tauntaun: To be honest, I don't give a lambda. :-) 19:09 Lajla: I'm fine with people calling someone their 'husband' however they please, but it shouldn't be the state's business. 19:09 Lajla: indifferent about the issues are wel. 19:12 (join) ckrailo 19:23 (join) dude 19:23 dude: Hi 19:24 Lajla: dude 19:24 dude: Question: If I have a string s, how do I add (string->symbol s) to the global namespace and bind it to some value? 19:25 dude: Basically I want to do something like a dynamic define 19:26 jonrafkind: you can get the global namespace and inject your symbol into it 19:27 dude: How do I inject a symbol into namespace? 19:27 Lajla: Isn't that someyhing that would break the scoping model if that could be done dynamically. 19:28 dude: Yes 19:28 jonrafkind: you can do like (eval '(define foo 2) my-namespace) 19:28 jonrafkind: where my-namespace comes from ((current-namespace) 19:29 dude: Ok. Thanks :) 19:30 Lajla: That effects stuff after it? 19:30 Lajla: Like, you can do (eval '(define f00 2) (current-namspace) (+ 1 foo)? 19:30 EM03: anything good in racket that has to do with web? 19:30 EM03: web development 19:31 jonrafkind: theres a web server in racket 19:32 EM03: do i have to use that web server when i want to put an application in a production environment? 19:32 jonrafkind: you can use racket to generate html I guess, but normally you should use the racket server 19:32 jonrafkind: its continuation based instead of the REST based protocol you get in virtually every other server 19:32 EM03: i always hated how python and ruby etc always needed their own server to run a web app 19:32 (quit) shofetim: Read error: Connection reset by peer 19:32 EM03: but like PHP has direct c bindings to apache so its very fluid 19:33 jonrafkind: python and ruby have fastcgi modules or whatever. i use them with lighttpd 19:33 EM03: yes 19:33 jonrafkind: i dont think such a thing exists for racket 19:33 EM03: the ones for python were actually in Python 19:33 jonrafkind: although i agree it would be useful 19:33 EM03: so it was a bit slower than directly in C 19:33 tauntaun: But I've found it hard to do an eval in a module. I presume it's because the eval happens in the top-level environment, which can't see bindings hidden in the original module. Is there a principled way around this? 19:34 EM03: jonrafkind: I could always run it as a proxy iwth lighttpd or something and have racket behind it 19:34 jonrafkind: yea i think thats what most people do in fact 19:34 EM03: that way I can still load balance etc 19:34 Lajla: I've been searching for some while to just install something to run .scm files on a server, put stuff between if it really has to and just output anything written to a specific port. 19:35 Lajla: Not really anything that doesn't require you to install a full-fledged server seems to exist. 19:35 Lajla: s/on a server/on apache 19:35 EM03: jonrafkind: now what do you mean by continuation based vs rest? 19:36 jonrafkind: rest means state for a session has to be stored in some persistent storage that each page will look up, like $SESSION in php 19:36 (quit) lucian: Remote host closed the connection 19:36 jonrafkind: in continuation based you dont need such a thing, the web server will save a continuation when you ask the user for some data and you can use normal lexical scoping to save variables 19:36 (quit) dude: Quit: Page closed 19:36 jonrafkind: (let* ([x 5] [y (web-server-request "pick a number for y")]) (web-print "x is ~a y is ~a\n" x y)) 19:37 jonrafkind: in php that sort of clause would consist of a form and a new page that retrieved the values of x and y 19:37 EM03: I'm actually really new to racket as well / scheme :) 19:37 EM03: but i'm well versed in programming languages ...php python C ocaml 19:39 EM03: jonrafkind: chicken scheme has some fcgi stuff 19:42 Lajla: EM03, ocaml eh? 19:42 Lajla: That's not what you usually see endng that list. 19:42 EM03: yea I like ocaml 19:42 EM03: I'm either doing my site in that or racket or maybe both :) 19:43 EM03: ocaml actually has some nice FCGI stuff so it might be worth it 19:43 EM03: but i never got into scheme and would like to 19:48 Lajla: OCaml has .+ for float addition 19:48 Lajla: that alone is reason enough to say it's awesome. 19:48 (quit) masm: Ping timeout: 276 seconds 19:48 EM03: Lajla: whats your opinion on what to use for my next web project? hehe 19:49 Lajla: EM03, depends on the project? 19:49 EM03: a simple website nothing big 19:49 Lajla: Ah 19:49 Lajla: Forth 19:49 Lajla: Nahh, no idea 19:49 EM03: well actually i might want to make a small user system 19:49 EM03: with a small forum 19:51 (join) masm 19:52 EM03: ocaml actually has cgi and fast cgi bindings as well as a apache 2.x module 19:57 (join) Senjai 19:57 Senjai: Hey Lajla 19:57 Senjai: @! 19:58 Senjai: Are you here? DT`` 20:01 Lajla: je suis une pomme de terre 20:01 Lajla: hai 20:01 (quit) Blkt: Ping timeout: 276 seconds 20:08 (quit) mceier: Quit: leaving 20:15 EM03: jonrafkind: not sure if i really understand the whole continuation thing for the web ....could you explain a little more if you have time :P 20:15 jonrafkind: theres a paper about it somewhere 20:17 jonrafkind: http://www.ccs.neu.edu/scheme/pubs/hosc07-sk-mf.pdf 20:17 (join) jao 20:17 EM03: I have never used a language that even has continuations I don't think :\ 20:19 Senjai: Hey Lajla sorry uhh irc didnt tell me anyone responded 20:19 Senjai: you still here/ 20:20 EM03: jonrafkind: whats your honest opinion of continuation vs rest? 20:20 jonrafkind: 99% of the time continuations are better than rest 20:20 jonrafkind: the only downside is it takes up a bit of memory 20:21 jonrafkind: but usually you can store the continuations on disk for which you have almost unlimited storage 20:22 EM03: I'm still not really sure what a continuation is really doing in web dev 20:22 EM03: i'm just guessing 20:22 EM03: does the connect like never end? or is it sending javascript request I'm not sure whats really going on 20:24 Senjai: rudybot: (define (map2 fun l) (cond [(empty? l) empty] [else (cons (fun (first l)) (map2 fun (rest l)))])) 20:24 rudybot: Senjai: your sandbox is ready 20:24 rudybot: Senjai: Done. 20:25 Senjai: rudybot: (map2 (lambda (n) (+ n 3)) '(1 2 3)) 20:25 rudybot: Senjai: ; Value: (4 5 6) 20:25 Senjai: rudybot: (map2 (lambda (n) (* n 3)) '(1 2 3)) 20:25 rudybot: Senjai: ; Value: (3 6 9) 20:29 Senjai: rudybot: (define (filter2 f n) (cond [(empty? n) empty] [(f (first n)) (cons (first n) (filter2 f (rest n)))] [else (filter2 f (rest n))])) 20:29 rudybot: Senjai: Done. 20:29 Senjai: rudybot: (filter2 even? (list 2 4 5 6 7 8)) 20:29 rudybot: Senjai: ; Value: (2 4 6 8) 20:30 Senjai: rudybot: (filter2 positive? (list -2 4 -5 6 7 8)) 20:30 rudybot: Senjai: ; Value: (4 6 7 8) 20:31 bremner: Senjai: I thought you hated recursion? 20:32 Senjai: bremner: haha I do, but my midterm is in an hour and a half 20:32 Senjai: bremner: being tested on this stuff 20:32 Senjai: bremner: How are you/ 20:32 bremner: a bit sleepy, just heading for bed. 20:32 Senjai: What time is it there? 20:32 bremner: By the way, you can also /query rudybot 20:33 bremner: Senjai: it's early (9:30), but I'm not feeling too well. 20:33 (join) dude 20:33 dude: Hi! 20:33 Senjai: Hi dude 20:33 Senjai: bremner: shitty deal, hope you get better 20:33 Senjai: bremner: sorry, Ive only seen ae do it this way lol 20:34 Senjai: bremner: Nobody was talking, didn't think it'd be a problem lol 20:34 dude: I am having trouble using namespace-require 20:34 dude: I have something like this 20:34 bremner: Senjai: no, it wasn't a problem. But maybe if you do it for the next 90 minutes, that might be better in /query ;) 20:34 Senjai: dude: post your code to codepad.org? 20:34 Senjai: bremner: haha I have racket open, was just waiting on Lajla to respond lol 20:35 dude: (parameterize ([current-namespace (make-base-namespace)]) (namespace-require ) ) 20:36 dude: But when I try to refer to the identifier it tells me it is unbound identifier 20:36 Senjai: dude: beyond my knowledge, just wait someone will come by. :) 20:36 Senjai: bremner: Do you have any advanced scheme code I can show my friend ? :P 20:37 dude: Ok, thanks anyway :) 20:42 (quit) dude: Quit: Page closed 20:47 (quit) jonrafkind: Ping timeout: 255 seconds 20:57 (part) EM03 21:06 Lajla: Senjai, still there? 21:06 (quit) masm: Quit: Leaving. 21:06 Lajla: Senjai, what's up 21:07 Senjai: studying for my midterm in an hour 21:07 Senjai: Know anything about AVL trees? 21:08 Lajla: Senjai, never heard of it 21:08 Lajla: let me read it up 21:09 Lajla: Oh wow 21:09 Lajla: self balancing tree. 21:09 Lajla: Hey 21:09 Lajla: this one is actually better than red black for some applications. 21:10 Senjai: Lajla: http://en.wikipedia.org/wiki/AVL_tree 21:10 Senjai: I need to be able to design a function to rebalance a bst tree so the balance factor is -1 <= 0 <= 1 21:13 Lajla: Senjai, are you given an algorithm to do so? 21:13 Lajla: Or is that also your own ting to think of. 21:13 Lajla: trees usually work well with recursion because afer all, they are recursively built up. 21:15 Senjai: Uhh Lajla instead do you know about abstract data types? 21:16 Senjai: Lajla!! Need help! :( http://codepad.org/o0GNz0b 21:16 Senjai: Do you know what (fold) does? and how to understand the types comment? 21:17 Senjai: Specifically: ;; (X Y -> Y) Y (listof X) -> (listof Y) , I dont understand that types comment 21:17 Senjai: 20 minutes till midterm :( 21:18 Lajla: Senjai, ahh 21:18 Lajla: fold is awesome 21:18 Lajla: Ehhh 21:18 Lajla: as an example 21:18 Lajla: (fold + '(1 2 3 4)) is 10 21:18 Lajla: Ehh, bad example I suppose 21:19 Senjai: So it added everything? 21:19 Senjai: but the codepad example has three arguemtns 21:19 Senjai: (fold fn b lox) 21:19 Senjai: rudyboy: (fold + '(1 2 3 4)) 21:19 Senjai: rudybot: (fold + '(1 2 3 4)) 21:19 rudybot: Senjai: error: reference to undefined identifier: fold 21:19 Senjai: rudybot: (foldr + '(1 2 3 4)) 21:19 rudybot: Senjai: error: procedure foldr: no clause matching 2 arguments: # (1 2 3 4) 21:19 Lajla: But what (fold f x (list a b c ...)) does is (f (f (f x a) b) c) ... et cetera 21:20 Lajla: foldl works from the left, foldr from the right 21:20 Lajla: so foldl basically starts at the beginning of the list 21:20 Lajla: And sfoldr starts at the end. 21:20 Senjai: rudybot: (foldr + 0 '(1 2 3 4)) 21:20 rudybot: Senjai: ; Value: 10 21:20 Lajla: Yeah 21:20 Lajla: Good 21:20 Senjai: Do you know what the one I posted in codepad does? 21:20 Senjai: Do you understand that crazy type comment? 21:20 Lajla: It ays 'not found' on your codepad link. 21:21 Senjai: sorry: http://codepad.org/o0GNz0b1 21:21 Lajla: rudybot, (foldr - 0 '(1 2 3 4)) 21:21 rudybot: Lajla: your sandbox is ready 21:21 rudybot: Lajla: ; Value: -2 21:21 Senjai: so 1 - 0 -2 -3 - 4? 21:21 Lajla: Ahh, you mean the top comment? 21:22 Lajla: Well, basically (A B ... -> Z) means 'a function which takes arguments of type A B ... and returns a value of type Z. 21:22 Lajla: For instance + is typed (Number ... -> Number) 21:23 Lajla: And string-length is typed (String -> Natural-number) 21:23 Lajla: Assuming that natural-number is a type 21:23 Lajla: If you have a substring function it would be typed (String Natural-number Natural-number -> String) 21:23 Senjai: Oh so its the Signature of the function being passed to fold? 21:24 Lajla: (X Y -> Y) is the type signature of that 21:24 Lajla: X and Y are type variables 21:24 Lajla: as in, they can be any type 21:24 Lajla: as long as they are the same in the cases where the letters are the same. 21:24 Lajla: So fold takes a function of type (X Y -> Y) 21:24 Senjai: so in (fold f b lox) the signature has to include trhe signature of f? so it would be (X Y -> Y) (listof Z) -> (listof Z) 21:24 Lajla: Wel, almost 21:25 Senjai: I thought it is (f) takes a type (X Y -> Y) and fold takes f so therefore fold takes (X Y -> Y) (listof Z) -> (listof Z) 21:25 Lajla: (X Y -> Y) Y (listof X) -> (listof Y) 21:25 Lajla: Fold takes three arguments 21:25 Lajla: not two. 21:25 Lajla: THe type of fold is what I just typed there. 21:26 Lajla: (listof X) is just the type of a list who ony has members of type X. 21:26 Lajla: You can see this as an example. 21:26 Lajla: Take for instance a function which takes a number and a string and repeats the string tht many times. 21:26 Lajla: Like (repeat-string 2 "foo") becomes "foofoo" 21:26 Lajla: This guy is typed (Natural String -> String) 21:27 Lajla: We can call (fold repeat-string "foo" (list 1 2 3 4)) 21:27 Lajla: And you can see the types check in this case 21:27 Senjai: ]I would type that function as Number String -> string 21:27 Lajla: The first argument to repeat-string must is a natural. 21:27 Senjai: Without the () 21:28 Lajla: So the list must contain only naturals. 21:28 Lajla: Well, I like adding outer brackets. 21:28 Lajla: Doesn't make a huge different. 21:28 Lajla: But you can see that it type checks right? 21:28 Lajla: And then returns a list of strings. 21:28 Senjai: Yep but (X Y -> Y) is from the f arguement of fold right? Y is from the b arguement and (listof X) is from the lox argument? 21:28 Senjai: Yea 21:28 Lajla: Yeah 21:28 Lajla: exactly 21:29 Lajla: And those uppercase X Y Z are variables. 21:29 Lajla: So they can be anything, as long as they are the same in each instance. 21:29 Senjai: So but why does X Y -> Y? wouldnt it -> Z or something other than Y 21:29 Senjai: Or because it would be of type Y 21:29 Senjai: ? 21:29 (join) traisen 21:31 Lajla: Senjai, yeah 21:31 Lajla: in order for fold to function 21:31 Lajla: the type f returns has to be the same type as its second argument 21:31 Lajla: You an see this if you analyse how fold works. 21:31 Senjai: yea i understand 21:32 Senjai: so (X Y -> Y) Y 21:32 Senjai: Is because the first argument consumes the second argument and produces the same type of the second argument 21:32 Senjai: the second argument is therefore the same type as the result of the first argument 21:32 Lajla: Like, if you have a list (list a b c d) and an init x, it works by doing (f (f (f (f a x) b) c) d) 21:32 Lajla: Yeah 21:33 Lajla: What it returns from the first time is then fed to it again 21:33 Senjai: but why is the third (listof X) and not (listof Z or (listof Y)) 21:33 Senjai: because X is a function, the list is just a list of values 21:33 Lajla: No, X is a type variab.e 21:33 Lajla: What it basically says is 21:34 Lajla: 'the list must contain only elements of the same type as f can handle as its first argument' 21:35 Lajla: I actually fucked my expansion up, it should be (f d (f c (f b (f a x)))) 21:35 Lajla: a,b,c,d are all elements of the list. 21:35 Lajla: which are of type X 21:35 Lajla: f's first argument must be of type X 21:35 Lajla: f's second arguemnt of type Y 21:36 Lajla: and Y always returns a value of type Y. 21:36 Lajla: So you can see from the expansion that it adds up. 21:36 Lajla: actually. 21:36 Lajla: The type signature should be (X Y -> Y) Y (listof X) -> Y 21:36 Lajla: Not (listof Y) at the end 21:36 Lajla: for fold 21:37 Lajla: There is no guarantee that fold will return a list. 21:38 Lajla: and foldl works in reverse, it starts from the left so it expands to ((((f x a) b) c) d) 21:38 Senjai: OH 21:38 Senjai: Your right 21:39 Lajla: So it's type is (X Y -> X) X -> (listof Y) -> X 21:39 Senjai: I GET IT NOW! 21:39 Senjai: THANK YOU SO MUCH ! :) 21:39 Lajla: Senjai, see, functional programming is cool? =P 21:40 Lajla: Senjai, by the way, there are some languages which actually can infer the type of expressions for you. 21:40 Senjai: haha 21:40 Lajla: Prelude> :t foldr 21:40 Lajla: foldr :: (a -> b -> b) -> b -> [a] -> b 21:40 Senjai: kik 21:40 Senjai: that hekos 21:40 Lajla: This is me working in a Haskell implementation 21:40 Senjai: I have to run to my midterm 21:40 Senjai: Wish me luck? 21:40 Lajla: I did :t on an expression and it tells me the type. 21:40 Lajla: Sure 21:40 Senjai: Ill let you know how goes 21:40 Lajla: good luck. 21:44 (quit) Senjai: Ping timeout: 245 seconds 21:58 (quit) abbe: Read error: Connection reset by peer 22:00 (join) abbe 22:05 (quit) tauntaun: Quit: Ex-Chat 22:15 (join) tauntaun 22:16 (join) misterm 22:24 traisen: The FFI documentation mentions a collection of examples of common FFI usage patterns ... any hints where to look? 22:30 (quit) traisen: Ping timeout: 245 seconds 22:45 (quit) tauntaun: Quit: Ex-Chat