00:19 (quit) coldhead: Quit: Lukkedoerendunandurraskewdylooshoofermoyportertooryzooysphalnabortansporthaokansakroidverjkapakkapuk 01:31 (join) jonrafkind 01:39 (quit) mwolfe: Remote host closed the connection 02:31 (quit) jonrafkind: Ping timeout: 265 seconds 03:44 (quit) samth: *.net *.split 03:44 (quit) jeapostrophe: *.net *.split 03:44 (quit) certainty: *.net *.split 03:44 (quit) spacebat: *.net *.split 03:44 (quit) fmu: *.net *.split 03:44 (quit) Fill: *.net *.split 03:44 (quit) rudybot: *.net *.split 03:44 (quit) Gwyth: *.net *.split 03:44 (quit) askhader: *.net *.split 03:44 (quit) tonyg: *.net *.split 03:44 (quit) elly: *.net *.split 03:47 (join) rudybot 03:47 (join) Fill 03:47 (join) fmu 03:48 (join) Gwyth 03:48 (join) askhader 03:48 (join) elly 03:48 (join) tonyg 03:48 (join) samth 03:48 (join) jeapostrophe 03:48 (join) certainty 03:48 (join) spacebat 04:04 (join) Tasser 04:04 Tasser: why would racket be better than scheme? (or rather drracket vs. drscheme) 04:59 (join) aLeSD 05:33 _p4bl0: Tasser: it's just a change in the name (more for branding purpose than anything else) 05:34 Tasser: _p4bl0, oh. 05:36 _p4bl0: Tasser: «instead of having to say “PLT's main variant of Scheme,” programmers can now simply say “Racket” to refer to the specific descendant of Scheme that powers PLT's languages and libraries.» from http://racket-lang.org/new-name.html 06:10 (quit) aLeSD: Ping timeout: 260 seconds 06:13 (join) masm 07:01 Lajla: Tasser, racket is an implementatoin and more importantly language based Scheme which is not a superset of any scheme standard. 07:02 Lajla: There are some small variations from all standards. 07:02 Lajla: But the racket implementation also supports the widely supported standards R5RS and R6RS 07:03 (join) mheld 07:31 (quit) mheld: Quit: mheld 07:32 (join) mheld 07:32 (quit) mheld: Client Quit 07:43 (quit) masm: Ping timeout: 240 seconds 07:45 (join) masm 07:59 (quit) spacebat: Remote host closed the connection 08:08 (join) Demosthenes 08:10 (join) lucian_ 08:11 (quit) lucian: Disconnected by services 08:11 (nick) lucian_ -> lucian 08:18 (join) MayDaniel 08:21 (join) stis 08:38 (quit) MayDaniel: Read error: Connection reset by peer 08:38 (join) aLeSD 08:52 (join) dnolen 08:56 (quit) lucian: Remote host closed the connection 09:22 (quit) aLeSD: Ping timeout: 264 seconds 09:57 (quit) masm: Quit: Leaving. 10:10 (join) masm 10:20 (join) MayDaniel 10:20 (join) mheld 10:33 (quit) abbe: Read error: Operation timed out 10:35 (join) abbe 10:39 (quit) abbe: Changing host 10:39 (join) abbe 10:43 (quit) dnolen: Quit: dnolen 11:15 (join) anRch 11:15 (join) corruptmemory 11:19 (join) carleastlund 11:42 (join) dnolen 11:49 (join) SCIPer 11:50 SCIPer: Are there any video lectures based on HTDP? 11:58 (quit) dnolen: Quit: dnolen 12:03 (quit) anRch: Quit: anRch 12:05 Lajla: Is there a part of R5 or R6 which requires that begin can accept continuatoins of any arity? 12:12 (join) mceier 12:22 (join) anRch 12:52 (quit) anRch: Quit: anRch 12:59 Tasser: what's the story of the name of big-bang? 13:03 (join) lucian 13:19 (quit) MayDaniel: Read error: Connection reset by peer 13:20 (quit) mheld: Ping timeout: 240 seconds 13:39 (join) jonrafkind 13:44 (join) mheld 14:01 (quit) Demosthenes: Quit: Lost terminal 14:04 (join) anRch 14:06 SCIPer: Are there any video lectures based on HTDP? 14:06 (join) unkanon2 14:07 unkanon2: hey guys, I'm trying out the Quick: An Intro to Scheme with Pictures 14:07 unkanon2: getting an error for #lang slideshow 14:07 unkanon2: #%module-begin: illegal use (not a module body) in: (#%module-begin) 14:08 jonrafkind: change your language to 'use language declared in source' 14:08 jonrafkind: in the language menu 14:08 (join) Demosthenes 14:10 unkanon2: sorry that was really stupid of me :) I've used DrScheme before and always subconsciously chose R5RS every time 14:10 unkanon2: thanks! 14:14 Lajla: jonrafkind, 14:14 Lajla: do you know a place in R?RS where they require that begin can accept continuations of any arity. 14:15 jonrafkind: what does it mean for a begin to accept a continuation 14:16 samth: Lajla, R6RS requires that the non-final expression in a `begin' create continuations that accept any number of values 14:16 samth: r5rs does not require this 14:16 Lajla: samth, where, I couldn't find it. 14:17 samth: see section 5.8, for example 14:18 samth: also 11.15, under the `values' procedure 14:19 Lajla: "A number of forms in the base library have sequences of expressions as subforms that are evaluated sequentially, with the return values of all but the last expression being discarded. The continuations discarding these values accept any number of values." 14:19 Lajla: Ah yeah, I was searching the document on the begin special form 14:21 samth: note that the examples for `begin' implicitly specify this as well, since: "The display procedure returns unspecified values." 14:23 Lajla: You mean because display is allowed to return multiple values? 14:23 samth: yes 14:24 Lajla: Ah, 14:24 Lajla: well, it wouldn't be the first time that a standard contained a subtle error like that though. 14:24 Lajla: One author forgetting that possibility when he writes the example and it slipping through 14:24 samth: yes, but here it's correct 14:24 Lajla: THe other part does imply it yes. 15:21 SCIPer: Are there any video lectures based on HTDP? 15:22 (join) coldhead 15:24 samth: SCIPer, i don't think so 15:25 Lajla: SCIPer, what's a video lecture? 15:26 Lajla: Some one readng the text with an animation? 15:26 SCIPer: http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ 15:26 SCIPer: like this.... 15:28 Lajla: I wish I had a fez like that. 15:28 samth: there are some videos in turkish, if you want that ... 15:28 Lajla: It does complement the fez. 15:29 samth: indeed 15:29 SCIPer: heheh 15:38 unkanon2: sussman's lectures are more about scheme even though they're calling it lisp, right/ 15:38 unkanon2: ? 15:38 samth: yes 15:39 Lajla: Yeah, in SICP he always calls it 'lisp' 15:40 Lajla: Not sure how much that book prepairs you to work in languages that do not have the simple pleasures of inner functions though. 15:41 unkanon2: I never found myself needing inner functions 15:42 unkanon2: well that's not true, I may let a lambda sometimes 15:42 Lajla: wot 15:42 Lajla: bad programming practices. 15:43 unkanon2: I mean like in haskell one does let in 15:43 Lajla: It's like johnrafkind says, ideally a function body should not comprise more than four lines, excluding inner functions. 15:43 unkanon2: that ain't bad 15:43 Lajla: Yeah, that are inner definitions in haskell. 15:43 Lajla: But haskell is silly, not differentiating let and let rec. 15:43 Lajla: OCaml does. 15:43 Lajla: Because OCaml is less silyl than haskell. 15:44 unkanon2: why should let and let rec need to be differentiated? 15:44 unkanon2: I never understood "let rec" but I'd love to read an explanation 15:44 Lajla: let rec is what let is in haskell. 15:44 Lajla: And basically, you want let if you only want a function definition to search for bindings in its outer environment. 15:45 Lajla: Which is especially handy if you want to locally use the same name as another function. 15:45 Lajla: Or want to expand upon its meaning. 15:45 Lajla: Also, let rec is from a lambda calculus perspective purely a hack in my opinion. 15:45 (quit) parcs: Ping timeout: 240 seconds 15:45 unkanon2: I'm lost, I thought you were defending let red 15:45 Lajla: To make life easier, I would call the construct 'impure', so it's nice that ocaml makes using it explicit. 15:46 unkanon2: rec 15:46 Lajla: Well, to differentiate it from let. 15:46 unkanon2: oh 15:46 Lajla: let is basically just syntactic sugar for a lambda application. 15:46 unkanon2: yes I understand that 15:46 unkanon2: what's "rec" supposed to be short for? 15:46 Lajla: let x = y in z is just fancy sugar for ((\x -> z) y) 15:46 Lajla: recursive. 15:47 Lajla: it means that the environment of y is the environment defined by the very let. 15:47 unkanon2: that's what I thought. so the difference between let and let rec is that one is for defining non-recursive functions and the other for recursive functions? 15:47 (join) parcs 15:47 Lajla: THat is what it's usually used for yeah 15:47 (quit) anRch: Quit: anRch 15:47 unkanon2: then I have trouble seeing how it's beneficial to differentiate let and let rec 15:48 unkanon2: it looks more like I'm making the compiler's life easier 15:48 Lajla: the 'formal' difference is that in let rec the definition also searches in the bindings the let rec establisehes itself. 15:48 unkanon2: yes 15:48 Lajla: What if you want to expand a praeviously defined function under the same name? 15:48 unkanon2: but is that enough to warrant a different way of declaring recursive functions? 15:48 unkanon2: you should never have 2 things with the same name anyway 15:49 Lajla: Well, the later let shadows the former. 15:49 unkanon2: scheme doesn't need define-rec and I'm glad it doesnt 15:49 Lajla: And it's more that let rec is strictly impure. 15:49 Lajla: define != let. 15:49 unkanon2: oh... 15:49 Lajla: define makes a definition, let creates a local environment. 15:49 unkanon2 is enlightened 15:49 Lajla: the definitions made with define at the top level have unlimted scope. 15:49 unkanon2: I totally see what you mean 15:50 Lajla: (let ((x y)) ...) creates a binding of x in ... 15:50 unkanon2: I'm on your side then. yes, let rec is impure 15:50 Lajla: But y is considered to lie in the outer environment. 15:50 Lajla: OCaml and Haskell need let rec though, because without recursive definitions, there can be no recursion in them. 15:51 Lajla: Scheme is an untyped calculus, and as such can create a fixed point combinator to make recursion if you really need to, but it's not very performant. 15:51 unkanon2: but haskell calls let rec simply let, then? 15:51 Lajla: Yeah, what haskell calls 'let' is what is let rec in OCaml, and letrec in Scheme. 15:52 unkanon2: sometimes, that is 15:52 unkanon2: sometimes a let in haskell is just a let 15:52 Lajla: Well, if you don't refer to your own name, the effect is the same. 15:53 unkanon2: f = let x = 2 in x 15:53 unkanon2: that's pure 15:53 Lajla: Yeah, it doesn't refer to itself. 15:54 unkanon2: right 15:54 Lajla: In that case, the effect is the same for let and let rec 15:54 Lajla: But the thing about inner definitions in scheme is that they are not top level. 15:54 Lajla: So they have limited scope. 15:55 Lajla: And the standard mandates that inner definitions are aequivalent to using a let rec. 15:55 Lajla: So a lot of implementations define one in terms of the other. 15:55 (quit) stis: Remote host closed the connection 15:56 unkanon2: hmm 15:56 Lajla: (define-syntax letrec (synax-rules () ((letrec ((name value) ...) . body) (let () (define name value) ... . body)))) 15:58 unkanon2: I need a scheme book for people with a functional background 15:59 unkanon2: I'm comfortable with recursion already and working with lists, using hofs, etc 15:59 (join) MayDaniel 15:59 Lajla: Tnen I suppose you could just read the spec. 16:00 samth: unkanon2, try the Racket guide: http://docs.racket-lang.org/guide/index.html 16:00 Lajla: unkanon2, are you comfortable with continuations and hygienic macros? 16:00 (quit) SCIPer: Quit: Page closed 16:00 unkanon2: I understand continuations and how call/cc works (I haven't read on resume/cc or others) but I'm not fluent with using continuations by any means, no 16:01 unkanon2: don't know anything about macros 16:01 unkanon2: 'd love to learn 16:01 unkanon2: samth: yeah I might, even though I'm using chicken now for an openGL project, but racket is so appealing and nice 16:01 unkanon2: plus both of those use r5rs 16:03 unkanon2: Lajla: from seeing comparisons between CL's and scheme's macros I thought scheme's were easier to read. why do people say scheme's macros are harder? (for any value of hard) 16:04 (quit) jonrafkind: Read error: Connection reset by peer 16:04 samth: unkanon2, mostly because those people already know CL's macros :) 16:05 Lajla: unkanon2, that depends if you use syntax-rules or syntax-case 16:05 Lajla: syntax-rules is like really easy and really high level and really clear 16:05 Lajla: syntax-case is kind of abstract and mind boggling, but more powerful. 16:05 Lajla: CL macros just have 'I break your code' written all over them. 16:06 unkanon2: hahaha 16:06 unkanon2: they do look like monsters 16:06 unkanon2: I never found a nice and slow macro tutorial for scheme 16:07 unkanon2: should I get Land of Lisp or is that a lot more CL than scheme? 16:07 unkanon2: I've been contemplating getting The Little Schemer too 16:07 samth: Land of Lisp is about CL 16:08 samth: try this for macros: http://docs.racket-lang.org/guide/macros.html 16:12 unkanon2: samth: that's exactly what I wanted, thanks! 16:18 Lajla: unkanon2, the racket docs do contain many extensions to scheme which would fail in the implementation that you use for your project though. 16:18 Lajla: Racket is neither a subset nor a superset to scheme, but it's very close to a superset 16:20 unkanon2: yeah it looks like a superset 16:20 unkanon2: well if it implements r5rs then surely it's anything else will be a superset to it? 16:21 Lajla: It implements R5 and R6 if you ask for it. 16:21 Lajla: #lang r5rs at the top gives you R5 16:21 Lajla: #lang racket gives you racket. 16:21 unkanon2: also I'm not rally sre why I do #lang slideshow instead of (use slideshow) 16:21 Lajla: Which is also a language the implementation called 'racket' supports. 16:21 Lajla: Kind of confusingingly. 16:23 Lajla: I'm not sure how many implementations support define-syntax-rules for instance. 16:23 unkanon2: but for instance slideshow, why can't it be just something I can require? 16:23 samth: well, most languages have the same confusion 16:23 samth: unkanon2, it can be 16:23 Lajla: Instead of (define-syntax (syntax-rules ....)) 16:23 unkanon2: why isn't it 16:23 samth: #lang racket (require slideshow) does much the same thing 16:23 (join) jonrafkind 16:23 Lajla: unkanon2, well, some #langs change pretty fundamental things like the evaluation model. 16:24 unkanon2: but why doesn't #lang r5rs (require slideshow) work? 16:24 unkanon2: or, first of all, could it work? 16:24 samth: unkanon2, r5rs doesn't have `require' 16:24 unkanon2: well, (use) 16:24 samth: `use' isn't in r5rs either 16:24 samth: r5rs has no module system 16:24 Lajla: R5RS is pretty extremely small for a programming language. 16:25 unkanon2: (use) is not r5rs? wow. r5rs doesn't define a way for adding source code from other files? 16:25 Lajla: Scheme is often used as a training language for implementors. 16:25 Lajla: It defines load, but I think that's an optional appendix. 16:25 Lajla: And it's not very robust. 16:25 samth: unkanon2, r5rs provides load, which is not a module system 16:25 unkanon2: training for what? 16:25 unkanon2: to implement other languages? 16:25 Lajla: To learn how to write a compiler or interpreter. 16:25 unkanon2: but scheme is so powerful, why would anybody want other lamnguages? 16:26 Lajla: People want them alright 16:26 Lajla: that is why most implementations go beyond R5RS. 16:26 Lajla: THere are also the SRFI's that extend it. 16:26 Lajla: Scheme is not a 'batteries included' thing, racket is though. 16:27 Lajla: The standard has historically given implementations a lot of freedom about what to include, and there are multiple layers atop the core R5RS standard 16:27 Lajla: The standard is also a pretty high 'undefined-behaviour'-fetishist. 16:27 Lajla: Implementations are for instance free toc hoose their own order of evaluation of arguments to function calls. 16:28 unkanon2: ic 16:30 unkanon2: when you said scheme is often used as a training language for implementors, did you mean to imply anything bad about scheme? 16:30 Lajla: Not at all. 16:30 Lajla: But many programming courses are given with scheme as an example. 16:30 unkanon2: ye 16:30 unkanon2: s 16:30 Lajla: and usually near the end you're going to have to make a scheme compiler. 16:30 unkanon2: I want to make one one day 16:31 Lajla: Because scheme is obviously the pinacle of excellence in programming paradigm. 16:31 unkanon2: is it? 16:31 unkanon2: how? 16:31 Lajla: No idea really. 16:31 unkanon2: hah 16:31 Lajla: But it as a lot of things which are considered 'good'. 16:31 Lajla: Inner function definitions, tail call optimization, hygienic macros, lexical scope, first class functions. 16:31 unkanon2: oh yeh. TCO, HOFs, currying... 16:31 Lajla: And scheme is a simple yet expressive langauge. 16:31 unkanon2: :) 16:32 Lajla: Scheme does not have currying by default. 16:32 unkanon2: I know but it comes in srfi... 1 I think? or 43? something like that 16:32 Lajla: In Scheme, a function can consume multiple arguments and return multiple values. 16:32 Lajla: Ahh, yeah. 16:32 Lajla: a curryable lambda does exist. 16:32 unkanon2: how do you rreturn multiple values without it being a list? 16:33 unkanon2: I didn't know that was possible 16:33 Lajla: There is much you do not know, padawan. 16:33 Lajla: but the primitive used for that is values 16:33 unkanon2: that is true 16:33 Lajla: (values obj ...) is a function 16:33 unkanon2: oh I've used that with list-tabulate 16:33 Lajla: that returns multiple values basically 16:33 Lajla: It's arguments. 16:33 unkanon2: oh ok 16:34 Lajla: And if you end a function on that, that function will return multiple values. 16:34 unkanon2: rudybot: (list-tabulate 10 values) 16:34 rudybot: unkanon2: your sandbox is ready 16:34 rudybot: unkanon2: error: reference to undefined identifier: list-tabulate 16:34 unkanon2: srfi 1 16:34 unkanon2: rudybot: (use srfi-1) 16:34 rudybot: unkanon2: error: reference to undefined identifier: use 16:34 Lajla: rudybot is a bit archaic, excuse him. 16:34 unkanon2: :)) 16:34 unkanon2: anyway I see what you mean 16:34 Lajla: But yeah, SCheme can fully differentiate between returning a list as a single value and returning multiple values. 16:34 Lajla: It's handy with function composition, for one. 16:35 Lajla: If you compose a function that takes 2 arguments on na function that returns one. 16:35 Lajla: returns two* 16:35 Lajla: You get what happens. 16:35 unkanon2: I've never thought of function composition with multiple values (coming from haskell, we can't return multiple values in haskell without a tuple) 16:35 unkanon2: it'll take the same arg twice?? 16:35 Lajla: You could for instance create a function (define (true-sqrte x) (values (sqrt x) (- sqrt x))) 16:36 unkanon2: and then create fourth-root? 16:36 Lajla: What do you mean? 16:37 unkanon2: and then (define (fourth-root x) (compose true-sqrte true-sqrte) x) 16:37 unkanon2: ? 16:37 Lajla: No. 16:37 unkanon2: rudybot: (define (s2 x) (values (sqrt x) (- sqrt x))) 16:37 rudybot: unkanon2: Done. 16:37 Lajla: THen you can for instance do (compose * true-sqrt) 16:37 Lajla: That will be a function that returns the negative of a number. 16:37 unkanon2: rudybot: (s2 4) 16:37 rudybot: unkanon2: error: -: expects type as 1st argument, given: #; other arguments were: 4 16:37 Lajla: Oh ehh 16:38 Lajla: Made an error 16:38 Lajla: (- (sqrt x)) 16:38 unkanon2: rudybot: (define (s2 x) (values (sqrt x) (- (sqrt x)))) 16:38 rudybot: unkanon2: Done. 16:38 Lajla: Instead of (- sqrt x) of course 16:38 unkanon2: rudybot: (s2 4) 16:38 rudybot: unkanon2: ; Value: 2 16:38 rudybot: unkanon2: ; Value#2: -2 16:38 Lajla: See 16:38 Lajla: Returns two values. 16:38 unkanon2: now hold on 16:38 unkanon2: yeah that was cool 16:38 Lajla: And you can also use the values primitive to let a function return no values at all. 16:38 unkanon2: rudybot: ((compose s2 s2) 16) 16:38 rudybot: unkanon2: error: context expected 1 value, received 2 values: 4 -4 16:38 Lajla: Some implementations do this with side effect functions 16:38 Lajla: end them with (values) 16:38 Lajla: Well, s2 itself takes one argument 16:39 Lajla: THis one tried to give it 2. 16:39 unkanon2: yeah but maybe it would take that one arg and pass it twice 16:39 Lajla: But the reason that in mathematics functions can return only one value is purely notational I guess. 16:39 Lajla: It's how mathematics is written down if any. 16:39 unkanon2: rudybot: (map s2 (s2 16)) 16:39 rudybot: unkanon2: error: context expected 1 value, received 2 values: 4 -4 16:39 Lajla: That initiated that silly idea. 16:40 unkanon2: well I can't really map over something that isn't a list 16:40 Lajla: rudybot: (define (s2 x) (values (sqrt x) (- (sqrt x)))) 16:40 rudybot: Lajla: your sandbox is ready 16:40 rudybot: Lajla: Done. 16:40 Lajla: rudybot: (map s2 '(1 2 3 4)) 16:40 rudybot: Lajla: error: context expected 1 value, received 2 values: 1 -1 16:40 Lajla: Alas, this map does not accept functions which return two values. 16:40 unkanon2: rudybot: (define (s3 x) (list (sqrt x) (- (sqrt x)))) 16:40 rudybot: unkanon2: Done. 16:40 Lajla: In some implementations, the map will then actually return two lists. 16:40 unkanon2: rudybot: (s3 16) 16:40 rudybot: unkanon2: ; Value: (4 -4) 16:40 unkanon2: rudybot: (map s3 (s3 16)) 16:40 rudybot: unkanon2: ; Value: ((2 -2) (0+2i 0-2i)) 16:40 Lajla: THen it returns one value, which is a list. 16:41 unkanon2: right 16:41 Lajla: But the point about writing mathematics as expressions embedded like that into each other is that necessarily a function or expression which has two values at once becomes hard to write down. 16:42 unkanon2: it becomes hard to manage I guess 16:42 Lajla: Schem offers the call-with-values and let-values structures to handle it. 16:42 unkanon2: hard to process its results 16:42 Lajla: They create contexts which can accept multiple values. 16:42 unkanon2: I figured 16:42 unkanon2: but then why not just use a list? 16:42 unkanon2 <3 lists 16:43 Lajla: rudybot: (let-values (((positive negative) (s2 16))) (list positive negative)) 16:43 rudybot: Lajla: ; Value: (4 -4) 16:43 Lajla: Because then there is no way to differentiate between two values and a single value which is a lis. 16:43 Lajla: Or the empty list and a function which returns no values. 16:43 Lajla: Consinder the composition example. 16:44 Lajla: Where you can compose a function whcih takes two arguments onto a function which returns two. 16:44 Lajla: You can't do that anymore then. 16:44 unkanon2: sure there is, you just put them inside a list (to try and emulate haskell's ADTs) 16:44 unkanon2: that's how you differentiate between an empty list and no values 16:45 unkanon2: you just always return the result wrapped in () 16:45 unkanon2: so that now () is no values and (()) is empty list 16:45 unkanon2: sort of like ocaml's some/none 16:45 unkanon2: haskell's just/nothing 16:45 unkanon2: some haskeller's won;t bother with just/nothing so they simply wrap the result in a list 16:46 unkanon2: it achieves the same, basically 16:46 unkanon2: rudybot: ((compose + s2) 16) 16:46 rudybot: unkanon2: ; Value: 0 16:46 unkanon2: oh that is really nice 16:47 unkanon2: indeed, with s3 it wouldn't work 16:47 unkanon2: rudybot: ((compose + s3) 16) 16:47 rudybot: unkanon2: error: +: expects argument of type ; given (4 -4) 16:47 unkanon2: rudybot: ((compose (apply +) s3) 16) 16:47 rudybot: unkanon2: error: apply: expects at least 2 arguments, given 1: # 16:47 unkanon2: rudybot: ((compose '(apply +) s3) 16) 16:47 rudybot: unkanon2: error: compose: expected argument of type ; given (apply +) 16:48 unkanon2: rudybot: ((compose (curry apply +) s3) 16) 16:48 rudybot: unkanon2: ; Value: 0 16:48 unkanon2: there we go 16:48 _p4bl0: I didn't knew about curry 16:48 unkanon2: it's hard to live without sectioned lambdas 16:48 _p4bl0: thanks :-) 16:48 unkanon2: _p4bl0: heheh no problem 16:48 Lajla: unkanon2, you mean that a functin would always return a list? 16:48 unkanon2: ML languages use that a LOT 16:49 unkanon2: Lajla: yes 16:49 Lajla: If a function is unable to return anything other than a list, then the effect is the same really. 16:49 Lajla: And some implementations do this beneath the surface. 16:49 unkanon2: Lajla: do you know Just / Nothing? 16:50 unkanon2: the Maybe ADT 16:50 Lajla: No, what's that? 16:50 unkanon2: that's what I'm sggesting 16:50 _p4bl0: unkanon2: I know for ML (OCaml), I just didn't knew about this racket operator, it's handy and less verbose than using a lambda expr 16:50 carleastlund: In a sense, Scheme is like this. Rest arguments, apply, and call-with-values all expose the fact that multiple-arguments/values can essentially be treated as lists. 16:50 unkanon2: in haskell you have type Maybe x = Just x | 16:50 unkanon2: Nothing 16:50 unkanon2: _p4bl0: oh, Some / None is unrelated to that curry thing :) 16:51 _p4bl0: unkanon2: yep I was still talking about curry ^^ 16:51 unkanon2: _p4bl0: in Haskell instead of (curry apply +) we just do (apply +) because all functions are curried automatically 16:51 Lajla: Yap, you can very well say that in lisp, every function consumes one argument, which is a list. 16:51 unkanon2: _p4bl0: oh I see 16:51 _p4bl0: unkanon2: in OCaml too 16:51 unkanon2: _p4bl0: right :) 16:51 unkanon2: Lajla: but then it doesn't help much :) 16:52 Lajla: unkanon2, functions are curried automatically is just saying 'All functions are 1-argument' 16:52 unkanon2: in haskell functiosn really only consume one argument, which may be a list, but not a list of arguments 16:52 Lajla: Nothing stops you in scheme from defining only 1 argument functions 16:52 unkanon2: Lajla: it's different 16:52 Lajla: The point is that lisp traditioanlly places emphasis on variadic functions 16:52 unkanon2: example: 16:52 unkanon2: right 16:52 unkanon2: and variadic functions are f :: a . b . c . d -> r 16:53 unkanon2: but in haskell every f is :: a -> b -> c -> d -> r 16:53 Lajla: What is the . there? 16:53 Lajla: And Haksell doesn't support variadic functions, does it? 16:53 unkanon2: . is something like cons 16:53 unkanon2: it does 16:53 unkanon2: but it's a pain! 16:54 unkanon2: haskell has printf for instance 16:54 Lajla: Ahhh, it's a sequence? 16:54 unkanon2: but it's painful to implement 16:54 unkanon2: yes 16:54 Lajla: How does it work then? 16:54 Lajla: Why doesn't it curry until the final argument? 16:54 unkanon2: well let me give you an example 16:54 unkanon2: in haskell if I define this: 16:54 unkanon2: add x y = x + y 16:54 unkanon2: then I can do this: 16:54 unkanon2: add_three = add 3 16:54 unkanon2: you see? 16:54 Lajla: Yeah, I know. 16:55 unkanon2: right 16:55 unkanon2: that's because: 16:55 unkanon2: add :: Int -> Int -> Int 16:55 unkanon2: whereas in scheme, 16:55 Lajla: But what you did is aequivalent to add = (\x -> (\y -> x + y)) 16:55 unkanon2: (define (add x y) ...) is really add :: x . y -> result 16:55 unkanon2: yes!! 16:55 unkanon2: that's it 16:55 Lajla: Nothing stops you from doing (define add (lambda (x) (lambda (y) (+ x y))) 16:55 unkanon2: ugliness stops me 16:55 Lajla: Like I said, the thing is that in Haskell, all functions are single argument. 16:55 Lajla: Well, write a macro. :') 16:55 unkanon2: yes 16:56 unkanon2: hahah I will one day 16:56 carleastlund: In at least some Schemes, that's (define ((add x) y) (+ x y)). I know Racket allows that. 16:56 Lajla: Yeah 16:56 unkanon2: wow now that's pretty!! 16:56 unkanon2: is that r5rs? 16:56 unkanon2: that does look nice I must say 16:56 carleastlund: I don't believe it's in any Scheme standard. 16:56 unkanon2: better than nothing 16:56 unkanon2: too bad 16:56 unkanon2: rudybot: (define ((add x) y) (+ x y)) 16:56 rudybot: unkanon2: Done. 16:56 unkanon2: rudybot: (add 2 3) 16:56 rudybot: unkanon2: error: procedure add: expects 1 argument, given 2: 2 3 16:57 Lajla: I think sicp also assumes it. 16:57 unkanon2: rudybot: ((add 2) 3) 16:57 rudybot: unkanon2: ; Value: 5 16:57 Lajla: And racket even does it in R5RS mode. 16:57 Lajla: It's pretty portable. 16:57 unkanon2: that's the problem right there though 16:57 unkanon2: I can't do (add 2 3) 16:57 Lajla: Then do ((add 2) 3) 16:57 carleastlund: Yeah, you gotta pick. Currying or multiple arguments. 16:57 unkanon2: carleastlund: indeed :) 16:58 unkanon2: I don't think there's a compromise between currying and variadic 16:58 unkanon2: maybe 16:58 Lajla: I personally favour the fact that lisp has multiple arguments and multiple return values. 16:58 carleastlund: You can play some tricks with the "curry" function in racket/function, but that's a dangerous tool because it uses dynamic arity checking, which is not guaranteed to work the way you expect. 16:58 Lajla: Because really, if it doesn't, you want infix notation. 16:58 unkanon2: carleastlund: curry is dangerous?? 16:58 Lajla: && (< x y) (< a b) is just too annoying. 16:58 Lajla: x < y && y < z is annoying enough 16:59 Lajla: (< x y z) however is charming. 16:59 unkanon2: oh yeah 16:59 carleastlund: The Racket version is, yes. If you pass a function through another higher order function, or through a contract, or through any kind of wrapper -- the result may have a more permissive arity. 16:59 unkanon2: carleastlund: the curry from srfi-X (I forgot x) is okay though, right? 16:59 carleastlund: Dunno, but probably. 17:00 carleastlund: I have more predictable versions in an unstable library for Racket, but I have not gotten around to promoting them to "real" libraries yet. 17:00 unkanon2: don't take curry away from me :P 17:00 unkanon2: do it then! curry is essential 17:00 Lajla: unkanon2, well, the point is that a curry function is quite easy to make. 17:00 unkanon2: with a lambda? 17:00 unkanon2: then it ain't currying 17:00 Lajla: No, a function that curries. 17:01 unkanon2: oh 17:01 Lajla: (curry + 1 2) 17:01 Lajla: Returns a function which adds 3 to its argument(s) basically. 17:01 unkanon2: yes that's what we're talking about 17:01 Lajla: And you can curry it again if you want. 17:01 unkanon2: the function curry 17:01 unkanon2: carleastlund said it's dangerous in racket 17:01 Lajla: rudybot: (define ((curry f . xs) . ys) (apply f (appnd xs ys))) 17:01 rudybot: Lajla: Done. 17:02 Lajla: Nahh, the curry-lambda, which creates automatically curryable functions is. 17:02 Lajla: But manual currying is fine. 17:02 Lajla: rudybot: (map (curry + 2) '(1 2 3 4 5)) 17:02 rudybot: Lajla: error: reference to undefined identifier: appnd 17:02 Lajla: Oh 17:02 Lajla: rudybot: (define ((curry f . xs) . ys) (apply f (append xs ys))) 17:02 rudybot: Lajla: Done. 17:02 Lajla: rudybot: (map (curry + 2) '(1 2 3 4 5)) 17:02 rudybot: Lajla: ; Value: (3 4 5 6 7) 17:02 unkanon2: oh so curry-lambda is the "macro" that would turn (add x y) into ((add x) y) ?? 17:02 Lajla: THat's what momma's talking about. 17:02 Lajla: unkanon2, well, the other way around. 17:03 unkanon2: hmm 17:03 Lajla: It creates a sophisticated function 17:03 Lajla: which detects if it has received enough arguments 17:03 unkanon2: rudybot: curry-lambda 17:03 rudybot: unkanon2: error: reference to undefined identifier: curry-lambda 17:03 Lajla: थथगLike if you define a curry-lambda with 3 arguments 17:03 Lajla: It returns a function when given 2 arguments. 17:03 (quit) tv|z: Ping timeout: 240 seconds 17:03 Lajla: Which does what you expect when you supply the final one. 17:04 Lajla: But I praefer manual currying. 17:04 unkanon2: I see 17:04 Lajla: Also, because currying in a dynamically typed language is just unsafe. 17:04 Lajla: Because a simple typo if not enough arguments supplied will produce very cryptic errors. 17:04 unkanon2: how is it more unsafe than not having it? 17:04 unkanon2: aww typos scmypos 17:04 Lajla: Manual explicit currying akss you to prove what you are doing. 17:04 Lajla: well, if you provide one argument less. 17:04 Lajla: It will curry it. 17:04 Lajla: Rather than throw you an error. 17:04 unkanon2: yeah but that's the price you pay for awesomeness 17:05 _p4bl0: racket also has case-lambda if you want a function that takes different but known number of parameters 17:05 unkanon2: rudybot: case-lambda 17:05 rudybot: unkanon2: error: eval:1:0: case-lambda: bad syntax in: case-lambda 17:05 (join) tv|z 17:05 Lajla: unkanon2, well, the reason it works in haskell is because haskell is statically typed. 17:06 Lajla: So the typing won't match up in such a typo. 17:06 Lajla: Racket is dynamic, so it will throw you a completely cryptic error at runtime instead of 'blabla, not enough arguments' 17:07 Lajla: Automatic currying in a dynamically typed language is very error prone. 17:07 Lajla: Also a reason I praefer the manual explicit currying with the curry function 17:07 unkanon2: I see 17:07 Lajla: Also, if you really want, you can call the curry function c 17:07 unkanon2: I see your point 17:07 Lajla: Or even $ 17:08 unkanon2: I'll make friends with (curry) 17:08 Lajla: Racket identifers are very liberal. =) 17:08 unkanon2: can they be unicode? 17:08 Lajla: Yap 17:08 Lajla: λ is an identifier. 17:08 Lajla: shorter form of lambda. 17:08 unkanon2: awesome 17:08 Lajla: But not in r5rs 17:08 Lajla: alt-\ produces t, I think. 17:08 unkanon2: right 17:09 unkanon2: I'll define a unicode point that is blank to mean curry :) 17:09 Lajla: I'm not sure if that is accepted. 17:09 Lajla: I think it's limited to the basic multilingual plane. 17:10 Lajla: But I would just take & 17:10 Lajla: Another point though is curry-left 17:10 Lajla: Which curry's it the oher way around. 17:11 unkanon2: I don't know how to do unicode in irssi.. 17:11 Lajla: Very handy with functions that are not commutative. 17:11 carleastlund: rudybot: (define 17:11 carleastlund: rudybot: (( 17:11 Lajla: Ehh 17:11 carleastlund: rudybot: ((( 17:12 carleastlund: rudybot: ((<=c 1)) 17:12 rudybot: carleastlund: error: <: expects at least 2 arguments, given 1: 1 17:12 carleastlund: That's the problem with "curry". 17:12 Lajla: rudybot: (define ((curryl f . xs) . ys) (apply f (append ys xs))) 17:12 carleastlund: (And <=c should have been >=c, oops.) 17:12 rudybot: Lajla: Done. 17:12 unkanon2: what's the problem? 17:12 unkanon2: I never use curry that way 17:13 unkanon2: I never do thisfunction = this other function curried 17:13 unkanon2: I use curry to avoid lambdas 17:13 carleastlund: I didn't use it any "way" other than that I curried something, and supplied some arguments, and it went wrong. 17:13 Lajla: Now for instance (curryl display (current-error-port)) evaluates to a single argument function that writes its argument to the currenr error port. 17:14 Lajla: And I still repeat my statement that implicit currying in a dynamically typed language will read to countless errors and bugs. 17:14 carleastlund: "curry" means "produce a curried version of this function". It also happens that you can use it to partially apply a function, but those two things are not the same. 17:14 unkanon2: I just use it to simulate sectioned lambdas in haskell 17:14 Lajla: Yeah, I guess I used my curry differently. 17:15 unkanon2: in haskell I an do ((+ 1) 2) 17:15 Lajla: My own curry I used in code means 'curry this application', and is an orderinary function 17:15 unkanon2: in scheme I'd do ((curry + 1) 2) 17:15 carleastlund: (curry f x y z) is *almost* the same as (lambda (a b c) (f x y z a b c))... but every once in a while, it's not, and that's the gotcha. 17:15 Lajla: Yeah, but in haskell, ( ...) has a totally different meaning. 17:15 carleastlund: Lajla: one curries functions, not applications. :p 17:15 Lajla: (( ...)) in scheme is very differnt from ( ...) 17:15 unkanon2: carleastlund: but again, that's only racket's curry that is broken, right? 17:15 carleastlund: unkanon2: Correct. 17:16 unkanon2: *whew* 17:16 carleastlund: Well, is not designed as "single-shot partial application". It *is* working as designed, it's just not designed for all possible uses. 17:16 unkanon2: isn't that other bot supposed to be running chicken? 17:16 unkanon2: incubot/ 17:16 unkanon2: ? 17:16 unkanon2: well, obviously you guys wouldn't have it here, with it being the racket channel :) 17:17 Lajla: Well, offby1 made it. 17:17 Lajla: And it used to be called fartbott. 17:17 Lajla: Until people were like 'Nahh, tat's rude dude' 17:17 Lajla: And then he called it 'rudebot' and then they were still 'nahh, that's still to far', so hence the name. 17:17 Lajla: I totally approve of names like fartbot though 17:17 unkanon2: hence rudy? 17:18 unkanon2: lol 17:18 Lajla: yeah 17:18 Lajla: I would so give my bot a silly provocative name like naming him after a famous school shooter. 17:18 Lajla: Or naming him 'tentacleraep' or something like that. 17:19 unkanon2: hahaha 17:19 unkanon2: maybe just name it "whore" so that whenever somebody evaulates something that errors, they could say "damn you dumb whore" 17:20 Lajla: But there are some things to be said for variadic functions 17:20 Lajla: for one, map and zipwith are the same function in scheme. 17:20 unkanon2: yes that threw me off at first! 17:20 unkanon2: I loled 17:20 Lajla: Ahahah, I'd so do that. 17:20 unkanon2: I was like "how do I zipWith in scheme..." 17:20 unkanon2: then I thought "maybe map is variadic too" 17:20 unkanon2: and bingo 17:20 unkanon2: still, I like the name zipWith 17:21 Lajla: I would probably also have some explanation like 'She takes code from everyone and produces a desired result, even total strangers' 17:21 unkanon2: or zip-with for a scheme flavor 17:21 unkanon2: hahah 17:22 Lajla: Like, back at secondary school, we had a deck of cards, we called her Lucy the Whore, because every time we play cards, she proceeded to first get shaken, then spread out, and then shared with the dealer's friends, all without complain. 17:22 unkanon2: lol that's funny 17:23 Lajla: Yeah, it doesn't help that the game we played with her most often was called Souterneur. 17:23 Lajla: Which is french and by extension high-register english for pimp by the way. 17:24 unkanon2: cool 17:25 Lajla: Basically you had three classes of characters, the souteneur, the prostitute, and the clientel, the objective was to become and stay the souteneur, because then you could ask two cards at your descretion from the prostitute every round. 17:25 Lajla: As in, she gives the best she earns to the souteneur. 17:28 Lajla: unkanon2, by the way, another thing of variadic functions is no arguments. 17:28 Lajla: Returned or called with. 17:28 Lajla: OCaml has to solve this by passing and returning unit. 17:28 Lajla: With haskell, as a non-strict language, this is of course not a problem. 17:29 (join) acts_as_david 17:30 unkanon2: how is haskell different from ocaml in that regard? 17:30 unkanon2: haskell also returns () 17:31 Lajla: If a haskell function returns unit, why would it even be evaluated? 17:31 unkanon2: to cause side effects 17:31 Lajla: I'm more talking about print functions and read functions et cetera, which are called for its side effects. 17:31 Lajla: Haskell functions don't do that, right? 17:31 unkanon2: yeah 17:31 unkanon2: functions like putStr return () iirc 17:31 unkanon2: same thing 17:31 Lajla: Well, the scheme standard doesn't define what side effect causing functions return typically. 17:32 Lajla: Doesn't putSTr return a monad? 17:32 unkanon2: no, it executes inside a monad 17:32 unkanon2: the IO monad 17:32 unkanon2: it returns unit 17:32 Lajla: I'm pretty sure that you can do let x = putStr "Hello, Nurse!" in x and get the same effect 17:32 Lajla: Or some arbitrary complex expression 17:33 Lajla: Like (let x = putStr "Hello, Nurse", y = putStr "Hello, Wacko" in if true then x else y) 17:33 Lajla: Surely x and y now contain a different value, for the behaviour depends on the conditional. 17:34 Lajla: If they were type unit, their values were necessarily the same. 17:35 unkanon2: when you do x = putStr "Hello" outside the IO monad then you'll get an IO () everytime 17:35 unkanon2: which can only be eval'ed inside the IO monad 17:35 unkanon2: you can't escape the IO monad! :P 17:35 Lajla: Sure. 17:36 Lajla: But like, putStr :: [char] -> IO () right? 17:36 unkanon2: yeah 17:36 Lajla: IO () != () 17:36 unkanon2: you're confusing what I said 17:36 unkanon2: *inside the IO monad* putStr returns () 17:36 unkanon2: outside it always returns IO () 17:36 Lajla: Hmm 17:36 Lajla: Could be, I am no expert on hoaskell. 17:37 Lajla: I'm actually working on a lazy scheme where I accidentally re-invented some monad-type thing. 17:37 Lajla: When I started it I knew balls about haskell. 17:37 Lajla: Even less than I do now. 17:37 Lajla: well, lazy lsip. 17:37 Lajla: It's not really scheme 17:37 unkanon2: like when you do main = do { x <- putStr "Hello" } x will have () 17:37 unkanon2: see? 17:37 Lajla: Ohhh 17:37 unkanon2: because you called putStr inside the IO monad 17:37 Lajla: You mean if you use >>= 17:37 Lajla: Yeah 17:38 unkanon2: yeah 17:38 Lajla: I'm not sure that I would interpret that as putStr itself _returning_ a unit. 17:38 unkanon2: >>= means still being inside the monad :) 17:38 Lajla: As much as binding it into some other function calls it with a unit. 17:38 unkanon2: yes yes 17:38 unkanon2: semantics 17:38 Lajla: My semantics are better than yours, that is how it goes. 17:39 Lajla: You call it terrorists, I call it freedom fighters, but my semantics are better. 17:39 unkanon2: putStr always returns a () wrapped in the IO monad, to put it technically 17:39 unkanon2: but when you're already working in monadic code then it just returns () 17:39 unkanon2: that's my story and I'm sticking to it 17:39 Lajla: Yeah, I get. 17:39 Lajla: Well 17:40 Lajla: In scheme. 17:40 Lajla: It would just return no argument 17:40 Lajla: And call a no argument function 17:40 Lajla: This actually happens quite often. 17:40 Lajla: Calling no argument functions in scheme 17:40 Lajla: Like ehh (call-with-values f g) 17:40 Lajla: Calls f with no arguments with g as continuation 17:41 Lajla: But like 17:41 unkanon2: hmm I can't wait to really master continuations 17:41 Lajla: () is the empty tuple in haskell, right? 17:41 unkanon2: monads are no fun 17:41 unkanon2: yeah 17:41 unkanon2: its type is () again 17:41 Lajla: continuations are mind boggling, the one thing said more complicated than monads in programming. 17:41 unkanon2: (of course) 17:42 unkanon2: well, understanding continuations I found to be a lot easier than understanding monads 17:42 Lajla: Ah, you already understand them? 17:42 unkanon2: mainly because a monad isn't a thing that can be explained meaningfully 17:42 unkanon2: but continuations are 17:42 unkanon2: I understand what a continuation is and also exactly what call/cc does 17:42 Lajla: Already written some code in ccps? 17:42 Lajla: Ahh 17:42 unkanon2: I understand no other continuation-related function though 17:42 Lajla: I like the fact that in cps, call/cc becomes a simple trival combinator. 17:43 unkanon2: yes, I actually wrote call-cc in lua with the help of a few people more clever than I am :)) 17:43 unkanon2: (Lua only has co-routines and so only one-shot continuations, we wrote full-blown continuations) 17:43 Lajla: Hmm, like in that lazy lisp (scanchar cont) produces an I/O command that proceeds to read a character, and then calls cont with that character as single argument. 17:43 Lajla: And I defined a readline in terms of that. 17:44 Lajla: THat was actually rather complicated and head-scratching to do. 17:44 unkanon2: that's the kind of thing I haven't done yet 17:44 Lajla: The end made me realize just how useful TCO was, because it was quadruple mutually recursive, he result. 17:44 offby1: unkanon2: yeah, I think incubot is chicking. 17:44 offby1: chicken. 17:44 offby1: rudybot of course is racket. 17:44 unkanon2: never really praticed much with continuations aside from implementing them in lua 17:44 unkanon2: offby1: yeah so I heard :) 17:45 unkanon2: they say with continuations you can even implement control structures like if? never done that either, would love to 17:46 Lajla: Hmm, you still need a conditional thing as a primitive. 17:46 Lajla: But basically what some people do is that the cps if takes two continuations. 17:46 unkanon2: right, lest you evaluate all arguments, I' think that too 17:46 Lajla: And depending on its condition chooses which to continue with. 17:47 unkanon2: oh that's far from writing if in terms of continations 17:47 unkanon2: continuations* 17:47 Lajla: Well, basically (if cond then else) will then be written like (cps-if cond (lambda () then) (lambda () else)) 17:47 Lajla: Yeah 17:48 Lajla: But continuations can implement all your other fancy stuff like loops, return statements, breaks, exceptions, gotos... 17:48 unkanon2: I remember using continuations to write a function that would return 1 upon first call, then 2, then 3... forgot what those are called 17:48 unkanon2: but that was probably not necessary since that can be done solely using closures 17:48 Lajla: An impure function? 17:49 unkanon2: oh yeah, baby 17:49 unkanon2: the impurest of the impure 17:49 unkanon2: it never returns the same argument 17:49 unkanon2: (given the same input which was none) 17:51 unkanon2: how do I reset my sandbox with rubybot? 17:51 unkanon2: rudybot: reset 17:51 rudybot: unkanon2: error: reference to undefined identifier: reset 17:51 unkanon2: rudybot: (reset) 17:51 rudybot: unkanon2: error: reference to undefined identifier: reset 17:51 unkanon2: rudybot: dwim 17:51 rudybot: unkanon2: error: reference to undefined identifier: dwim 17:51 Lajla: unkanon2: ((call/cc call/cc) (call/cc call/cc)) 17:51 Lajla: Try to work that one out 17:52 unkanon2: rudybot: call/cc 17:52 rudybot: unkanon2: ; Value: # 17:52 unkanon2: rudybot: ((call/cc call/cc) (call/cc call/cc)) 17:52 unkanon2: :O 17:52 rudybot: unkanon2: error: with-limit: out of time 17:52 unkanon2: prob. some recursive thingy 17:52 Lajla: It doesn't terminate no. 17:53 unkanon2: rudybot: (define tmp print) 17:53 rudybot: unkanon2: Done. 17:53 unkanon2: rudybot: (set! print 0) 17:53 rudybot: unkanon2: error: eval:1:6: set!: cannot mutate module-required identifier in: print 17:53 unkanon2: aww 17:53 unkanon2: racket doesn't allow that 17:53 unkanon2: rudybot: (tmp 6) 17:53 rudybot: unkanon2: ; stdout: "6" 17:54 unkanon2: rudybot: (tmp 6 4 5) 17:54 rudybot: unkanon2: error: print: expects type as 2nd argument, given: 4; other arguments were: 6 5 17:54 Lajla: I think it depends on your settings though 17:55 unkanon2: rudybot: (define (mod-tmp x) (tmp (format "_~A_" x))) 17:55 rudybot: unkanon2: Done. 17:55 unkanon2: rudybot: (mod-tmp "hey") 17:55 rudybot: unkanon2: ; stdout: "\"_hey_\"" 17:55 unkanon2: how do I sandbox a function? 17:55 unkanon2: oh holdon 17:55 unkanon2: got it 17:56 unkanon2: rudybot: (define (mod-tmp x) (let ((blah tmp)) (set! tmp 0) (tmp (format "_~A_" x)))) 17:56 rudybot: unkanon2: Done. 17:56 unkanon2: rudybot: (mod-tmp "hey") 17:56 rudybot: unkanon2: error: procedure application: expected procedure, given: 0; arguments were: "_hey_" 17:56 Lajla: offby1, don't you want to name your bott after me. 17:56 Lajla: Like, bot_named_after_the_magnificent_lajla 17:57 unkanon2: rudybot: (define (mod-tmp x) (let ((blah tmp)) (set! tmp 0) (blah (format "_~A_" x)))) 17:57 rudybot: unkanon2: Done. 17:57 unkanon2: rudybot: (define tmp print) 17:57 rudybot: unkanon2: Done. 17:57 unkanon2: rudybot: (mod-tmp "hey") 17:57 rudybot: unkanon2: ; stdout: "\"_hey_\"" 17:57 unkanon2: rudybot: (mod-tmp "hey") 17:57 rudybot: unkanon2: error: procedure application: expected procedure, given: 0; arguments were: "_hey_" 17:57 unkanon2: grrh 17:58 unkanon2: rudybot: (define (a) (define b 0)) 17:58 rudybot: unkanon2: error: eval:1:0: begin (possibly implicit): no expression after a sequence of internal definitions in: ((define b 0)) 17:58 unkanon2: we can't define globals inside functions? 17:59 Lajla: THey are local to the function body. 17:59 Lajla: It's more that it wants an expression after that. 17:59 unkanon2: yes, but how do I define a global inside a function? 17:59 unkanon2: from inside a function 17:59 jonrafkind: why would you want to do that 17:59 unkanon2: because then I can sandbox functions 18:00 unkanon2: embedded languages do that all the time 18:00 unkanon2: like I can sandbox print to always print with "--->" in front of it 18:00 unkanon2: and completely hide the real "print" from view 18:00 unkanon2: while still keeping a pointer to "print" myself 18:01 jonrafkind: so (define (print x) (printf "--> ~a\n" x)) 18:01 jonrafkind: and provide print to the embedded language 18:01 unkanon2: yeah but after that I can still use printf, see? 18:01 jonrafkind: you know there is a module system right? 18:01 jonrafkind: you can prevent printf from being used 18:01 unkanon2: how? 18:01 jonrafkind: if you define your own language you can control the bindings that the client sees 18:01 jonrafkind: http://docs.racket-lang.org/guide/languages.html?q=language 18:01 unkanon2: I'm talking about something else 18:02 unkanon2: maybe I'm using the wrong terminology here 18:02 unkanon2: Lua can do it 18:02 (quit) mceier: Quit: leaving 18:02 unkanon2: it borrowed its ideas from scheme 18:02 unkanon2: I'm sure scheme can do it to 18:02 unkanon2: in Lua you can redefine print to be print(x) = "--->" + print x - and have it not be recursive 18:02 unkanon2: it's not directly like that but that's the point 18:03 unkanon2: so that now "print" isn't available to the programmer anymore 18:03 jonrafkind: you can do that in racket too, with the module system 18:03 unkanon2: only your modified print is 18:03 jonrafkind: ok so its not as easy as what lua does, but you can still do it 18:03 unkanon2: that's fine, but the point is that's something that can be achieved with closures alone, no need for a module system 18:03 jonrafkind: how does that work anyway, does that mean lua disallows recursion? 18:04 unkanon2: no, there are more steps to it 18:04 unkanon2: you have to do something like: 18:04 unkanon2: begin 18:04 unkanon2: then some code that does 18:04 jonrafkind: oh you can get a reference to print and then mutate the global reference to it 18:04 unkanon2: yes 18:04 jonrafkind: so globally everyone else sees the new print, but locally you see the old print 18:04 jonrafkind: that sounds absolutely horrible 18:04 unkanon2: yes!! 18:05 jonrafkind: i mean, hooray for dynamic languages.. but boo for weird effects 18:05 unkanon2: it's absolutely essential for an embedded language as I'm sure you can appreciate 18:05 unkanon2: how would you do that in scheme? 18:05 lucian: plenty of languages allow that 18:05 jonrafkind: its not essential as you can do it with a module system without global hacks (mutation) 18:05 jonrafkind: ims ure they allow it through mutation 18:05 unkanon2: I'll try and do it in scheme 18:06 unkanon2: when I get home as I need to go now 18:07 unkanon2: it shouldn't be hard 18:07 Lajla: unkanon2, what jon is trying to say is, you can use set! 18:07 Lajla: You just use (define bla) before hand to define it to some empty thing like #void or hwatever the implementation wants. 18:07 unkanon2: yes but I stil can't picture how the function would look like 18:08 jonrafkind: rudybot: (define printf (let ([old-printf printf]) (lambda (str x) (old-printf (string-append "--> " str) x)) 18:08 rudybot: jonrafkind: (...with (define (symbol prefix suffix) (string->symbol (string-append (symbol->string prefix) (number->string suffix)))).) 18:08 unkanon2: oh before the function? right 18:08 (quit) corruptmemory: Quit: Leaving 18:09 jonrafkind: rudybot: (define printf (let ([old-printf printf]) (lambda (str x) (old-printf (string-append "--> " str) x)))) 18:09 rudybot: jonrafkind: your sandbox is ready 18:09 rudybot: jonrafkind: Done. 18:09 unkanon2: jonrafkind: but that function by itself doesn't take care of nullifying the actual printf, right? 18:09 jonrafkind: rudybot: (printf "foo ~a" 2) 18:09 rudybot: jonrafkind: ; stdout: "--> foo 2" 18:09 jonrafkind: hooray 18:09 unkanon2: oh wow! 18:09 unkanon2: that's it! 18:09 jonrafkind: well how can I get to the original printf 18:10 unkanon2: rudybot: (define a printf) 18:10 rudybot: unkanon2: Done. 18:10 unkanon2: rudybot: (define printf 0) 18:10 rudybot: unkanon2: Done. 18:10 jonrafkind: how would the embedded language be used? 18:10 unkanon2: jonrafkind: in games for scripting them, like WoW 18:10 jonrafkind: no i mean phhysically 18:10 jonrafkind: do you (load) the stuff that sets up printf? 18:10 jonrafkind: or do you require the user to manually copy in these definitions into their code? 18:10 unkanon2: oh no, it just gets executed before your script 18:11 jonrafkind: by whom? 18:11 jonrafkind: so the script is (load)'d ? 18:11 unkanon2: by the game 18:11 unkanon2: got it? 18:11 jonrafkind: you could instead do #lang my-scripting-language (printf "foo"), and that printf is the one that adds --> 18:12 unkanon2: I don't fully understand #lang yet 18:12 unkanon2: gtg now 18:12 unkanon2: will be home soon :) 18:12 unkanon2: see you guys, you guys are fun 18:12 (quit) lucian: Remote host closed the connection 18:12 Lajla: jonrafkind, we are fun. 18:12 Lajla: It has been written 18:12 jonrafkind: the point is #lang sets up almost everything about your language 18:13 jonrafkind: but you can use a bunch of tools to use pre-existing stuff so you don't have to do 900 years worth of work 18:13 Lajla: This coming from the guy who thinks long-and-descriptive-variable-names-are-good. 18:13 jonrafkind: i also like ice cream 18:14 Lajla: jonrafkind, why not replace + with (addition-function 1 2 3) 18:14 Lajla: Or make reader syntax for numbers in natural language. 18:14 Lajla: one two eleven, two-hundred-and-five 18:14 jonrafkind: my only concern is (needless) abbreviation 18:16 Lajla: I think Scheme should be written like: open-bracket open-bracket call-with-current-continuation call-with-current-continuation closing-bracket open-bracket call-with-current-continuation call-with-current-continuation closing-bracket closing-bracket 18:16 Lajla: Don't you think so? 18:16 Lajla: After all, people new to scheme might not know what ( as a token means. 18:17 Lajla: Better that we use a more descriptive name. 18:17 jonrafkind: you have yet to misspell an english word while typing on irc, yet you agree with me that programming and natural language are designed to communicate firstly 18:17 jonrafkind: so while you tease me about this, secretly you agree with me 18:18 Lajla: Freud would have agreed. 18:18 _p4bl0: haha 18:18 Lajla: With your elegant logic. 18:18 _p4bl0: Lajla: you mean "Frd wd hv agrd" 18:21 (quit) MayDaniel: 18:21 (quit) acts_as_david: Quit: acts_as_david 18:24 Lajla: _p4bl0, I mean he likes his psychoanalytical garbage. 18:34 (join) acts_as_david 18:34 (quit) acts_as_david: Client Quit 19:07 (quit) mheld: Ping timeout: 240 seconds 19:33 (join) acts_as_david 20:00 jonrafkind: how do you queue a repaint event for gui objects? 20:03 samth: jonrafkind, i'd ask matthew 20:03 jonrafkind: argh 20:05 (quit) abbe: Read error: Operation timed out 20:08 (join) abbe 20:09 _p4bl0: jonrafkind: don't you just need to send "on-paint" to the object ? 20:09 jonrafkind: no its more complicated because i dont have the arguments to send to on-paint (like a dc) 20:12 _p4bl0: jonrafkind: on-paint doesn't take any argument 20:14 _p4bl0: jonrafkind: on-paint causes the repaint callback for the object to be called with the appropriate arguments (canvas and dc for instance) 20:15 jonrafkind: where do you see that 20:15 _p4bl0: in my code ^^ 20:15 jonrafkind: oh in a canvas 20:15 _p4bl0: and in the doc 20:16 _p4bl0: jonrafkind: yes 20:16 _p4bl0: jonrafkind: I think on-paint is defined in canvas<%> it's not avail in "only"* window% 20:18 _p4bl0: and IIRC the doc say that canvas% subclassing is the way to go to handle events, but I'm not very sure of that 20:29 (quit) jonrafkind: Read error: Operation timed out 20:35 (quit) masm: Quit: Leaving. 20:44 (quit) carleastlund: Quit: carleastlund 20:52 (quit) acts_as_david: Quit: acts_as_david 21:12 em: bremner: do you think you could make a PPA for the latest racket until Ubuntu puts it in the repo? 21:31 (join) mwolfe 21:42 bremner: em: sorry, I don't use Ubuntu, so I wouldn't be the right person to do that. But I don't mind answering questions if some Ubuntu user wants to make a PPA. 21:58 Lajla: Only gNewSense is truly free. 21:58 Lajla: Don't let your freedom be taken away. 22:45 (quit) parcs: Ping timeout: 240 seconds 22:46 (join) parcs 23:22 (join) mheld 23:44 (join) jonrafkind 23:46 jonrafkind: _p4bl0, fwiw, matthew told me to use `refresh' on a canvas instead of sending it on-paint directly 23:47 jonrafkind: hm, but you have to send it a bunch of parameters which might be annoying to get 23:52 (quit) mheld: Quit: mheld