00:00 (join) vipjun 00:09 (quit) zyoung: Remote host closed the connection 00:09 (join) bjz 00:11 (quit) yacks: Ping timeout: 276 seconds 00:14 (quit) Kaylin: Quit: Leaving. 00:24 (join) brum 00:31 (quit) brum: Remote host closed the connection 00:33 (join) jojo_ 00:36 (join) noam__ 00:39 (quit) noam_: Ping timeout: 256 seconds 00:54 (join) jao 00:54 (quit) jao: Changing host 00:54 (join) jao 00:56 (join) mithos28 01:01 (quit) mithos28: Quit: mithos28 01:12 (join) mithos28 01:12 (join) yacks 01:24 (quit) mceier: Quit: leaving 01:26 jojo_: Anyone know why I might be getting ptr-set!: given value does not fit primitive C type, C type: _double*, given value: #t, from the (send region% in-region x y) function? 01:28 (quit) Fare: Ping timeout: 260 seconds 01:41 (join) vkz 01:46 asumu: jojo_: that sounds possibly like a bug. Can you report it? (either via DrRacket or the web interface) 01:46 asumu: jojo_: you're not using the FFI right? Just the racket/draw library? 01:46 (join) basdirks 01:48 jojo_: yeah, just racket/draw 01:49 jojo_: I've been thinking its a problem with my drawing canvas but can't track it down, I'll report if its not my error 01:50 mithos28: asumu: you claimed me adding the type bound to the tvars is unsound. Is that the same issue that you reported with map? 01:51 mithos28: This line is doing it very similarly to the way I did it, https://github.com/plt/racket/blob/master/collects/typed-racket/typecheck/tc-lambda-unit.rkt#L173 01:51 rudybot: http://tinyurl.com/abdwmc3 01:53 asumu: mithos28: it's not exactly the same issue, but it's related. I used to think the map special case was sound, but while I was coming up with the counterexample for your line, I found that it was broken too. 01:54 asumu: That `rest-type` line is suspicious, but since it's not type-checking a body I think it may be fine. 01:55 asumu: Also, polydots is tricky because its scoping is currently still broken too. Unfortunately, I think type variables need some deeper fixes to work properly. 01:56 mithos28: Do we have a model of what correct scoping should be? 01:59 asumu: We don't. But at the very least, every (All (a) ...) should introduce a new lexical scope for the body it annotates. 01:59 asumu: (and similarly with define:, pdefine:, etc.) 01:59 asumu: Right now, this is not the case with polydots. 01:59 (join) karswell 02:01 mithos28: What does it mean for a type to annotate an expression? if it is used as an expected type for that expression? 02:03 (quit) vkz: Quit: vkz 02:04 asumu: To a first approximation. Though I think that's probably not a precise enough definition. For example, suppose there's (: f (All (a) (a -> a))) 02:04 asumu: and (define f (let () (: x (Option a)) (define x #f) ... some function ...)) 02:04 asumu: The type variable `a` should not be bound in the let. 02:05 asumu: (it should be bound in the function though) 02:06 asumu: Anyhow, I've got to go to sleep. If you have any questions, I'll answer them later if you PM me them. 02:06 mithos28: k 02:07 mithos28: I'll think about that example, because I don't like that polymorphism is limited to functions 02:12 (quit) jao: Ping timeout: 256 seconds 02:17 (quit) basdirks: Ping timeout: 256 seconds 02:17 (quit) rohni: Quit: Leaving. 02:19 (quit) jonrafkind: Ping timeout: 248 seconds 02:23 (join) mceier 02:33 (join) rohni 02:39 (quit) ASau: Ping timeout: 264 seconds 02:51 (quit) racycle: Quit: racycle 02:55 (join) basdirks 03:09 (join) cdidd 03:15 (quit) mithos28: Quit: mithos28 03:20 (join) racycle 04:15 (quit) racycle: Quit: racycle 04:21 (join) anonymous97890 04:28 (join) noelw 04:29 (join) wsun 04:46 (quit) anonymous97890: Ping timeout: 240 seconds 04:54 (join) BakaKuna 04:55 (quit) TheGhostinaor: 04:55 (join) TheBeerinator 04:59 (quit) tobih: Remote host closed the connection 05:00 (join) tobih 05:11 (quit) sirdancealo2: Ping timeout: 255 seconds 05:14 (join) bitonic 05:21 (quit) bitonic: Ping timeout: 250 seconds 05:32 (join) vkz 05:45 (join) bitonic 06:18 (join) Icarot 06:33 (join) soegaard 06:45 (quit) yacks: Ping timeout: 272 seconds 06:50 (join) jeapostrophe 06:50 (quit) jeapostrophe: Changing host 06:50 (join) jeapostrophe 07:07 (quit) soegaard: Quit: soegaard 07:17 (join) yacks 07:25 (quit) bjz: Read error: Connection reset by peer 07:25 (join) bjz_ 07:51 (quit) BakaKuna: Ping timeout: 252 seconds 07:59 (join) Aune 08:07 (join) mizu_no_oto 08:11 (join) dzhus 08:12 (quit) yacks: Ping timeout: 260 seconds 08:14 (join) cnonim 08:15 cnonim: hi all 08:15 cnonim: how i can get arity or required args of some function? 08:15 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 08:16 (join) sirdancealo2 08:18 (join) mizu_no_oto 08:23 (join) yacks 08:28 (join) RacketCommitBot 08:28 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/wAyirw 08:28 RacketCommitBot: racket/master 9e0e2b9 Matthew Flatt: scribble/srcdoc: add `begin-for-doc' 08:28 RacketCommitBot: racket/master 81a0451 Matthew Flatt: ffi/unsafe/objc... 08:28 RacketCommitBot: racket/master 454f4c3 Matthew Flatt: slideshow: add `interactive'... 08:28 (part) RacketCommitBot 08:37 (quit) dzhus: Ping timeout: 250 seconds 08:40 (quit) Icarot: Ping timeout: 276 seconds 08:43 (quit) Aune: Quit: Hath Deprated 08:47 (quit) cored: Ping timeout: 248 seconds 08:49 (join) cored 08:49 (quit) cored: Changing host 08:49 (join) cored 08:49 (quit) bitonic: Ping timeout: 250 seconds 08:54 (join) zyoung 09:05 (join) didi 09:13 (join) serhart 09:17 (join) Fare 09:23 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 09:27 (join) bitonic 09:32 Nisstyre: cnonim: procedure-arity 09:36 (join) mizu_no_oto 09:58 (quit) bitonic: Remote host closed the connection 09:59 (join) bitonic 10:00 (join) BakaKuna 10:05 (join) racycle 10:13 (join) ASau 10:20 (join) sstrickl 10:20 (quit) sstrickl: Changing host 10:20 (join) sstrickl 10:21 (join) soegaard 10:27 cnonim: how i can mark some stuff and check if this stuff marked then do some work with this stuff? 10:30 cnonim: example: i have list of some values 10:32 cnonim: and i do (map (lambda (v) (if (foo? v) v (mark v)) (list ...values)) 10:33 cnonim: then id do (map (lambda (v) (if (marked? v) (bar v) v) (list ...marked-values)) 10:34 didi: cnonim: Why don't you use `filter'? 10:34 (quit) sirdancealo2: Ping timeout: 255 seconds 10:34 cnonim: what should be 'mark' and 'marked?' ? 10:36 cnonim: didi: there's really not a list? i have some function which should return simple value or marked value 10:37 didi: rudybot: (map sqrt (filter even? (list 1 2 3 4))) 10:37 rudybot: didi: your sandbox is ready 10:37 rudybot: didi: ; Value: (1.4142135623730951 2) 10:37 cnonim: and then i should check which value get 10:40 cnonim: question is not how to filter values 10:41 cnonim: the question is how to mark the value to add some attribute which can then be checked 10:44 cnonim: i can create some struct like 'Marked' whick hold actually value and then check if i got this struct or anyghing else 10:45 cnonim: but thought maybe there is a better solution to this problem 10:47 didi: cnonim: Well, if you insist, you might want to create a vector, with the same size of your list, and mark the individual positions. 10:48 (quit) jeapostrophe: Ping timeout: 256 seconds 10:49 didi: This reminds me of file systems. 10:50 (quit) noelw: Quit: noelw 10:51 cnonim: yes I can, but the best way to mark, structure, or may be a pair of value and a some symbol or any other solution 10:52 (quit) ambrosebs: Remote host closed the connection 10:55 (quit) bitonic: Ping timeout: 276 seconds 11:00 (join) mithos28 11:00 (quit) basdirks: Ping timeout: 240 seconds 11:01 cnonim: i have functions which parses input and store some result in list 11:01 cnonim: these functions processed sequentially 11:02 cnonim: but some function doesn't return anything 11:03 cnonim: what should store in list for them? 11:03 (quit) rohni: Quit: Leaving. 11:06 cnonim: i thought storing last result it possible solution problem 11:07 cnonim: but in the list have duplicates 11:07 soegaard: cnonim: Store the marked values in an eq-hashtable. Then mark stores an element in the hash table and marked? simply looks it up. 11:07 soegaard: If you are worried about garbage collection use a weak hashtable. 11:09 cnonim: exactly 11:09 (quit) mceier: Quit: leaving 11:10 cnonim: i can store value in hashtable with random created key and store this key in list 11:11 soegaard: Btw. You mentioned parsing. If your objects are syntax-objects you can use syntax-properties to store extra information. 11:13 (join) bitonic 11:14 cnonim: example of parsing sequence 11:15 cnonim: (((get-sequence (get-string "hello") (get-char #\ ) (get-string "world")) get-true) '() '() input 0) 11:15 cnonim: it's return 11:16 cnonim: '("hello" #\space "world") 11:16 soegaard: asumu: https://gist.github.com/soegaard/5117604 11:16 cnonim: if input it's "hello world" 11:17 (join) anRch 11:17 cnonim: and if add epsilon to sequence 11:17 soegaard: You can use '("hello" #\space "world") as the key in the hash table. 11:17 cnonim: (((get-sequence (get-string "hello") get-epsilon (get-char #\ ) (get-string "world")) get-true) '() '() input 0) 11:17 cnonim: then result it's 11:18 cnonim: '("hello" "hello" #\space "world") 11:18 soegaard: Actually if you only want to know whether it is marked or not, you can store the marked values in a set. 11:19 cnonim: but i need 11:19 cnonim: '("hello" (marked "hello") #\space "world") 11:19 (join) jbclements 11:19 (join) Kaylin 11:19 cnonim: and them i can replace value before marked with market 11:20 cnonim: *marked 11:20 cnonim: and got 11:20 cnonim: '("hello" #\space "world") 11:20 asumu: soegaard: (add1 soegaard) 11:22 (quit) BakaKuna: Ping timeout: 245 seconds 11:22 soegaard: asumu: It's just, well, it is a solution I would have chosen, if it weren't for the task description. 11:22 soegaard: "it is not" 11:22 cnonim: soegaard: i understand you idea? i store "hello" in dictionary with random created key and store in list what key 11:23 cnonim: '("hello" keyRND #\space "world") 11:23 soegaard: Why do you need the random key? 11:24 cnonim: how to distinguish between "hello" and (marked "hello")? 11:28 (join) yeboot 11:29 yeboot: So the other day I tried making racket code to accept or call a function pointer returned by C code 11:29 yeboot: that was fun 11:30 stamourv: yeboot: Did it work? 11:31 stamourv never used the Racket FFI. 11:31 yeboot: no, although I got it to see the pointer after a lot of hacking 11:31 yeboot: then again I was doing it on purpose to stretch the limits of the ffi 11:34 (quit) Kaylin: Ping timeout: 264 seconds 11:34 soegaard: cored: If the strings are uninterned, then the are not eq? . So if you are using an eq-hash the hashtable can tell the difference. 11:34 cored: soegaard: what? 11:34 soegaard: rudybot: eval (eq? (string #\f #\o #\o) (string #\f #\o #\o)) 11:34 rudybot: soegaard: your sandbox is ready 11:34 rudybot: soegaard: error: : undefined; cannot reference an identifier before its definition in module: 'program 11:35 soegaard: cored: sorry that was for cnonim 11:36 soegaard: rudybot: eval (eq? (string #\f #\o #\o) (string #\f #\o #\o)) 11:36 rudybot: soegaard: ; Value: #f 11:36 cored: soegaard: ok 11:36 (quit) mizu_no_oto: Quit: ["Textual IRC Client: www.textualapp.com"] 11:37 yeboot: rudybot: "hello world" 11:37 rudybot: yeboot: your sandbox is ready 11:37 rudybot: yeboot: ; Value: "hello world" 11:40 cnonim: racycle: (define end-of-input (lambda () #f) 11:40 cnonim: ups 11:40 cnonim: rudybot: (define end-of-input (lambda () #f)) 11:40 rudybot: cnonim: your sandbox is ready 11:40 rudybot: cnonim: Done. 11:41 didi: rudybot: (let ((h "hello, world") (e "hello, world")) (eq? h e)) 11:41 rudybot: didi: If you're talking about getting a *different* binding in, then the answer to samth is "no, they're not `eq?'", and that runs into other problems: specifically, requiring two modules that provide different `+'s. 11:41 didi: rudybot: eval (let ((h "hello, world") (e "hello, world")) (eq? h e)) 11:41 rudybot: didi: your sandbox is ready 11:41 rudybot: didi: ; Value: #t 11:41 didi: That's weird. 11:43 cnonim: (define input (let* ([in (string->list "hello world")] [sz (length in)]) (lambda (i) (if (> i sz) end-of-input (list-ref in i))))) 11:43 cnonim: rudybot: (define input (let* ([in (string->list "hello world")] [sz (length in)]) (lambda (i) (if (> i sz) end-of-input (list-ref in i))))) 11:43 rudybot: cnonim: Done. 11:44 cnonim: (define get-true (lambda ($last input position) $last)) 11:44 cnonim: rudybot: (define get-true (lambda ($last input position) $last)) 11:44 rudybot: cnonim: Done. 11:44 cnonim: ((get-true) '() input 0) 11:44 cnonim: rudybot: ((get-true) '() input 0) 11:44 rudybot: cnonim: error: get-true: arity mismatch; the expected number of arguments does not match the given number expected: 3 given: 0 11:44 bartbes: yeboot: why would that be a problem? 11:44 stamourv: didi: String literals are interned. IIRC that's a recent change. 11:44 bartbes: I imagine the ffi uses function pointers anyway 11:45 cnonim: rudybot: (get-true '() input 0) 11:45 rudybot: cnonim: ; Value: () 11:45 yeboot: bartbes why would what be a problem 11:45 yeboot: calling function pointers 11:45 yeboot: ? 11:45 yeboot: there's no type for them 11:46 bartbes: that's awkward 11:46 yeboot: they're normally bound with a call 11:46 yeboot: functions I mean 11:46 didi: stamourv: oic. I was revisiting my prior understanding of `eq?' and friends. 11:46 stamourv: didi: `eq?' is a very risky thing to rely on. 11:47 cnonim: rudybot: (define get-any (lambda (next) (lambda ($last input position) (let ([$last (input position)]) (if (eq? $last end-of-input) #f (next $last input (add1 position))))))) 11:47 rudybot: cnonim: Done. 11:47 stamourv: It's usually ok to use it as a shortcut, e.g. when checking for something in a cache, and if you don't find it, compute the result. 11:47 cnonim: ((get-any get-true) '() input 0) 11:48 cnonim: rudybot: ((get-any get-true) '() input 0) 11:48 rudybot: cnonim: ; Value: #\h 11:48 stamourv: But depending on it to distinguish two objects is risky, except for objects whose identity is part of their interface, e.g. boxes. 11:48 cnonim: rudybot: ((get-any (get-any get-true)) '() input 0) 11:48 rudybot: cnonim: ; Value: #\e 11:48 asumu: (eq? #&5 #&5) 11:48 asumu: rudybot: (eq? #&5 #&5) 11:48 rudybot: asumu: your sandbox is ready 11:48 rudybot: asumu: ; Value: #f 11:49 didi: stamourv: Well, I find it useful for checking if two objects are the same. Or at least, I used to find. 11:49 stamourv: didi: "The same" is a very tricky concept. 11:49 asumu sort of expected #&5 to be eq? to #&5, but nope 11:49 didi: stamourv: True. 11:49 stamourv: Do you want intensional equality? Extensional equality? 11:49 stamourv: Something else entirely? 11:50 didi: stamourv: "The same" as in pointer "the same". 11:50 stamourv: `eq?' will reliably give you that. The 11:51 didi: stamourv: That's why I was surprised with my `let' example. 11:51 stamourv: "lossiness" comes from the fact that Racket often doesn't offer guarantees about what things can share pointers. 11:51 stamourv: IMO, that's the right thing because it frees up the implementation to translate your code more efficiently. 11:53 (quit) soegaard: Quit: soegaard 11:54 (join) shriphani 11:57 cnonim: guys, can you try run with https://gist.github.com/cNoNim/bf426f3c27bfa12ed53d 11:58 cnonim: and tellmy how i can rewrite get-epsilon to remove duplicates 11:58 cnonim: *tell me 11:59 stamourv: cnonim: Have you heard of the design recipe? (from HTDP) 12:00 cnonim: yes :) 12:00 stamourv: Great! 12:00 stamourv: So, where are your contracts, purpose statements and tests? 12:00 (join) jeapostrophe 12:00 (quit) jeapostrophe: Changing host 12:00 (join) jeapostrophe 12:01 stamourv: Without those, figuring out what your code is doing is very hard. 12:02 (quit) didi: Ping timeout: 248 seconds 12:13 (join) RacketCommitBot 12:13 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/DMuppA 12:13 RacketCommitBot: racket/master df581c3 Eric Dobson: Remove unused argument to tc/rec-lambda/check. 12:13 RacketCommitBot: racket/master 1fd21ef Eric Dobson: Avoid TR internal error, by checking shape of args. 12:13 RacketCommitBot: racket/master 1334e8d Eric Dobson: Reduce usage of check-below.... 12:13 (part) RacketCommitBot 12:14 (join) didi 12:14 (quit) yeboot: Quit: bye 12:16 cnonim: how write contract for variadic function? 12:16 stamourv: rudybot: doc ->* 12:16 rudybot: stamourv: your sandbox is ready 12:16 rudybot: stamourv: http://docs.racket-lang.org/reference/function-contracts.html#(form._((lib._racket%2Fcontract%2Fbase..rkt)._-~3e*)) 12:19 (join) jonrafkind 12:22 (join) mceier 12:29 cnonim: is that https://gist.github.com/cNoNim/bf426f3c27bfa12ed53d better? 12:30 (join) basdirks 12:31 (join) dauterive 12:31 cnonim: stamourv: how i can use template of contract for reduce contract size? 12:33 (quit) sizz: Read error: Operation timed out 12:34 (join) sizz 12:36 stamourv: cnonim: That's better already. But where are your purpose statements? 12:37 stamourv: Re contract templates: Contracts are values, you can bind them to variables. 12:37 stamourv: rudybot: (define my/c (-> integer? char?)) 12:37 rudybot: stamourv: Done. 12:38 cnonim: what is a purpose statements? 12:39 stamourv: They're the second step of the design recipe. 12:40 stamourv: cnonim: http://www.ccs.neu.edu/home/matthias/HtDP2e/index.html 12:40 (quit) jojo_: Ping timeout: 245 seconds 12:41 (quit) anRch: Quit: anRch 12:55 (join) jao 12:55 (quit) jao: Changing host 12:55 (join) jao 13:00 (quit) bitonic: Ping timeout: 248 seconds 13:01 (quit) didi: Ping timeout: 272 seconds 13:03 cnonim: stamourv: https://gist.github.com/cNoNim/bf426f3c27bfa12ed53d now? 13:06 (join) rohni 13:19 (quit) jbclements: Quit: jbclements 13:21 (quit) jeapostrophe: Ping timeout: 255 seconds 13:22 (join) anRch 13:25 (join) didi 13:33 (quit) rohni: Quit: Leaving. 13:40 sstrickl: stamourv: going to look at implementing that solution I forwarded you this afternoon, if you haven't already been working on it yourself 13:40 sstrickl: stamourv: (want to make sure I'm not duplicating work if you've already started) 13:44 (join) rohni 13:48 stamourv: cnonim: Looking at it now. 13:48 stamourv: sstrickl: I haven't really started. Focusing on an ICFP submission. 13:48 sstrickl: stamourv: okay, just making sure. I'll see what I can do this afternoon, then let you know where that stands if I finish or have to stop for now. 13:49 stamourv: sstrickl: Sounds good. 13:49 stamourv: Thanks! 13:49 (join) jeapostrophe 13:49 (quit) jeapostrophe: Changing host 13:49 (join) jeapostrophe 13:50 stamourv: cnonim: Looks much better, yes. :) 13:50 stamourv: Even better would be to have a purpose statement for the whole module, too. 13:51 stamourv: I infer that you're implementing finite state automata, but it would be nice to say so explicitly. 13:58 (join) mizu_no_oto 14:00 (join) sirdancealo2 14:07 greghendershott: eli: asumu: Weird timing. Just yesterday I used span and break from srfi/1. First time ever using anything from that. 14:08 (quit) jonrafkind: Ping timeout: 256 seconds 14:16 eli: greghendershott: Nice timing indeed. 14:20 asumu: greghendershott: yeah, the goal is that you don't have to require SRFIs. 14:20 asumu wants to replace srfi/19 in the distant future 14:23 (quit) anRch: Quit: anRch 14:23 eli: asumu: BTW, since I'm waiting for something else, I'm hacking more on it now. 14:23 asumu: eli: on `takef` and friends? 14:24 (join) dyoo 14:24 eli: Yes. 14:25 asumu: Ok, sounds good. I'm assuming from the radio silence that there are no objections. 14:27 (join) jonrafkind 14:34 greghendershott: asumu: That sounds great. (assuming they're not renamed rrfi's) 14:35 greghendershott: I've skimmed just a very little Clojure code lately, and what I've read seems idiomatic to use srfi/1-sh funcs quite a bit. 14:36 greghendershott: I think that's what prompted me to stop starting to write span from scratch, and think to look for equivalent. 14:37 greghendershott: As much as I feel like I've learned, so far, I'm still peeling the Racket onion 14:38 eli: greghendershott: In this case you're getting into fresh onion layers... 14:39 greghendershott: ^ In a good way. Can get things done, but still having happy discoveries. 14:39 greghendershott: eli: I like fresh onions. Thank you. 14:40 eli: :) 14:45 (quit) dyoo: Quit: dyoo 14:47 (quit) sirdancealo2: Ping timeout: 260 seconds 14:54 (join) dyoo 15:12 (quit) jonrafkind: Ping timeout: 260 seconds 15:13 (quit) rohni: Quit: Leaving. 15:30 (quit) Fare: Ping timeout: 260 seconds 15:31 (quit) dauterive: Read error: Connection reset by peer 15:33 (join) rohni 15:43 (join) Fare 15:48 (join) dauterive 15:53 (quit) Nisstyre: Quit: Leaving 15:55 (quit) mario-goulart: Read error: Connection reset by peer 15:56 (join) mario-goulart 15:58 (quit) mizu_no_oto: Quit: ["Textual IRC Client: www.textualapp.com"] 16:01 (quit) yacks: Quit: Leaving 16:02 (join) rich1 16:24 (quit) jeapostrophe: Ping timeout: 252 seconds 16:24 (join) Icarot 16:38 (nick) pono -> pono_yolosl 16:39 (quit) rohni: Quit: Leaving. 16:42 rich1: as a learning exercise would it be a lang reader or macro to enable mathematica like function chaining... 16:42 rich1: foo[a, b, c] // bar => bar[foo[a, b, c]] 16:43 rich1: so in racket (foo a b c) // bar => (bar (foo a b c)) 16:43 (join) rohni 16:48 stamourv: rich1: I'd say it's probably easier to implement as a macro. 16:48 stamourv: You'd need to wrap the region that uses that notation in an invocation of the macro, though. 16:49 stamourv: If you're looking for something more challenging, but probably nicer to use, you could implement a custom reader. 16:49 didi: rich1: For the functionality, you can take a look into `compose'. 16:49 stamourv: If you go down that road, good examples would be dyoo's excellent brainfudge tutorial, the at-exp syntax that comes with Racket, and asumu's sweet expressions package on PLaneT. 16:50 rich1: stamourv: just trying to keep things simple at the moment while i'm getting to grips with racket 16:50 stamourv: rich1: Ok, then the first option is probably easiest. 16:50 rich1: cool. 16:51 stamourv: You'd have a macro `mathematica', that you could use like that: 16:51 stamourv: `(mathematica (foo a b c) // bar)' 16:51 stamourv: It would traverse its input, looking for `//', and rearrange the pieces. 16:52 stamourv: For bonus points, you could allow multiple `//' and build a pipeline. 16:52 rich1: sounds like a plan - here comes my 1st macro (hopefully) 16:53 stamourv: :D 16:53 stamourv: Have you read greghendershott's Fear of Macros guide? 16:53 stamourv: I recommend it. 16:53 rich1: no, searching... 16:53 (join) mizu_no_oto 16:54 stamourv: http://www.greghendershott.com/fear-of-macros/ 16:54 rich1: thanks. i just remember reading in the style guide use procedures instead of macros if possible 16:55 stamourv: Yep, that's a good rule of thumb. 16:55 stamourv: Macros are harder to debug than functions, and they can't be passed around like functions can. 16:56 stamourv: But, there are many things that functions can't do, that only macros can. 16:56 rich1: like, if ? 16:56 stamourv: So basically, unless you're trying to do one of these things, you're better off sticking with functions. 16:56 stamourv: Yes, `if' is an example. 16:56 stamourv: More generally, anything that introduces an exception to the rule "arguments must be evaluated". 16:57 stamourv: There are other things that only macros can do, like abstracting over binding of variables, introducing new syntax (which is what you're doing, with your infix composition syntax), etc. 16:58 rich1: i always add (require rackunit) 1st and do my tests - for my tests will i have to compare a quoted expression against the macro application? 16:58 stamourv: But in general, before you write a macro, it's always a good idea to ask yourself "could I do this with a function instead?". Often, the answer is yes, especially with higher-order functions. 16:58 (quit) mizu_no_oto: Ping timeout: 276 seconds 16:59 stamourv: Testing macros is hard, and we don't have a definitive solution yet. 16:59 stamourv: ryanc's been working on it, though, and I think some of that work is available in the `unstable' collection. 16:59 rich1: eg. (check-equals? '(bar (foo a)) (mathematica (foo a) // bar)) 17:00 stamourv: That won't work, macros operate on richer data structures than s-expressions. 17:00 stamourv: For simple macros, testing the macro by testing its expansion usually works. 17:01 (join) mizu_no_oto 17:01 stamourv: So, in that case, you'd check that, if you apply them to the same argument, `(bar (foo a))' and `(mathematica (foo a) // bar)' give the same answer. 17:01 rich1: right ok 17:02 stamourv: For more complicated macros, there are other more complicated testing methods that give you more guarantees, but don't worry about it for now. 17:03 stamourv: For example, Typed Racket is implemented as 5k+ lines of macros, and we want some pretty strong guarantees about how it expands, so we need to do more. 17:03 stamourv: But I recommend starting simple. :) 17:05 rich1: i haven't got to Typed Racket yet - how does it compare to racket with contracts? 17:05 rich1: i assume contracts are still good in typed racket 17:07 stamourv: Typed Racket checks types at compile time, unlike contracts. It also catches errors even if they wouldn't actually happen when running the program. Contracts only catch bugs if you do end up calling the function with erroneous inputs (or if it does produce erroneous output). 17:08 stamourv: When you write contracts, you can use arbitrary Racket functions, which means that you can check pretty complicated properties, e.g. if a list is sorted. Types in TR are a lot more expressive than in most typed languages, but still have limits. 17:09 stamourv: As for mixing contracts and types, there's not a good way to do it yet. That's on the to-do list. :) 17:09 (quit) cored: Remote host closed the connection 17:09 (join) cored 17:11 cnonim: I first write the solution using a function, then rewrite using macros, for better performance at runtime 17:11 rich1: stamourv: cool 17:12 stamourv: cnonim: Be very careful with that. It's *really* easy to introduce bugs when you do that. 17:12 cnonim: exactly ) 17:12 rich1: cnonim: what sort of scale improvement? 1%? i was happy using the optimisation coach in drracket that it inlines stuff on its own 17:13 stamourv: I recommend using the Optimization Coach to make sure that manual inlining is really necessary, i.e. the compiler doesn't automatically inline already. 17:13 stamourv: rich1: Re improvements: They can be significant. I've seen 60+%. 17:13 rich1: s/1%/1%,10%,50%? 17:13 rich1: ah ok 17:14 stamourv: rich1: Re Optimization Coach: it doesn't actually do the inlining, it only reports what the Racket compiler does. 17:14 stamourv: And recommends manual transformations you can do yourself it you want even more performance. 17:14 stamourv: cnonim: Re using macros for performance: Do you know about `define/inline'? 17:15 cnonim: stamourv: it's not only inline 17:15 stamourv: It does the job of writing the macro for you. It has the exact same interface as `define', but defines a macro instead. 17:16 stamourv: cnonim: Right, you can also do optimization as part of the expansion, but often the main benefit of using macros is the inlining. 17:16 stamourv: Inlining is the mother of all optimizations, it allows other passes to do a better job. 17:17 rich1: can or does racket do any algebraic optimisations. a simple example (not (not a)) => a? 17:18 stamourv: It can't do that one, because it's not correct: 17:18 stamourv: rudybot: (not (not 3)) 17:18 rudybot: stamourv: ; Value: #t 17:19 rich1: quite correct :) i meant for booleans 17:19 stamourv: But the Racket compiler does constant folding, if that's what you're asking. 17:20 stamourv: If you want to see if it's happening, you can use `raco decompile', which shows you decompiled bytecode. It's not pretty, but still somewhat readable. 17:20 rich1: yeh 17:21 (join) anRch 17:22 cnonim: which difference between define-inline and define-syntax-rule? 17:22 dented42: in http://paste.lisp.org/+2WV7 , shouldn't the type checker see that node-left returns a tree, and because of the if testing if (node-left tree) is null, shouldn't it realize that it can't be null and therefore must be a node, and therefore shouldn't the snippet typecheck properly? 17:22 stamourv: cnonim: Here's an example: 17:22 dented42: probably could have asked that question better… 17:22 stamourv: rudybot: (define-syntax-rule (f x) (+ x x)) 17:22 rudybot: stamourv: Done. 17:23 dented42: tl;dr, shouldn't that typecheck? 17:23 stamourv: rudybot: (f (begin (displayln "here!") 2)) 17:23 rudybot: stamourv: ; Value: 4 17:23 rudybot: stamourv: ; stdout: "here!\nhere!\n" 17:23 stamourv: rudybot: (require racket/performance-hint) 17:23 rudybot: stamourv: Done. 17:23 stamourv: rudybot: (define-inline (f2 x) (+ x x)) 17:23 rudybot: stamourv: Done. 17:23 stamourv: (f2 (begin (displayln "here!") 2)) 17:23 stamourv: rudybot: (f (begin (displayln "here!") 2)) 17:23 rudybot: stamourv: ; Value: 4 17:23 rudybot: stamourv: ; stdout: "here!\nhere!\n" 17:23 stamourv: rudybot: (f2 (begin (displayln "here!") 2)) 17:23 rudybot: stamourv: ; Value: 4 17:23 rudybot: stamourv: ; stdout: "here!\n" 17:23 stamourv: rudybot: (define (f3 x) (+ x x)) 17:23 rudybot: stamourv: Done. 17:24 stamourv: rudybot: (f3 (begin (displayln "here!") 2)) 17:24 rudybot: stamourv: ; Value: 4 17:24 rudybot: stamourv: ; stdout: "here!\n" 17:24 cnonim: understood 17:24 stamourv: cnonim: That's one of the tricky things. 17:24 cnonim: what about my code? :) which difference between define-inline and define-syntax-rule? 17:24 cnonim: ups 17:24 cnonim: https://gist.github.com/cNoNim/bf426f3c27bfa12ed53d 17:24 cnonim: :) 17:24 stamourv: I recommend using define-inline, just in case you cange your code. 17:25 stamourv: You don't want to silently introduce bugs, do you. :) 17:26 stamourv: dented42: Does binding `(node-left tree)' to a variable work? 17:26 dented42: yes it does 17:26 stamourv: I would expect occurence typing paths to work here, though. 17:26 (quit) basdirks: Ping timeout: 256 seconds 17:26 dented42: but I'm curious as to why it doesn't realize that both calls to node-left should have the same value. 17:26 dented42: yes, exactly. 17:27 stamourv: I forget how paths work for structs, lemme look up the implementation. 17:27 (quit) serhart: Quit: Leaving. 17:28 (join) jonrafkind 17:28 (quit) jonrafkind: Changing host 17:28 (join) jonrafkind 17:29 stamourv: dented42: My guess is that it fails because the typechecker doesn't unfold `Tree' when it gets to that point. 17:29 stamourv: I don't know if there's a reason for that. And if there is, it really should be documented. 17:29 stamourv: Could you submit a bug report? 17:29 dented42: right 17:29 dented42: I'd be happy to 17:29 stamourv: Thanks! 17:30 dented42: should I link to the paste? or just paste the code into the bug report? 17:34 (quit) vkz: Quit: vkz 17:36 stamourv: I recommending putting the code in the bug report. It's pretty short, and who know how long the paste will be up. 17:37 cnonim: rudybot: (require typed/racket) 17:37 rudybot: cnonim: Done. 17:38 cnonim: rudybot: (list 1 '1 #\1 "1") 17:38 rudybot: cnonim: ; Value: (1 1 #\1 "1") 17:38 rudybot: cnonim: ; stdout: "- : (Listof (U Char One String)) [generalized from (List One One Char String)]\n" 17:38 cnonim: typed racket havn't tuple? 17:38 stamourv: It does. That's `List'. 17:39 stamourv: TR generalizes types before printing them, which is why you see both types. 17:40 dented42: ok 17:40 dented42: 'tis done 17:40 stamourv: Thanks! 17:41 cnonim: rudybot: (list #\ " ") 17:41 rudybot: cnonim: ; Value: (#\space " ") 17:41 rudybot: cnonim: ; stdout: "- : (Listof (U Char String)) [generalized from (List Char String)]\n" 17:41 cnonim: rudybot: (car (list #\ " ")) 17:41 rudybot: cnonim: ; Value: #\space 17:41 rudybot: cnonim: ; stdout: "- : Char\n" 17:42 cnonim: rudybot: (cdar (list #\ " ")) 17:42 rudybot: cnonim: error: #:1:0: Type Checker: Polymorphic function cdar could not be applied to arguments: Domains: (Listof (Listof a)) (Pairof (Listof a) b) (Listof (Pairof a b)) (Pairof (Pairof a b) c) Arguments: (List Char String) in: (#%app cdar (#%app list (quote #\space) (quote " "))) 17:42 cnonim: rudybot: (cdr (list #\ " ")) 17:42 rudybot: cnonim: ; Value: (" ") 17:42 rudybot: cnonim: ; stdout: "- : (Listof String) [generalized from (List String)]\n" 17:42 cnonim: rudybot: (cadr (list #\ " ")) 17:42 rudybot: cnonim: ; Value: " " 17:42 rudybot: cnonim: ; stdout: "- : String\n" 17:44 cnonim: i'm don't understand it's internally have type list of union or like tuple of several type? 17:44 cnonim: imho tuple it's like struct not list of union 17:45 stamourv: cnonim: Internally, the type is `(List Char String)'. 17:45 stamourv: `(Listof (U Char String))' is only there because TR generalizes types when showing them to you. 17:45 stamourv: In this case, it's not very useful, but when the internal type is big and complicated, generalization makes types more user-friendly. 17:47 cnonim: rudybot: (make-list 100 'foo) 17:47 rudybot: cnonim: ; Value: (foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo) 17:47 rudybot: cnonim: ; stdout: "- : (Listof 'foo)\n" 17:49 cnonim: rudybot: (cons 'bar (make-list 100 'foo)) 17:49 rudybot: cnonim: ; Value: (bar foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo) 17:49 rudybot: cnonim: ; stdout: "- : (Listof (U 'foo 'bar))\n" 17:50 cnonim: rudybot: (cons 'bar (list 'foo)) 17:50 rudybot: cnonim: ; Value: (bar foo) 17:50 rudybot: cnonim: ; stdout: "- : (Listof (U 'foo 'bar))\n" 17:50 cnonim: rudybot: (cons 'bar (list 'foo 'boo)) 17:50 rudybot: cnonim: ; Value: (bar foo boo) 17:50 rudybot: cnonim: ; stdout: "- : (Listof (U 'foo 'bar 'boo))\n" 17:51 stamourv: cnonim: You're trying to get rudybot kicked for flooding? 17:51 stamourv: :) 17:52 cnonim: :) 17:55 stamourv heads out for the weekend. 17:55 dyoo: have a good weekend 17:57 (join) bitonic 18:01 (quit) Fare: Ping timeout: 250 seconds 18:06 (quit) Icarot: Ping timeout: 260 seconds 18:07 (join) Icarot 18:10 (join) zyoung_ 18:12 (join) RacketCommitBot 18:12 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/bC6Ohg 18:12 RacketCommitBot: racket/master 539c25b Stevie Strickland: Fix with-contract so that contracts are only applied per mutation.... 18:12 (part) RacketCommitBot 18:13 (quit) zyoung: Ping timeout: 250 seconds 18:14 (join) Fare 18:15 (quit) anRch: Quit: anRch 18:15 (quit) zyoung_: Ping timeout: 252 seconds 18:16 (join) zyoung 18:16 (quit) zyoung: Remote host closed the connection 18:17 (join) zyoung 18:19 (quit) zyoung: Remote host closed the connection 18:27 (quit) rich1: Quit: Leaving. 18:28 (join) soegaard 18:29 (quit) Icarot: Ping timeout: 248 seconds 18:38 (join) Icarot 18:45 (quit) Icarot: Remote host closed the connection 18:46 (join) Icarot 18:59 (quit) soegaard: Quit: soegaard 19:01 (quit) mizu_no_oto: Quit: ["Textual IRC Client: www.textualapp.com"] 19:01 (quit) sstrickl: Quit: sstrickl 19:15 (quit) vipjun: Ping timeout: 264 seconds 19:25 (quit) Icarot: Ping timeout: 250 seconds 19:31 (quit) Mattykins: Ping timeout: 276 seconds 19:43 (join) Nisstyre-laptop 19:43 (join) Mattykins 20:00 (quit) asumu: Ping timeout: 245 seconds 20:08 (join) asumu 20:09 (quit) dyoo: Quit: dyoo 20:13 (quit) bitonic: Read error: Operation timed out 20:16 (join) codeblack 20:18 (join) ambrosebs 20:23 (quit) ambrosebs: Remote host closed the connection 20:27 (join) ambrosebs 20:32 (join) dyoo 20:32 (quit) dyoo: Client Quit 20:37 (join) adu 20:41 offby1: rudybot: why you say foo so much? 20:41 rudybot: *offby1: ,'""foo"" 20:48 dented42: awww, he's so cute! 20:52 offby1: that's why I wrote him! 20:53 rudybot blushes 20:55 (quit) didi: Ping timeout: 272 seconds 20:57 (quit) jonrafkind: Ping timeout: 256 seconds 21:02 (quit) dauterive: Quit: Leaving 21:16 (quit) cdidd: Ping timeout: 276 seconds 21:18 cnonim: rudybot: ((lambda (char) (and (char>=? #\a char) (char<=? #\z char))) #\h) 21:18 rudybot: cnonim: ; Value: #f 21:18 rudybot: cnonim: ; stdout: "- : Boolean\n" 21:18 cnonim: rudybot: ((lambda (char) (and (char<=? #\a char) (char>=? #\z char))) #\h) 21:18 rudybot: cnonim: ; Value: #t 21:18 rudybot: cnonim: ; stdout: "- : Boolean\n" 21:20 cnonim: rudybot: ((and (curry char<=? #\a) (curry char>=? #\z)) #\h) 21:20 rudybot: cnonim: error: #:1:0: Type Checker: Cannot apply expression of type (U False (Char -> Boolean)), since it is not a function type in: (#%app (if (#%app curry char<=? (quote #\a)) (#%expression (#%app curry char>=? (quote #\z))) (quote #f)) (quote #\h)) 21:21 cnonim: rudybot: ((and (curry char<=? #\a) (curry char>=? #\z)) #\h) 21:21 rudybot: cnonim: error: #:1:0: Type Checker: Cannot apply expression of type (U False (Char -> Boolean)), since it is not a function type in: (#%app (if (#%app curry char<=? (quote #\a)) (#%expression (#%app curry char>=? (quote #\z))) (quote #f)) (quote #\h)) 21:21 cnonim: rudybot: init 21:21 rudybot: cnonim: your sandbox is ready 21:21 cnonim: rudybot: ((and (curry char<=? #\a) (curry char>=? #\z)) #\h) 21:21 rudybot: cnonim: ; Value: #t 21:21 cnonim: why it's doesn't work in typed/racket? 21:24 bremner: cnonim: I _think_ because the and might return #f, as far as the type checker knows 21:24 cnonim: this is bug? or how i can rewrite? 21:26 bremner: I'm not sure the "point-free" way; you could use an explicit lambda 21:28 bremner: I think the untyped way kindof "works" by fluke: last argument to and is returned because neither is #f 21:30 cnonim: rudybot: ((and (curry char<=? #\a) (curry char>=? #\z)) #\0) 21:30 rudybot: cnonim: ; Value: #t 21:30 cnonim: :) 21:30 cnonim: exactly 21:30 cnonim: thx 21:33 cnonim: how i can rewrite (lambda ($) (foo $) $) in "point free" way? or it's not possible? 21:35 (join) Icarot 21:37 (quit) adu: Quit: adu 21:54 (join) adu 22:02 (join) mizu_no_oto 22:15 eli: asumu, stamourv: ping 22:17 (join) sstrickl 22:17 (quit) sstrickl: Changing host 22:17 (join) sstrickl 22:26 (quit) Icarot: Remote host closed the connection 22:29 (join) yacks 22:52 (quit) cnonim: Read error: Connection reset by peer 22:53 offby1: multi-cast ping! 22:54 (join) lemald 23:06 (join) RacketCommitBot 23:06 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/c1u8_Q 23:06 RacketCommitBot: racket/master 57e9001 Stevie Strickland: Fix a couple of identifer references that were overlooked. 23:06 (part) RacketCommitBot 23:07 mithos28: offby1: pong 23:15 offby1 's arena is corrupt! 23:15 offby1: I got a pong without a matching ping! 23:16 mithos28: you did a multi cast 23:16 offby1: no, _eli_ did a multicast. I was just observing that fact. 23:16 offby1: Or did I screw up the use/mention distinction again? 23:16 mithos28: it wasn't obvious what you were doing 23:19 offby1 is a master of subtlety 23:19 offby1: that's why 23:20 offby1: crap, now I need to arrange to expect pongs from ... everybody. 23:23 (quit) mithos28: Quit: mithos28 23:34 (join) mithos28 23:37 (quit) mithos28: Client Quit 23:38 (join) RacketCommitBot 23:38 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/QMr9YA 23:38 RacketCommitBot: racket/master 71a64bf Stevie Strickland: Remove additional cruft. 23:38 (part) RacketCommitBot 23:40 (quit) ambrosebs: Remote host closed the connection 23:40 offby1: "Mario Bros Cruft Removal" -- since 1922 23:43 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 23:58 asumu: eli: pong 23:58 eli: Two things 23:59 offby1: An apple, and a banana. 23:59 offby1: That's two 23:59 eli: 1. The name should be `splitf-at' or `split-atf'. I'm going for the first. 23:59 eli: 2. There's also a problem with the argument order