00:03 Nisstyre: verahsa: http://ideone.com/5E1vF9 00:03 Nisstyre: that's the equivalent match version of sublist 00:04 Nisstyre: er, I messed up the subtraction part 00:04 Nisstyre: let me fix that 00:05 Nisstyre: http://ideone.com/G4p3Jl 00:05 verahsa: That's returning false on ones that should be true 00:06 verahsa: the sublist function is doing precisely what it's supposed to, digging through and finding if the search list is contained anywhere within the list to be searched 00:06 verahsa: the one i have, i mean 00:06 (quit) kvda: Quit: z____z 00:08 Nisstyre: yeah I know I'm just showing how you might do it with match 00:09 verahsa: ... 00:09 verahsa: and yet the version with match that you showed me doesn't actually do that, unless i'm blind somehow 00:09 asumu: ksefchik: what are you seeing? 00:10 ksefchik: DrRacket seems to be crashing when I close the window of the animate function in universe.ss 00:10 ksefchik: But it seems random. Doesn't crash all the time. 00:11 asumu: ksefchik: which version of Racket? 00:11 ksefchik: 5.3.3 Win x64 00:12 Nisstyre: verahsa: yeah I made a small mistake 00:12 Nisstyre: give me a minute 00:14 Nisstyre: verahsa: http://ideone.com/K7I8h9 00:14 Nisstyre: that should work 00:14 Nisstyre: anyway, that's how you use match 00:14 asumu: ksefchik: that's odd and shouldn't happen. Can you submit this as a bug report? (there's a menu item for it in DrRacket) 00:14 asumu: ksefchik: also any other info about the crashes would be helpful (include in bug report please) 00:15 ksefchik: Sure thing! 00:16 Nisstyre: verahsa: list-no-order should allow you to do what you want with the lgrep procedure 00:17 verahsa: Nisstyre: Thanks! :) However... um... is there a way to run two commands under an if with no else of some nature? 00:20 Nisstyre: verahsa: in the condition part of it? 00:20 Nisstyre: not sure exactly what you mean 00:20 Nisstyre: but let me hack up the match version of lgrep 00:23 Nisstyre: verahsa: so lgrep is supposed to find all the occurences of a in b right? 00:23 ksefchik: asumu: Sent. 00:23 asumu: ksefchik: Thanks! 00:24 ksefchik: No problem. I gotta admit, I kinda dig this language. Keep up the great work! 00:24 verahsa: Nisstyre: Yes, and then display any list that *does* contain said occurrence 00:24 (quit) ambrosebs: Remote host closed the connection 00:25 Nisstyre: verahsa: but you want to return all of the positions of the occurrences right? 00:25 Nisstyre: or no? 00:25 verahsa: Nisstyre: http://ideone.com/irqZtX The last line of that is what should be returned for (lgrep SL1 lst) 00:25 Nisstyre: oh I see 00:26 Nisstyre: you can just use filter then 00:26 verahsa: *blink* 00:26 Nisstyre: have you not been introduced to that yet? 00:27 verahsa: No.... this is a project that I've been assigned to be exposed to Racket/Scheme. I've gotten everything I needed figured out except how to *both* run sublist *and* recursively run lgrep on a (b-1) if the size of b is not 0 00:28 verahsa: cond works, but once sublist returns true and prints that list, it quits 00:28 verahsa: cond works in the other direction, and will run lgrep until there's not enough left in b to check, but doesn't output anything because it simply stops when it finds a true expression 00:28 verahsa: hence why i was asking about running two commands at once. :) 00:29 Nisstyre: verahsa: filter will take a procedure that takes one argument, and go through a list and apply that procedure to each element, it expects a boolean return value from each one 00:29 Nisstyre: the ones that return false will be "filtered" out 00:29 Nisstyre: everything else gets returned in a list 00:29 Nisstyre: it's exactly what you want here 00:29 verahsa: or in this case a list of lists 00:30 Nisstyre: but if you need to do it using a plain procedure you can use letrec and write a recursive procedure that just does what filter does 00:31 Nisstyre: verahsa: the last line of your lgrep (using filter) would look like "else (filter ((curry sublist?) a) b)" 00:31 Nisstyre: I realize that looks kind of like magic :P 00:31 Nisstyre: but it works 00:31 Nisstyre: http://ideone.com/sBkMMg 00:32 Nisstyre: would you get in trouble if you used that? 00:32 Nisstyre: I guess it would be better if you fully understood the solution 00:34 verahsa: Honestly, if you could explain the 'curry sublist?' bit, I think I'd be understanding what was going on 00:34 Nisstyre: okay, it's pretty simple 00:34 Nisstyre: all curry is doing is creating a function that returns a new function each time you give it an argument 00:35 Nisstyre: so like, if you "curried" + then (+ 2) would return a function that does (+ 2 a) 00:35 Nisstyre: that sort of thing 00:35 Nisstyre: it's useful when you want to "fix" a parameter, i.e. make it the same 00:36 Nisstyre: so like ((curry *) 2) is equal to (lambda (x) (* x 2)) 00:36 Nisstyre: you can change it to a lambda if you want 00:36 verahsa: the "lambda" i've seen enough to vaguely understand. :) 00:36 Nisstyre: yeah 00:37 verahsa: I'll be honest, being exposed to racket over the past two weeks has been vastly interesting considering my other experiences have been visual basic and c++ 00:37 verahsa: things i love about it, and a few things that are just downright confusing. *grin* 00:37 verahsa: well, for me anyways 00:37 Nisstyre: yeah it is very confusing when you first start with this style of programming 00:37 Nisstyre: but once you get used to it, I find it is much easier to do than the sort of style C++ prefers 00:38 verahsa: I can see either being easy, with advantages and disadvantages, but i've also only been learning to program in general for about 4 years seriously and about 18 years as the occasional hobby 00:38 Nisstyre: verahsa: what kind of course are you doing? 00:38 verahsa: this course specifically is Theory of Programming Languages 00:38 Nisstyre: ah cool 00:38 Nisstyre: is this an online one? 00:39 verahsa: They offer it online, but I'm actually attending, this is one of the open labs. 00:39 Nisstyre: sounds cool 00:39 Nisstyre: I know someone who took an intro CS course last fall that was all Racket 00:39 verahsa: I've been enjoying learning about *how* programming works on a detailed level 00:39 Nisstyre: that was at the university of Waterloo 00:40 Nisstyre: yeah it's very fascinating learning about programming language theory 00:40 verahsa: programming in college isn't about learning a language, it's about learning how to learn a language, because who the **** knows what language you'll be required to work with in a career. :D 00:40 Nisstyre: exactly 00:40 Nisstyre: also, I think it's important to not get hung up on a certain style of programming language 00:40 Nisstyre: or to label them as being one style 00:41 Nisstyre: each one has advantages and disadvantages 00:41 verahsa: *nod* more exposure is always a good thing... things from C helped me understand racket, and things from racket have made things in C that I wasn't completely sure of a little more clear 00:41 verahsa: and then someone tosses out curry and my brain segfaults. *snicker* 00:41 Nisstyre: I think your mind will be blown even more if you ever try Haskell 00:41 Nisstyre: all the functions are automatically curried in that language 00:42 verahsa: I *really really* appreciate all your help, and I'll note Haskell down as something to look in to. Thank you SO much. :D Check your private messages for a relevant private question, though, here in a sec. 00:42 Nisstyre: okay I see it 00:45 (part) verahsa 01:09 (join) ynniv 01:13 (quit) mceier: Quit: leaving 01:17 (quit) ynniv: Quit: ynniv 01:29 (join) ksefchik 01:41 (quit) ksefchik: Ping timeout: 245 seconds 01:47 (quit) dented42: Ping timeout: 250 seconds 01:52 (join) dented42 02:00 (quit) Fare: Ping timeout: 272 seconds 02:09 (quit) sstrickl: Read error: Connection reset by peer 02:09 (join) sstrickl 02:09 (quit) sstrickl: Changing host 02:09 (join) sstrickl 02:18 (join) mceier 02:34 (join) BakaKuna 02:39 (quit) eikonos: Quit: Leaving. 02:42 (join) kvda 02:42 (join) eikonos 02:42 (quit) eikonos: Changing host 02:42 (join) eikonos 02:44 (join) ambrosebs 02:48 (join) basdirks 02:49 (quit) ASau: Ping timeout: 250 seconds 02:51 (join) soegaard 02:56 (quit) kvda: Quit: z____z 03:03 (join) vipjun 03:03 (join) rohni 03:14 (join) jao 03:14 (quit) jao: Changing host 03:14 (join) jao 03:15 (quit) jonrafkind: Ping timeout: 245 seconds 03:15 (join) egnarts-ms 03:16 (quit) rohni: Quit: Leaving. 03:17 (quit) dsantiago: Ping timeout: 240 seconds 03:18 (quit) noam: Ping timeout: 255 seconds 03:18 (join) noam 03:29 (join) ivan\ 03:35 (quit) ambrosebs: Remote host closed the connection 03:38 (quit) noam: Read error: Connection reset by peer 03:39 (join) noam 04:00 (join) mithos28 04:13 (quit) mithos28: Quit: mithos28 04:19 (join) bitonic 04:19 (quit) jao: Ping timeout: 276 seconds 04:26 (quit) soegaard: Quit: soegaard 04:30 (quit) cdidd: Remote host closed the connection 04:33 (quit) racycle: Quit: racycle 04:47 (join) cdidd 04:48 (join) rohni 04:50 (quit) cdidd: Remote host closed the connection 04:51 (join) codeblack 04:58 (part) tobih 04:59 (join) cdidd 05:05 (join) tobih 05:13 (part) tobih 05:14 (quit) vipjun: Ping timeout: 245 seconds 05:27 (quit) rohni: Quit: Leaving. 05:33 (join) Aune 05:43 (quit) Aune: Quit: Hath Deprated 05:43 (join) Aune 05:44 (join) tobih 05:49 (quit) cored: Ping timeout: 260 seconds 05:50 (join) cored 05:50 (quit) cored: Changing host 05:50 (join) cored 05:54 (join) bjz 05:56 (join) vipjun 06:09 (join) vkz 06:17 (quit) yacks: Ping timeout: 245 seconds 06:23 (join) Skola 06:24 Skola: hello, I'm trying to make a hash with (hash), but I'm not sure how to give it the k:v pairs 06:24 (join) ambrosebs 06:27 (quit) cored: Ping timeout: 276 seconds 06:28 (join) cored 06:28 (quit) cored: Changing host 06:28 (join) cored 06:31 (join) rohni 06:34 Skola: nvm 06:39 (quit) Kaylin: Read error: Connection reset by peer 07:11 (quit) vkz: Quit: vkz 07:21 (join) jeapostrophe 07:53 (join) didi` 07:53 (nick) didi` -> didi 07:56 (join) vkz 07:59 (quit) bjz: Ping timeout: 248 seconds 08:06 (join) yacks 08:35 (join) anonymous97890 08:42 (join) mizu_no_oto 08:44 (quit) anonymous97890: Quit: leaving 08:50 (join) zyoung 08:57 (quit) rohni: Quit: Leaving. 09:01 (join) serhart 09:09 (join) bjz 09:14 (join) rohni 09:14 (quit) bitonic: Read error: Operation timed out 09:16 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 09:28 (join) Fare 09:35 (quit) rohni: Quit: Leaving. 09:43 (join) rohni 09:56 (quit) rohni: Quit: Leaving. 10:02 (join) mizu_no_oto 10:02 (join) rohni 10:03 (join) bitonic 10:10 (join) anRch 10:13 (quit) ambrosebs: Remote host closed the connection 10:14 (quit) Aune: Quit: Hath Deprated 10:29 (quit) BakaKuna: Quit: BakaKuna 10:32 (quit) bitonic: Ping timeout: 245 seconds 10:40 (quit) sstrickl: Quit: sstrickl 10:47 (join) bitonic 10:53 (join) ambrosebs 11:04 (quit) cdidd: Remote host closed the connection 11:13 (join) soegaard 11:14 (quit) bitonic: Ping timeout: 264 seconds 11:16 (quit) anRch: Quit: anRch 11:18 (join) sstrickl 11:21 (join) racycle 11:21 (quit) mceier: Quit: leaving 11:21 (join) didi 11:23 (join) anonymous97890 11:24 anonymous97890: rudybot: (define a -nan.0) (number? a) (positive? a) 11:24 rudybot: anonymous97890: You can get a NaN on i386/amd64 in earlier versions, but it's trickier; you have to know what you're doing, and set up the bits right. 11:24 (join) jbclements 11:26 stamourv: rudybot: eval (define a -nan.0) (number? a) (positive? a) 11:26 rudybot: stamourv: ; Value: #f 11:26 stamourv: rudybot: Is that it? 11:26 rudybot: stamourv: was going to voluenteer twb, but if you want me that badly then i cna't decline 11:26 stamourv: rudybot: eval (define a -nan.0) (values (number? a) (positive? a)) 11:26 rudybot: stamourv: ; Value: #t 11:26 rudybot: stamourv: ; Value#2: #f 11:26 stamourv: rudybot: That's better. 11:26 rudybot: stamourv: Ok, thanks. The second best would be to get good expansion in the *Python* shell. For some reason, ipython does not do auto-complete very well. I've tried a little of bpython and it has some better autocompletion but I do not know if one can make it work from emacs 11:26 stamourv: anonymous97890: If you want rudybot to process multiple expressions, you need to explicitly ask it to `eval'. 11:27 anonymous97890: stamourv: thanks 11:27 stamourv: Otherwise, it thinks you're just talking to it, and tries to respond with something that's on topic. 11:27 stamourv: For some values of "on topic". 11:27 stamourv: rudybot: Which is why we love you. 11:27 rudybot: stamourv: The culture of people who love, care about and invent technology is partly characterized by a diligent skepticism of technology 11:28 anonymous97890: eval (define a nan.0) (values (number? a) (positive? a)) 11:28 anonymous97890: rudybot: eval (define a nan.0) (values (number? a) (positive? a)) 11:28 rudybot: anonymous97890: your sandbox is ready 11:28 rudybot: anonymous97890: error: nan.0: undefined; cannot reference an identifier before its definition in module: 'program 11:28 anonymous97890: rudybot: eval (define a +nan.0) (values (number? a) (positive? a)) 11:28 rudybot: anonymous97890: ; Value: #t 11:28 (quit) ambrosebs: Ping timeout: 264 seconds 11:28 rudybot: anonymous97890: ; Value#2: #f 11:28 anonymous97890: (positive? +nan.0) 11:28 anonymous97890: rudybot: (positive? +nan.0) 11:28 rudybot: anonymous97890: ; Value: #f 11:31 anonymous97890: rudybot: eval (struct a-b (c)) (struct a (b-c)) (a-b-c (a-b 1)) 11:31 rudybot: anonymous97890: error: a-b-c: contract violation expected: a? given: # 11:31 anonymous97890: hm... 11:31 anonymous97890: rudybot: eval (struct a-b (c)) (struct a (b-c)) (a-b-c (a 1)) 11:31 rudybot: anonymous97890: ; Value: 1 11:32 (join) ambrosebs 11:43 (quit) rohni: Quit: Leaving. 11:47 (join) bitonic 11:55 (quit) ambrosebs: Remote host closed the connection 11:57 (join) RacketCommitBot 11:57 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/sVU8Eg 11:57 RacketCommitBot: racket/master ef189b8 Matthias Felleisen: Racket rename 11:57 RacketCommitBot: racket/master c13d603 Matthias Felleisen: fixed .ss name in title 11:57 RacketCommitBot: racket/master ec0398f Matthias Felleisen: Racket rename 11:57 (part) RacketCommitBot 12:02 (quit) mizu_no_oto: Quit: ["Textual IRC Client: www.textualapp.com"] 12:05 (join) mithos28 12:05 (join) jonrafkind 12:18 (quit) didi: Remote host closed the connection 12:21 (quit) egnarts-ms: Ping timeout: 245 seconds 12:21 (join) RacketCommitBot 12:21 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/8s4Zdw 12:21 RacketCommitBot: racket/master 39ae7a8 Jay McCarthy: Removing saltification compat 12:21 RacketCommitBot: racket/master 9d3a42f Jay McCarthy: using bcrypt 12:21 RacketCommitBot: racket/master 6bf03c1 Jay McCarthy: Extending cookie support with expiration... 12:21 (part) RacketCommitBot 12:27 (join) RacketCommitBot 12:27 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/YRqb_A 12:27 RacketCommitBot: racket/master bb17b6a Asumu Takikawa: Add take-while, drop-while to racket/list 12:27 (part) RacketCommitBot 12:29 (join) dauterive 12:30 (join) anRch 12:30 (quit) codeblack: Ping timeout: 248 seconds 12:36 (join) mceier 12:37 (join) dsantiago 12:39 (join) Shozan 12:41 (quit) dented42: Ping timeout: 252 seconds 12:44 (join) mattmight 12:45 (join) soegaard_ 12:45 (quit) soegaard_: Client Quit 12:45 (quit) soegaard: *.net *.split 12:45 (quit) Skola: *.net *.split 12:45 (quit) SHODAN: *.net *.split 12:45 (quit) paddymahoney: *.net *.split 12:45 (quit) mattmigh`: *.net *.split 12:45 (join) Skola 12:48 (join) ASau 12:48 (join) dented42 12:50 (join) didi 12:52 (join) paddymahoney 12:59 (join) mizu_no_oto 13:00 (quit) jbclements: Quit: jbclements 13:02 (quit) Fare: Read error: Operation timed out 13:02 (quit) anRch: Quit: anRch 13:03 (quit) didi: Remote host closed the connection 13:04 (join) jbclements 13:12 (join) didi 13:14 (join) soegaard 13:19 (join) ynniv 13:20 (quit) paddymahoney: Remote host closed the connection 13:32 (join) cnonim 13:32 (quit) jbclements: Quit: jbclements 13:33 cnonim: hello, all, i have two function https://gist.github.com/cNoNim/1877036b61637c6a18b6 ... 13:33 cnonim: how i can rewrite the get-char using get-any? 13:34 (quit) mithos28: Quit: mithos28 13:36 (part) ynniv 13:36 stamourv: cnonim: You'd either need to have some `peek' functionality, that allows you to look at the input without consuming it, or to have a way to pass a predicate to `get-any'. 13:38 cnonim: predicate it's next? or not? 13:39 (quit) jeapostrophe: Ping timeout: 252 seconds 13:40 stamourv: Since your example doesn't show what `next' can be, I don't know. 13:45 (join) rich2 13:46 cnonim: I think that the right decision here https://gist.github.com/cNoNim/1877036b61637c6a18b6 13:47 cnonim: but I'm not sure, and that can be simplified? 13:50 cnonim: i found best solution :) 13:51 cnonim: https://gist.github.com/cNoNim/1877036b61637c6a18b6 13:53 rich2: is there something like a range type in racket - which guarantees an instance of that type is between a lower and upper bound? or should that be a custom struct? 13:54 (quit) soegaard: Quit: soegaard 13:57 (join) anRch 13:58 stamourv: rich2: A custom struct could work, or you could use contracts. 14:00 eli: asumu: ping 14:01 (join) dyoo 14:10 (join) jeapostrophe 14:11 (quit) bitonic: Read error: Operation timed out 14:13 (quit) anonymous97890: Ping timeout: 264 seconds 14:19 (quit) yacks: Read error: Connection reset by peer 14:22 (join) jbclements 14:27 (join) rohni 14:43 asumu: eli: pong 14:44 asumu: rich2: I would just use (between/c low hi) to enforce this. 14:44 eli: asumu: As long as your in that part of my todo list, how about the rest of the neighborhood? 14:44 asumu: eli: are you referring to srfi-1? 14:45 eli: No. 14:45 eli: I have some things on a todo list that I never get to. 14:45 eli: You've done two, and there's a bunch of similar ones. 14:45 eli: `take-right-while', `drop-right-while' 14:46 eli: Also `split-at-while', `split-at-right-while' 14:46 asumu: I could add those. You think span from srfi-1 is worth it? 14:46 eli: What was it doing? 14:46 asumu: span = (values (take-while pred lst) (drop-while pred lst)) 14:47 eli: Ah, that horrible name... 14:47 eli: That would be `split-at-while' 14:47 asumu: break = (values (take-while (negate pred) lst) (drop-while (negate pred) lst)) 14:47 asumu: Oh, right. 14:47 asumu: Yeah, split-at is a better name. 14:47 eli: rudybot: (take 4 '(1 2 3 4 5 6 7 8)) 14:47 rudybot: eli: your sandbox is ready 14:47 rudybot: eli: error: take: contract violation expected: exact-nonnegative-integer? given: '(1 2 3 4 5 6 7 8) argument position: 2nd other arguments...: 4 14:47 asumu: (if somewhat wordy in this case) 14:47 eli sighs 14:47 eli: rudybot: (take '(1 2 3 4 5 6 7 8) 4) 14:47 rudybot: eli: ; Value: (1 2 3 4) 14:47 eli: rudybot: (split-at '(1 2 3 4 5 6 7 8) 4) 14:47 rudybot: eli: ; Value: (1 2 3 4) 14:47 rudybot: eli: ; Value#2: (5 6 7 8) 14:48 eli: So it's the same. 14:48 eli: rudybot: (take-right '(1 2 3 4 5 6 7 8) 2) 14:48 rudybot: eli: ; Value: (7 8) 14:48 eli: rudybot: (split-at-right '(1 2 3 4 5 6 7 8) 2) 14:48 rudybot: eli: ; Value: (1 2 3 4 5 6) 14:48 rudybot: eli: ; Value#2: (7 8) 14:49 eli: I think that the reason that `span' and `break' were used is because they fit some random use case that happened to be relevant at the time. 14:49 eli: asumu: But I have a style commit in a few minutes. 14:52 asumu: How about splitf for split-at-while? 14:53 (join) RacketCommitBot 14:53 RacketCommitBot: [racket] plt pushed 4 new commits to master: http://git.io/Ez_PQg 14:53 RacketCommitBot: racket/master 5c90a7b Robby Findler: adjust gc2's mutator language so that void-producing expressions... 14:53 RacketCommitBot: racket/master 49ffca8 Robby Findler: remove ->address 14:53 RacketCommitBot: racket/master 9ef439d Robby Findler: add in documentation for plai/gc2 14:53 (part) RacketCommitBot 14:54 eli: asumu: The problem is that there's already an established naming -- it's good to have a direct connection between `split-at' and `split-at-while'. 14:55 (join) mithos28 14:58 (quit) cored: Read error: Operation timed out 14:59 (quit) mizu_no_oto: Quit: ["Textual IRC Client: www.textualapp.com"] 15:00 (join) soegaard 15:01 stamourv: eli: `split-at-while' is a terrible name. It implies that you're splitting multiple times, which it doesn't do. 15:02 (join) cored 15:02 (quit) cored: Changing host 15:02 (join) cored 15:02 eli: `splitf' is terrible for a more important reason, IMO. 15:03 eli: And if you're talking about *that* problematic interpretation of "while", then `take-while' is suffering from the same confusion -- and that's easy to change now before more code grows. 15:03 stamourv: IMO, `at' implies that you're passing it an index, which is also not the case. 15:03 eli: For example, `takef' -- which would make `splitf' better. 15:04 stamourv: Re `take-while': That's not as bad, since you're taking elements (in the english sense) repeatedly. 15:05 eli: I care much less about the english than I care about the identifiers, which is why I will fight for related names. 15:06 stamourv: How useful is taht function anyway? 15:06 (quit) anRch: Quit: anRch 15:06 asumu: Heh, turns out Haskell uses `span`, `break`. Clojure `split-with`. 15:07 stamourv: Does `split-with' do the same thing? 15:08 asumu: As `split-at-while`/`span`? Yes. 15:08 asumu: http://clojuredocs.org/clojure_core/clojure.core/split-with 15:09 eli: asumu: Yes, I have this comment in my todo file: bad name, but it's symmetric; clojure calls this `split-with' 15:09 eli: (So it's not like I didn't think about it before.) 15:09 stamourv: `split-with' sounds like partitioning to me, not scanning the list as long as a condition holds. 15:09 asumu: Yeah, I don't think `span` or `split-with` are worth considering. 15:10 stamourv: eli: Unrelated, are you in? I want to bounce an idea off you. 15:10 (quit) mithos28: Quit: mithos28 15:12 asumu: eli: what is the semantics of `take-right-while`? Is it just (reverse (take-while pred (reverse lst)))? 15:13 eli: asumu: Yes, but I hope that you won't implement it this way... 15:13 asumu: I wasn't planning to. 15:13 eli: The implementation will be a tiny bit tricky, with two pointers, one at the current position and one at the beginning of the chain. 15:13 eli: stamourv: No, I'm not in. 15:14 eli: stamourv: Re the name -- that's the problem I had with `split-with', which is why I didn't use it. 15:14 stamourv: eli: Hmm, maybe we can do it over IRC, then. Would you prefer to wait until the current conversation is over? 15:14 eli: So overall, you can look for some better word than `while' that might fir both. 15:14 eli: s/fir/fit/ 15:14 stamourv: eli: Re `split-with': I agree. 15:15 eli: And again -- it has the advantage of `-while' not being a proper convention -- yet. 15:15 eli: so maybe a *f or -pred or something like that. 15:15 eli: And BTW², just to show how much I care about this: the problem of names is the only reason I didn't add these things yet. 15:15 stamourv: I like *f, it's consistent with `memf', `assf', etc. 15:16 eli: IIRC, I've asked the list a few times. 15:16 stamourv: Well, these functions aren't all that used either, which may explain the lack of interest. 15:16 eli: I think that people wanted the -while variants a few times. 15:16 stamourv: IMO, racket/list doesn't absolutely need feature parity with srfi/1. 15:16 eli: And the point of `break' and `span' definitely came up. 15:17 eli: (With the obvious clashes with html-like code and loops.) 15:17 stamourv: It just needs enough that we don't ever need to use srfi/1 and its horrible names ever again. 15:17 stamourv pukes in `iota''s general direction. 15:17 (join) anonymous97890 15:17 asumu: So, while I don't have strong feelings on whatever `span`/`split-at-while` is, I think we should use `take-while`/`drop-while`. 15:17 asumu: Because these are more or less universal 15:17 eli: Yeat, iota is a horrible name 15:17 asumu: (see OCaml, Haskell, Clojure) 15:18 eli: And in racket it's a little more horrible, since it should have been ι (but that's still bad). 15:18 stamourv: `take-while' and `drop-while' are fine with me, but I agree with eli that having a convention that would fit with the others would be nice. 15:18 eli: stamourv: Email is probably better for the other thing. 15:18 stamourv: Which is why I like *f. 15:18 stamourv: eli: Re other thing: Sounds good. 15:18 eli: Yeah, I think that the *f thing would work nicer. 15:18 (join) bitonic 15:19 eli: asumu: Maybe just dump a list of new names on dev and see if there are objections? 15:20 asumu: I can do that, but what is the current favorite? splitf? split-pred? 15:20 eli: I think that both me and stamourv lean towards the *f thing 15:21 stamourv: eli: Re other thing: Actually, I think waiting to talk in person would be better. Are you going to be in tomorrow? 15:21 eli: ("splitf" might be dangerous when talking about it.) 15:21 eli: (Especially during dinners.) 15:21 soegaard: Does this have another name? https://github.com/soegaard/this-and-that/blob/master/split-between.rkt 15:21 eli: stamourv: Maybe call? 15:21 stamourv: eli: Nah, not urgent. 15:22 asumu: So take-while, drop-while, take-while-right, drop-while-right, splitf, splitf-right. 15:23 eli: asumu: no, takef, dropf, takef-right, dropf-right, splitf, splitf-right 15:23 stamourv: (add1 eli) 15:23 eli: (The first "no" is not a name...) 15:23 eli: soegaard: Other things I have on my todo list are kind of similar, but not exactly 15:23 (quit) vkz: Quit: vkz 15:23 asumu: Okay. 15:23 eli: soegaard: I have: Something like clojure's `partition-by' and `group-by' 15:24 asumu: (while I like take-while better than takef, takef *is* nice and short...) 15:24 soegaard: I'll look them up 15:24 eli: soegaard: I also have `split-by' 15:24 stamourv: eli, soegaard: unstable/list has `group-by'. I use it fairly often. 15:24 eli: WHich is this: (split-by '(1 2 3 x 4 5 6 x 7) 'x) => '((1 2 3) (4 5 6) (7)) 15:25 eli: stamourv: That group-by is also one of them, which I think has a more conventional name. 15:25 eli: (I think. Don't have time to look it up now.) 15:25 stamourv: eli: I took the name from SQL, which IMO is a pretty authoritative source. 15:25 eli: soegaard: Also, you refered yesterday to some useful things still in srfi-13? 15:26 eli: stamourv: I think that generally speaking clojure should be more important for us. 15:26 eli: (Ie, there were several complaints in the spirit of "clojure has X, how do I do it in Racket" -- but that never happened with sql.) 15:26 soegaard: eli: string-prefix? and string-suffix? and string-contains? 15:27 stamourv: eli: Agreed, but IMO sharing the name with SQL makes the function easily discoverable. 15:27 eli: soegaard: I have `string-index' on my list, which covers the last and the first, not sure what to do about the -suffix one though... 15:28 soegaard: ok 15:28 eli: stamourv: Wait, your `group-by' is different than the one in clojure, right? 15:29 eli: (Again, apologies for not looking things up.) 15:29 stamourv: eli: I don't know what Clojure's `group-by' does. 15:29 stamourv: Mine groups things by equivalence class. 15:29 eli: stamourv: http://clojuredocs.org/clojure_core/clojure.core/group-by 15:29 stamourv: rudybot: (require unstable/list) 15:29 rudybot: stamourv: Done. 15:29 stamourv: rudybot: (group-by (lambda (x y) (= (mod x 3) (mod y 3))) (range 12)) 15:29 rudybot: stamourv: error: mod: undefined; cannot reference an identifier before its definition in module: 'program 15:30 stamourv: rudybot: (group-by (lambda (x y) (= (modulo x 3) (modulo y 3))) (range 12)) 15:30 rudybot: stamourv: ; Value: ((10 7 4 1) (11 8 5 2) (9 6 3 0)) 15:30 eli: stamourv: Can you just look that up? 15:30 stamourv: Looking now. 15:31 asumu: rudybot: eval (require unstable/list) (group-by string-length '("a" "as" "asd" "aa" "asdf" "qwer")) 15:31 rudybot: asumu: your sandbox is ready 15:31 rudybot: asumu: error: string-length: arity mismatch; the expected number of arguments does not match the given number expected: 1 given: 2 arguments...: "as" "a" 15:31 asumu: It's not quite the same. 15:31 stamourv: Yeah, not exactly. 15:31 stamourv: rudybot: eval (require unstable/list) (group-by = #:key string-length '("a" "as" "asd" "aa" "asdf" "qwer")) 15:31 rudybot: stamourv: ; Value: (("qwer" "asdf") ("asd") ("aa" "as") ("a")) 15:31 stamourv: IMO more flexible, though. 15:32 stamourv: Output format is not exactly the same, but I like mine better. 15:32 asumu: stamourv: the Clojure version also gives you the output of the key function. 15:33 stamourv: I know, but I don't think it's a good idea. 15:33 asumu: Yeah, I'm not saying it's a good idea. Just another difference. 15:33 stamourv: You can end up with different keys that happen to be equivalent, given your equivalence predicate, so you'd need to elect a representative, etc. 15:33 eli: stamourv: So wait, your code applies N² predicates, or applies them to "some pairs to determine classes"? 15:33 eli: Either of these would be a bad idea. 15:34 eli: I have a vague memory of the latter. 15:34 stamourv: I forget the implementation. Let me look it up. 15:36 stamourv: O(N-elts * N-classes) 15:37 stamourv: So O(N²) in the worst case. 15:38 eli: stamourv: So, I was right -- the latter. 15:38 eli: That makes it a *very* odd addition. 15:38 stamourv: Why? 15:38 stamourv: IMO, it serves a useful purpose. I use it often. 15:40 eli: It requires an equivalence relation, but it's practically never useful with the built in obvious ones. In most cases it would be some obvious composition of (lambda (x y) (some-equal? (some-key x) (some-key y))), which would make the clojure version sufficient. 15:41 eli: In any case, I think that clojure should definitely win here -- it's definitely much more paid-attention-to. 15:42 stamourv: eli: So you'd have both the key and the equivalence relation be optional/keywords? 15:42 stamourv: That sounds reasonable. 15:43 (join) Kaylin 15:46 eli: stamourv: Well, in the clojure version the key function is the main argument, and we can add a comparison keyword thing. (Or maybe a last argument.) 15:51 stamourv: IME, the equivalence arguments was useful more often than the key argument. 15:58 rich2: asumu: stamourv: thanks. didn't know about between/c 15:58 rich2: although a general between seems useful and more readable than chaining >= and <= 15:59 stamourv: rudybot: (<= 2 3 4) 15:59 rudybot: stamourv: ; Value: #t 15:59 rich2: (between 5 1 10) => #t, (between 55 1 10) => #f 15:59 stamourv: rudybot: (define (between x y z) (<= y x z)) 15:59 rudybot: stamourv: Done. 15:59 stamourv: rudybot: (between 5 1 10) 15:59 rudybot: stamourv: ; Value: #t 15:59 stamourv: rudybot: (between 55 1 10) 15:59 rudybot: stamourv: ; Value: #f 15:59 stamourv: rich2: ^ 16:00 rich2: cool, i didn't realise that about <= 16:00 stamourv: A lot of Racket functions take an arbitrary number of arguments. 16:01 stamourv: rudybot: (+ 1 2 3 4) 16:01 rudybot: stamourv: ; Value: 10 16:01 stamourv: rudybot: (map list (range 5) (range 6 10)) 16:01 rudybot: stamourv: error: map: all lists must have same size; arguments were: # '(0 1 2 3 4) '(6 7 8 9) 16:01 stamourv: rudybot: (map list (range 5) (range 6 11)) 16:01 rudybot: stamourv: ; Value: ((0 6) (1 7) (2 8) (3 9) (4 10)) 16:02 stamourv: So a lot of things that, in other languages would need to be separate functions (e.g. `map' and `zipWith' in Haskell) are a single function in Racket. 16:03 rich2: how would haskell do (map list lst1 lst2) ? 16:04 rich2: that's a bit like the for/list having 2 clauses 16:04 stamourv: Something like `zipWith (\ x y . [x y]) lst1 lst2'. 16:04 stamourv 's Haskell is rusty. 16:05 stamourv: Re `for/list': Exactly! 16:05 stamourv: TBH, unless I'm mapping a function that already exists, I tend to use `for/list'. 16:07 (join) Mordae 16:07 Mordae: Hello. 16:07 (quit) anonymous97890: Ping timeout: 240 seconds 16:09 asumu: Mordae: hi 16:09 Mordae: I am playing with Racket's FFI with a short-term goal of wrapping libgirepository-1.0.so or so. 16:10 Mordae: There is one thing that puzzles me. Racket have support for C-style-memory-layout backed structures via (define-cstruct) and others. 16:10 Mordae: This mechanism directly supports inheritance, which is something really cool. 16:11 Mordae: But I have no idea how to wrap opaque structures that need only the type-compatibility part of inheritance. 16:14 Mordae: Is everything going to be fine if I just (cpointer-push-tag!) for every parent in the chain? How effective is that? 16:15 cnonim: how i can bind some argument to function? 16:17 dyoo: cnonim: do you have an example of what you're trying to do? 16:17 asumu: Mordae: I'm not quite sure what you mean by type-compatibility part. You mean you want something that acts like _tag but doesn't actually include _tag as a field? (like define-cstruct does) 16:19 cnonim: dyoo: have (lambda (x) x) and 1, do (foo (lambda (x) x) 1) and get (lambda () ((lambda (x) x) 1))... what's foo? 16:20 (quit) sizz_: Ping timeout: 245 seconds 16:20 dyoo: that looks like curry, right? 16:21 dyoo: http://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Ffunction..rkt%29._curry%29%29 16:21 rudybot: http://tinyurl.com/c9e3zxf 16:22 stamourv: rudybot: (define (foo f x) (lambda () (f x))) 16:22 rudybot: stamourv: Done. 16:22 stamourv: rudybot: (foo (lambda (x) x) 1) 16:22 rudybot: stamourv: ; Value: # 16:22 stamourv: rudybot: ((foo (lambda (x) x) 1)) 16:22 rudybot: stamourv: ; Value: 1 16:22 stamourv: cnonim: ^ 16:22 stamourv: Functions are values, you can pass them as arugments, just like numbers. 16:23 Mordae: asumu: I am not sure I follow. As I understand tags, they define pointer type compatibility. A pointer tagged with 'foo and 'bar can be passed to a function accepting 'foo but not to a function accepting 'apples. (define-cstruct) seems to be doing something really cool behind the scenes making child structs being compatible with parents (appear tagged as such?). This is something I want, but can't have since the structs I deal with are 16:23 Mordae: opaque. 16:24 cnonim: i have list of arguments and (lambda (x) x) how i can get list of (lambda () ...)? 16:24 asumu: Mordae: it's not doing anything too complicated. If you have a parent type _type and want to define a new pointer type that can be used as a _type, you can do (define-cpointer-type _new-type _type). 16:24 dyoo: You can "thunk" a function. 16:24 stamourv: cnonim: (map foo list-of-lambdas list-of-args) 16:25 cnonim: stamourv: not list of lambda only one labda 16:25 cnonim: *lambda 16:26 rich2: (map your-lambda list-of-args) ? 16:26 dyoo: rudybot: (define (thunk a-val) (lambda () a-val)) 16:26 rudybot: dyoo: your sandbox is ready 16:26 rudybot: dyoo: Done. 16:26 dyoo: rudybot: (define x-thunk (thunk 5)) 16:26 rudybot: dyoo: Done. 16:26 dyoo: rudybot: x-thunk 16:26 rudybot: dyoo: ; Value: # 16:26 stamourv: (map (lambda (x) (foo your-lambda x)) list-of-xs) 16:26 dyoo: rudybot: (x-thunk) 16:26 rudybot: dyoo: ; Value: 5 16:27 cnonim: stamourv: thx, it's logical :) 16:27 (quit) dyoo: Quit: dyoo 16:28 stamourv: Racket, it just makes sense.™ 16:28 cnonim: rudybot: (map (lambda (x) (curry (lambda (y) y) x)) '(1 2 3 4 5) 16:28 Mordae: asumu: I totally missed that part of the docs. Thanks a lot! 16:28 rudybot: cnonim: So... Curry curried schönfinkeling? 16:28 cnonim: rudybot: (map (lambda (x) (curry (lambda (y) y) x)) '(1 2 3 4 5)) 16:28 rudybot: cnonim: your sandbox is ready 16:28 rudybot: cnonim: ; Value: (1 2 3 4 5) 16:28 stamourv: cnonim: Missing a paren. 16:28 cnonim: yes, yes 16:29 stamourv: Also, you don't need `curry' there. 16:29 cnonim: why resul of function is values? not function? 16:29 stamourv: rudybot: (map (lambda (x) ((lambda (y) y) x)) '(1 2 3 4 5)) 16:29 rudybot: stamourv: ; Value: (1 2 3 4 5) 16:30 stamourv: rudybot: (map (lambda (x) (lambda () ((lambda (y) y) x))) '(1 2 3 4 5)) 16:30 rudybot: stamourv: ; Value: (# # # # #) 16:30 stamourv: cnonim: ^ 16:30 cnonim: thx ) 16:32 (join) mithos28 16:34 cnonim: have (lambda (.x) ...) and list of args how pass args to lambda? 16:35 jonrafkind: ((lambda x ...) 1 2 3 4) 16:36 cnonim: not, we have '(1 2 3 4) and variadic lambda (lambda (.x) ...) 16:37 cnonim: *(lambda x ...) 16:39 cnonim: rudybot: ((lambda x (display x) 1 2 3 4) 16:39 rudybot: cnonim: lovely people please help... take a look at this.. http://paste.lisp.org/display/94865 ... how come emacs what the unicode character is but desides to display a completely different one?.... 16:39 jonrafkind: (lambda x ...) is a function that accepts a list of arguments for x 16:40 cnonim: rudybot: ((lambda x (display x)) 1 2 3 4) 16:40 rudybot: cnonim: ; stdout: "(1 2 3 4)" 16:40 cnonim: rudybot: ((lambda x (display x)) '(1 2 3 4)) 16:40 rudybot: cnonim: ; stdout: "((1 2 3 4))" 16:40 jonrafkind: rudybot: (apply (lambda x (display x)) '(1 2 3 4)) 16:40 rudybot: jonrafkind: your sandbox is ready 16:40 rudybot: jonrafkind: ; stdout: "(1 2 3 4)" 16:40 cnonim: jonrafkind: thx 16:43 (join) RacketCommitBot 16:43 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/ttaiMQ 16:43 RacketCommitBot: racket/master 95abacd Eli Barzilay: GCalc updates.... 16:43 RacketCommitBot: racket/master bbeb293 Eli Barzilay: Fix renamed file in props. 16:43 RacketCommitBot: racket/master b9406e6 Eli Barzilay: Style changes.... 16:43 (part) RacketCommitBot 16:43 eli: asumu: that was the change that I was talking about. 16:43 eli leaves 16:45 cnonim: https://gist.github.com/cNoNim/1877036b61637c6a18b6 16:45 cnonim: it works, thx guys :) 16:48 (quit) mithos28: Quit: mithos28 16:49 (quit) jonrafkind: Ping timeout: 276 seconds 16:51 (quit) vipjun: Ping timeout: 256 seconds 16:56 (quit) Skola: 16:59 (quit) basdirks: Ping timeout: 245 seconds 17:03 (join) RacketCommitBot 17:03 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/kooLqA 17:03 RacketCommitBot: racket/master 308a65e Robby Findler: fix plai tests 17:03 (part) RacketCommitBot 17:06 (join) kvda 17:12 (quit) cnonim: Quit: WeeChat 0.4.0 17:12 (join) mizu_no_oto 17:12 didi: rudybot: People of Earth. 17:12 rudybot: didi: From humble beginnings on Mars, Bloom Energy is now changing the Earth for the better. 17:14 (quit) bjz: Quit: Leaving... 17:21 rich2: it seems the date struct can handle dates outside 32 bit unix time - but the other constructors such as seconds->date can't 17:22 (part) Mordae 17:25 rich2: i'll have to test if reading dates from an RDBMS will work which are before 1970 17:26 (quit) Kaylin: Read error: Connection reset by peer 17:27 (join) RacketCommitBot 17:27 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/Xs-l9Q 17:27 RacketCommitBot: racket/master 0720ad2 Jay McCarthy: raco setup, ignore this collect 17:27 (part) RacketCommitBot 17:28 (quit) serhart: Quit: Leaving. 17:28 (join) jonrafkind 17:28 (quit) rich2: Quit: Leaving. 17:34 (join) bjz 17:36 (quit) kvda: Quit: x___x 18:11 (join) ambrosebs 18:11 (join) paddymahoney 18:11 (join) zyoung_ 18:13 (join) mithos28 18:13 (quit) zyoung_: Remote host closed the connection 18:14 (quit) zyoung: Ping timeout: 260 seconds 18:28 (quit) mithos28: Quit: mithos28 18:32 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 18:38 (quit) sstrickl: Quit: sstrickl 18:47 (quit) soegaard: Quit: soegaard 18:59 (join) mizu_no_oto 19:11 (join) sstrickl 19:11 (quit) sstrickl: Changing host 19:11 (join) sstrickl 19:11 (quit) bjz: Quit: Leaving... 19:29 (quit) jonrafkind: *.net *.split 19:29 (quit) mceier: *.net *.split 19:29 (quit) arrdem: *.net *.split 19:30 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 19:30 (quit) TheBeerinator: Ping timeout: 248 seconds 19:30 (join) chandler 19:30 (quit) chandler: Changing host 19:30 (join) chandler 19:31 (join) TheGhostinaor 19:36 (quit) sstrickl: Quit: sstrickl 19:39 (join) jonrafkind 19:39 (join) mceier 19:39 (join) arrdem 19:50 (join) mithos28 19:56 (quit) cored: Ping timeout: 272 seconds 19:58 (join) cored 19:58 (quit) cored: Changing host 19:58 (join) cored 20:02 (quit) jbclements: Quit: jbclements 20:05 (quit) mithos28: Quit: mithos28 20:12 (join) Kaylin 20:16 (join) mizu_no_oto 20:39 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 20:42 (quit) jonrafkind: Ping timeout: 257 seconds 20:53 (quit) bitonic: Ping timeout: 260 seconds 20:55 (quit) jeapostrophe: Ping timeout: 240 seconds 21:01 (join) mizu_no_oto 21:03 (join) bitonic 21:13 (quit) bitonic: Ping timeout: 255 seconds 21:28 (join) mithos28 21:35 (join) DanBurton 21:43 (quit) mithos28: Quit: mithos28 21:44 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 21:57 (quit) Kaylin: Read error: Connection reset by peer 22:16 (join) mizu_no_oto 22:20 (join) yacks 22:24 (join) Kaylin 22:29 (quit) didi: Quit: ERC Version 5.3 (IRC client for Emacs) 22:33 (quit) dauterive: Quit: Leaving 22:39 (join) zacts 22:40 (quit) zacts: Changing host 22:40 (join) zacts 22:41 (quit) DanBurton: Remote host closed the connection 22:46 (join) sizz 22:54 (join) zyoung 23:04 (quit) Kaylin: Quit: Leaving. 23:07 (join) mithos28 23:13 (quit) mizu_no_oto: Quit: Computer has gone to sleep. 23:22 (quit) mithos28: Quit: mithos28 23:23 (join) Fare 23:31 (join) noam_ 23:34 (quit) noam: Ping timeout: 264 seconds 23:52 (join) jonrafkind 23:54 (join) Kaylin 23:54 (quit) karswell: Ping timeout: 264 seconds