00:00 (quit) tomku: Ping timeout: 244 seconds 00:28 tomku|two: 2/part 00:28 (part) tomku|two: "WeeChat 0.3.4" 00:38 (join) yoklov1 00:40 (part) yoklov1 00:56 (nick) ohwow_ -> ohwow 01:35 (join) realitygrill 02:00 (quit) freakazoid: Quit: Computer has gone to sleep. 02:01 (quit) jonrafkind: Ping timeout: 244 seconds 02:10 (quit) dnolen: Quit: dnolen 02:31 (join) mithos28 02:34 (quit) mithos28: Client Quit 03:13 (quit) realitygrill: Quit: realitygrill 03:37 (quit) crk: Ping timeout: 258 seconds 03:49 (join) crk 03:59 (join) Shvillr_ 03:59 (quit) Shvillr: Read error: Connection reset by peer 03:59 (quit) Shviller: Disconnected by services 03:59 (nick) Shvillr_ -> Shviller 03:59 (join) Shvillr 04:08 (quit) noam: Read error: Connection reset by peer 04:13 (join) epsil 04:13 (join) noam 04:36 (join) avarus 05:36 (join) MayDaniel 05:49 (quit) noam: Read error: Connection timed out 05:50 (join) noam 05:56 (quit) MayDaniel: 06:27 (quit) epsil: Read error: Connection reset by peer 07:17 (join) epsil 08:05 (join) MayDaniel 08:14 (join) vu3rdd 08:14 (quit) vu3rdd: Changing host 08:14 (join) vu3rdd 08:30 (join) leandrosansilva 08:31 leandrosansilva: Hello to all! I'm a newbie in scheme and I have some questions... How can I transform a string in a literal? 08:31 leandrosansilva: for example, I need to transform 08:31 leandrosansilva: "house" into 'house 08:32 leandrosansilva: in fact, I have a list of strings and I need to transform it in a ordinary list 08:32 leandrosansilva: ("one" "two") -> '(one two) 08:33 leandrosansilva: Is there a "standard" function in racket which can do that? 08:39 epsil: (map string->symbol '("one" "two")) 08:52 (quit) noam: Read error: Connection reset by peer 08:52 (join) noam 08:57 (join) masm 09:02 leandrosansilva: oh, thx 09:04 leandrosansilva: but it doesn't work for numbers (I'm using string->number) and parentesis (how can I have the parentesis char as as symbol?) 09:04 leandrosansilva: I want "(" -> '(, not |(| 09:14 rapacity: |(| is the symbol from the parenthesis char, it's not typed out as '( because ' is just a shorthand for (quote ...) and (quote () would be unbalanced, wrapping it in | | solves that problem 09:19 leandrosansilva: sorry. I didn't understand. Can you show some code? For example, I have a list '( "(" "(" ")" ")" ) and I need to transform it in '((())) 09:20 leandrosansilva: I'm really new in scheme. If you can recomend some documentation... 09:24 rapacity: rudybot: '( 09:24 rudybot: rapacity: eh? Try "rudybot: help". 09:24 rapacity: rudybot: eval '( 09:24 rudybot: rapacity: error: #:1:1: read: expected a `)' to close `(' 09:24 rapacity: it errors because it's unbalanced it expects ) 09:25 rapacity: have you checked out the racket guide ? http://docs.racket-lang.org/guide/index.html 09:29 leandrosansilva: Yes, I'm reading it 09:35 (quit) karswell: Remote host closed the connection 09:45 (join) jeapostrophe 10:20 (quit) abbe: Read error: Connection reset by peer 10:22 (join) abbe 10:42 (nick) samth_away -> samth 10:43 samth: leandrosansilva: do you want to transform '( "(" "(" ")" ")") into a four-element list or a one-element list? 10:43 leandrosansilva: samth, yes, I do 10:44 samth: leandrosansilva: that was a choice -- which one do you want? 10:46 leandrosansilva: I really don't know. I don't know functional languages very well. I realy don't know how to begin 10:46 leandrosansilva: I've just written very simple programs 10:47 leandrosansilva: *with scheme 10:47 samth: leandrosansilva: this isn't about function languages, but about what you want your program to do? 10:48 leandrosansilva: I need to transform a string like "11+3*(10+5)+5" into a list '(11 + 3 * ( 10 + 5 ) + 5) 10:49 leandrosansilva: I've already done the transformation of a string with no parentesis 10:49 leandrosansilva: my result actually is '(11 + 3 * |(| 10 + 5| )| + 5) 10:50 leandrosansilva: Now I understand I have to transform a sublist between two parentesis 10:50 leandrosansilva: but I'm thinking in how do it :-) 10:51 samth: leandrosansilva: is this part of a class? 10:52 (quit) jao: Ping timeout: 248 seconds 10:53 leandrosansilva: Yes, it is. Is it so obvious? 10:53 leandrosansilva: :-) 10:54 (join) kewne 10:54 kewne: Hi. 10:55 kewne: I'm having a problem with racket font handling but I don't know wether it is my fault (probably) or a known bug. 10:55 kewne: In particular, when drawing fonts to a dc I find they don't align correctly to the given coordinates 10:56 kewne: Since it is a bit hard to explain: 10:56 kewne: http://i.imgur.com/tV2tm.png 10:57 kewne: All the letters/numbers should appear at the top left of their current square 10:57 kewne: so the numbers at the right side should touch squares in the board at their left 10:58 kewne: and they almost do, but the letters on the bottom are separated about 10 pixels from their squares at the top. 10:58 kewne: Which is the problem, the different spacing from top and left when a font is drawn. 11:06 (join) keenbug 11:08 kewne: Oh, "Due to space included in a font by a font designer, a font tends to generate text that is slightly taller than the nominal size." 11:10 (join) kewne_ 11:10 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/MoDSOQ 11:10 RacketCommitBot: [racket/master] skip osx64 build for now - Matthew Flatt 11:10 RacketCommitBot: [racket/master] racket/draw: generalize "face" in a font% to be a description - Matthew Flatt 11:10 RacketCommitBot: [racket/master] scribble: use Latex skull package only if needed - Matthew Flatt 11:13 (quit) kewne: Ping timeout: 240 seconds 11:15 (join) karswell 11:26 (join) jonrafkind 11:31 (join) anRch 11:43 (quit) MayDaniel: Read error: Connection reset by peer 11:44 (quit) masm: Ping timeout: 244 seconds 11:55 (quit) crk: Ping timeout: 240 seconds 12:02 (quit) em: Ping timeout: 252 seconds 12:27 (join) dnolen 12:32 (join) em 12:43 (join) masm 12:44 (quit) anRch: Quit: anRch 12:53 (join) freakazoid 12:54 (join) MayDaniel 12:56 (quit) vu3rdd: Remote host closed the connection 13:00 (quit) jeapostrophe: Ping timeout: 240 seconds 13:01 (join) Lajla 13:03 (join) EmmanuelOga 13:37 (join) realitygrill 13:41 (quit) jonrafkind: Ping timeout: 260 seconds 13:45 (quit) freakazoid: Quit: Computer has gone to sleep. 13:51 (join) freakazoid 14:01 (join) mithos28 14:03 (quit) kewne_: Quit: kewne_ 14:07 (quit) EmmanuelOga: Ping timeout: 244 seconds 14:10 (quit) keenbug: Ping timeout: 244 seconds 14:57 (quit) realitygrill: Quit: realitygrill 15:00 (join) jao 15:05 samth: eli: what's the current status of the nightlies? 15:09 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/Y6ZjpA 15:09 RacketCommitBot: [racket/master] fix future bugs mostly related to `touch' within a future - Matthew Flatt 15:28 (join) PsiFac 15:29 PsiFac: hi 15:29 PsiFac: how can I implement the draw.ss into my library? 15:35 (join) dnolen_ 15:35 (quit) dnolen: Read error: Connection reset by peer 15:35 (nick) dnolen_ -> dnolen 15:52 (join) rgrinberg 15:52 (quit) PsiFac: Quit: Page closed 15:55 (quit) leandrosansilva: Read error: Connection reset by peer 16:07 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/Zq0s1g 16:07 RacketCommitBot: [racket/master] Turn off excessive stderr output. - Sam Tobin-Hochstadt 16:09 (join) jonrafkind 16:41 (quit) MayDaniel: Read error: Connection reset by peer 17:07 (quit) epsil: Quit: WeeChat 0.3.5 17:09 (join) epsil 17:19 (quit) Shvillr: Ping timeout: 276 seconds 17:19 (join) Shvillr 17:46 (quit) avarus: Remote host closed the connection 18:05 (join) leandrosansilva 18:05 (quit) leandrosansilva: Remote host closed the connection 18:28 (nick) elliottcable -> mr_fuggles 18:36 (quit) epsil: Quit: WeeChat 0.3.5 18:38 (nick) mr_fuggles -> ec 19:10 RacketCommitBot: [racket] plt pushed 6 new commits to master: http://git.io/gcKoEQ 19:10 RacketCommitBot: [racket/master] fix `print-convert' on cyclic hash key - Matthew Flatt 19:10 RacketCommitBot: [racket/master] better guide entry on "comments" - Matthew Flatt 19:10 RacketCommitBot: [racket/master] guide clarification on arguments to `eval' - Matthew Flatt 19:11 (join) Huggleslorx 19:12 Huggleslorx: I've got a big conditional, and it's complaining that `(string-ref stack 0)` doesn't handle an empty string, but the conditional should be hitting a condition before this and not getting there 19:13 (quit) Lajla: Ping timeout: 244 seconds 19:15 offby1: Huggleslorx: paste it 19:16 Huggleslorx: doing it now 19:16 Huggleslorx: needed to split it up a bit because it was wrapping 19:16 Huggleslorx: http://pastebin.com/yy0ERL7v 19:17 offby1: ugh 19:17 Huggleslorx: lol 19:17 offby1: pretty complicated. Ideally you'd reduce it to the simplest code whose behavior still puzzles you, and you'd include some driver code to cause the problem to repro 19:18 Huggleslorx: it was more a question of if this is normal behavior that I'm not aware of 19:18 Huggleslorx: I pretty much just picked racket up 19:18 offby1: is it possible that you could use "match" instead of "cond"? Not sure that'd help much, but it might be a bit simpler 19:19 offby1: Huggleslorx: can you paste something that I can _easily_ run, and see the behavior you're seeing? 19:19 Huggleslorx: sure, gimme a sec 19:21 Huggleslorx: hrm 19:22 Huggleslorx: oooooh, there's my problem 19:22 Huggleslorx: empty? doesn't work with strings >_< 19:23 (join) Lajla 19:25 Huggleslorx: looks like append doesn't work on strings etiher 19:25 Huggleslorx has typing issues 19:27 offby1: those are both correct statements! 19:27 offby1: I take this opportunity to nag you to write unit tests :) 19:28 offby1: I hear current versions of racket make that pretty easy. 19:30 RacketCommitBot: [racket] plt pushed 2 new commits to master: http://git.io/A3DQsQ 19:30 RacketCommitBot: [racket/master] adjust the completions box so that it doesn't raise the error mentioned in 12396 anymore - Robby Findler 19:30 RacketCommitBot: [racket/master] fix a bug in the case that the character with a breakpoint or a - Robby Findler 19:33 (join) EmmanuelOga 19:36 (join) king_oli 19:41 Huggleslorx: ... 19:41 Huggleslorx: is regexp-match destructive? 19:42 offby1: naw 19:42 Huggleslorx: nope 19:42 Huggleslorx: something else funky's going on 19:42 offby1: probably. 19:42 offby1: Eva thang I do gone be funky from now on. 19:42 offby1 nods gravely 19:44 (quit) dnolen: Quit: dnolen 19:44 freakazoid: Huggleslorx: post your code somewhere? 19:46 Huggleslorx: http://pastebin.com/NeRjSb68 -- alright, that *doesn't* work 19:46 Huggleslorx: (c "4" "") returns " " 19:48 freakazoid: you're missing parens around the result of the second condition clause 19:48 freakazoid: before string-append 19:49 freakazoid: so that would return " " 19:49 ozzloy: what's up with the "cond" on the same line as the (define ...? 19:49 Huggleslorx: well fuck me 19:49 Huggleslorx: freakazoid: thakns 19:49 Huggleslorx: thanks* 19:49 freakazoid: sure 19:50 ozzloy: usually i'd start that out on the next line and everything would be indented much much less 19:51 Huggleslorx: yeah 19:51 Huggleslorx: ozzloy: thanks 19:53 Huggleslorx: ("4+4" . "") // what does the . indicate? 19:53 ozzloy: pair 19:54 (quit) masm: Quit: Leaving. 19:54 ozzloy: http://docs.racket-lang.org/guide/pairs.html?q=pair Huggleslorx 19:55 ozzloy: Huggleslorx, sometimes the dot can be used to make an operator infix 19:55 (join) dnolen 19:56 Huggleslorx: oh jeeze, I'm using cons everywhere 19:56 Huggleslorx: *facepalm* 19:56 ozzloy: is using cons bad? 19:56 offby1: oh yes. 19:56 Pauan: Using cons in a recursive procedure is pretty normal, no? But if you really want to make a list, then use (list ...) 19:56 offby1: never use cons 19:56 offby1: don't use "let", "car" or "cdr" either. 19:57 offby1 flees 19:57 ozzloy: offby1, why is cons bad? 19:57 Pauan: (of course, there's probably a higher-order procedure like map that already does what you want to do, so use that instead) 19:57 ozzloy: is it an expensive operation? 19:57 (quit) dnolen: Client Quit 19:58 Huggleslorx: cons is bad because it's supposed to be all strings 19:58 Pauan: ah, yeah, don't use cons for strings... 19:58 freakazoid: I think offby1 is lying to us 19:58 Pauan: cons is only for cons pairs, lists, nothing more 19:58 freakazoid: In Erlang strings are lists ;-) 19:59 freakazoid: but it also uses an infix operator for consing 19:59 Pauan: (though, I suppose one could generate a list, and then convert it into a string) 19:59 Pauan: (that may be easier, depending on your algorithm) 19:59 Huggleslorx: I wouldn't use append-string to add a character to the front of a string I'm guessing 19:59 Huggleslorx: what would I want? 19:59 ozzloy: string-append maybe 19:59 Pauan: The answer really does depend on what you're trying to do, what algorithm you're using, etc. 20:00 Huggleslorx: ozzloy: that's what I meant 20:00 ozzloy: or do you mean maybe the string specific version is overkill 20:00 Huggleslorx: would it attach a character to a string aswell? 20:00 Pauan: hm... 20:01 Huggleslorx: doesn't look like it 20:01 ozzloy: oh you mean a literal character and not just a string containing one character. i'm not sure if racket has a character literal 20:01 freakazoid: using strings is probably pretty inefficient if you're prepending 20:01 Huggleslorx: (string-append #\a "blah") fails 20:01 Pauan: It does have character literals. 20:01 ozzloy: oh it does. good times 20:01 offby1: ozzloy: I was joking 20:01 ozzloy: offby1, oic 20:02 ozzloy: in my defense, i'm still new to lisps in general. not just oblivious to jokes 20:02 offby1: also, what I call "jokes" are frequently referred to as "stupid" 20:02 Huggleslorx: if I'm already working with strings I'd rather not be converting back and forth with lists 20:02 freakazoid: offby1++ 20:02 Pauan: in your defense, not every lisp emphasizes functional style 20:02 ozzloy: offby1, ^_^ 20:02 samth: common lisp, for example 20:03 ozzloy: i read a little bit of common lisp. i was put off by the functions-in-a-special-namespace thing 20:03 freakazoid: yeah that bugs me too 20:03 Pauan: Huggleslorx: I don't know about Racket, but in Arc I frequently convert to-and-from strings, symbols, etc. as needed. Then again, Arc is also very polymorphic, unlike Racket. It would be helpful if you could give us a high-level description of what you're trying to accomplish. 20:04 Huggleslorx: (string-append (string #\a) "blah") *does* work, but it seems hacky as hell 20:04 offby1: Huggleslorx: that second clause in your cond looks bogus. Have you verified that it works? 20:04 freakazoid: though it's more that identifiers have multiple values - a function value and a value value 20:04 ozzloy: like, come on guys, lisp does away with stupid unnecessary distinctions and keeps syntax to a minimum. why screw it up like that? 20:04 freakazoid: Historical reasons, ozzloy :) 20:04 offby1: ozzloy: I've heard that the separate namespaces for functions versus everything else in CL has a benefit, although I forget what it is. 20:04 Huggleslorx: offby1: second clause? 20:04 offby1: Might make macros easier, or the module system 20:04 freakazoid: they were still learning how to make a lisp when they made lisp 20:04 offby1: Huggleslorx: (regexp-match? #px"^[0-9]" infix) string-append (first (regexp-match #px"^[0-9]*" infix)) " " 20:05 Pauan: I believe the common reason given is for macros, yeah. 20:05 Huggleslorx is used to haskell BTW 20:05 freakazoid: though CL postdates Scheme 20:05 Huggleslorx: offby1: I'm made some fixes to stuff like that 20:05 offby1: Huggleslorx: if you know Haskell, I think you're well-prepared for racket. 20:05 Pauan: I dunno about that... 20:05 Pauan: they may both emphasize functional style, but they still seem fairly different to me 20:05 ozzloy: freakazoid, that's what i've heard. offby1, oh? like speeding up something or other? 20:06 freakazoid: clojure prepared me for racket :) 20:06 Huggleslorx: offby1: I think you're full of shit then 20:06 offby1: probably, but I was serious about Haskell 20:06 Huggleslorx: fuck it, I'mma going with my hacky fix 20:07 (join) dnolen 20:07 freakazoid: And now you know how to make software. 20:08 Huggleslorx: :p 20:08 samth: *sob* 20:08 ozzloy: well haskell prepares you better than perl at least 20:09 ozzloy: or coldfusion or matlab or ... 20:09 (quit) dnolen: Client Quit 20:09 freakazoid: visual basic 20:09 ozzloy: i like lisp a lot and i haven't even gotten to macros yet 20:10 ozzloy: yusss! VB ftw 20:10 freakazoid: I didn't think it was possible to like lisp without getting to macros 20:10 freakazoid: then you go "Oh! That's why the lack of syntax is a good thing!" 20:10 Huggleslorx: oh god, VB is horrible 20:11 ozzloy: the reason i like lisp is the lack of syntax. feels very clean 20:11 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/X8KIYQ 20:11 RacketCommitBot: [racket/master] windows: avoid SetFilePointer() on unsupported file-stream types - Matthew Flatt 20:11 freakazoid: makes it less readable though 20:11 freakazoid: but it's equally unreadable for all the DSLs you write in it 20:11 Huggleslorx: (((((((((very (clean)))))))))) 20:11 freakazoid: rather than basically being good for one language and really ugly for anything you try to embed 20:11 ozzloy: i'm actually a huge fan of the parens. which i know is a minority opinion 20:11 freakazoid: like happens with templates, operator overloading, etc 20:12 offby1: ((crazy (man))) 20:12 ozzloy: it's nice to know this is exactly where an expression starts and ends 20:12 freakazoid: ozzloy: I remember when I discovered an adventure game writing system based on Scheme back in the early 90s. I really liked the parens 20:12 offby1: I can never remember precedence rules 20:12 ozzloy: also a lot of times, it's not actually more delimiters than in other languages 20:12 freakazoid: may well have been that begin and end made me feel icky. 20:12 freakazoid: (Pascal was my first non-toy language) 20:13 ozzloy: i do like ruby's /regex literal/ syntax though 20:13 freakazoid: ruby is a kitchen sink of syntax 20:13 freakazoid: like a slightly cleaner version of perl 20:13 (nick) ec -> elliottcable 20:13 ozzloy: i'd kinda like to make that possible in racket. and i gather that's possible. due to macros, maybe 20:14 freakazoid: hmm 20:14 ozzloy: maybe in racket something like #rx/regex literal/flags 20:14 freakazoid: there might be some way to do it with those reader things 20:14 freakazoid: wait, you do know there IS a regex literal syntax in Racket already, right? 20:14 ozzloy: the double \ thing is kinda annoying when escaping 20:14 ozzloy: yeah, but it's basically a string syntax 20:14 jonrafkind: there is no regex literal in racket 20:15 jonrafkind: there is only shorthand for (regex ...) 20:15 ozzloy: ah 20:15 jonrafkind: much like ' is shorthand for (quote ...) 20:15 Huggleslorx: the lake of type checking, it burns! 20:15 Huggleslorx: lack* 20:15 freakazoid: and "foo" is shorthand for (string #\f #\o #\o) ? 20:15 jonrafkind: no, "foo" is a string literal 20:15 samth: to get around the \\\\\\\\ you can use the @-syntax 20:15 offby1: Huggleslorx: I miss it too. Try Typed Racket 20:16 ozzloy: ok, well i'd like to make #rx/stuff/flags be short for (regex (regex-escaped "stuff") flags) (or whatever it should be) 20:16 offby1: rudybot: (string #\f #\o #\o) 20:16 rudybot: *offby1: your sandbox is ready 20:16 rudybot: *offby1: ; Value: "foo" 20:16 samth: rudybot: init at-exp racket 20:16 rudybot: samth: expecting: init [] 20:16 samth: offby1: consider that a feature request 20:16 offby1: yeah 20:16 jonrafkind: yea regex literals would be nice, but they would be easy to add as a reader macro 20:16 offby1: that's more eli's area 20:16 freakazoid: rudybot: #rx"^[0-9]+" 20:16 rudybot: freakazoid: your sandbox is ready 20:16 rudybot: freakazoid: ; Value: #rx"^[0-9]+" 20:16 jonrafkind: and I'm not sure why #rx doesn't work that way already.. 20:16 freakazoid: jonrafkind: :P 20:16 jonrafkind: now match \n 20:17 ozzloy: jonrafkind, that's what i thought. so i figured i'd do that to learn how to make a macro 20:17 offby1: samth: by the way, you can submit issues via https://github.com/offby1/rudybot/issues/new 20:17 ozzloy: "reader macro" 20:17 freakazoid: I have no idea how. I haven't gotten around to learning regex matching in Racket yet. 20:17 jonrafkind: freakazoid, #rx"\\n" note the double \ 20:17 ozzloy: samth, what is this @-syntax? 20:17 jonrafkind: and thus it is not a regex literal 20:17 freakazoid: sure, I know what you mean. 20:17 samth: ozzloy: it's the syntax used in Scribble documents 20:17 samth: rudybot: doc at-exp 20:17 rudybot: samth: your racket/init sandbox is ready 20:17 rudybot: samth: not found in any library's documentation: at-exp 20:18 samth: rudybot: doc make-at-readtable 20:18 rudybot: samth: no docs for a current binding, but provided by: scribble/reader 20:18 samth: rudybot: (require scribble/reader) 20:18 rudybot: samth: Done. 20:18 samth: rudybot: doc scribble 20:18 rudybot: samth: not found in any library's documentation: scribble 20:18 samth: rudybot: doc make-at-readtable 20:18 rudybot: samth: http://docs.racket-lang.org/scribble/reader-internals.html#(def._((lib._scribble%2Freader..rkt)._make-at-readtable)) 20:18 samth: ozzloy: check that out 20:19 Huggleslorx: there we go 20:19 Huggleslorx: \o/ it lives! 20:28 ozzloy: samth, thanks 20:29 Huggleslorx: http://pastebin.com/3z3HyTF8 -- infix to postfix expression converter if anyone's interested 20:29 Huggleslorx: only takes possitive integers though 20:30 ozzloy: jonrafkind, wait, are you saying maybe #rx could act like that? like maybe that's a feature that people would want and it would justify making it part of racket proper? 20:30 Pauan: Huggleslorx: I suppose my only question would be: why? 20:31 Pauan: is it part of some larger project? 20:31 Pauan: or just a convenience? 20:31 Huggleslorx: It's for a class 20:31 Pauan: ah 20:31 Pauan: I see 20:31 Huggleslorx: he want's us to learn functional programming 20:31 jonrafkind: ozzloy, yes I dont see why its not that way already 20:31 ozzloy: because i am totally in favor of that, but that's just as a sometime user and not as a language designer 20:31 Huggleslorx: so I made the algo in haskell and pretty much ported it straight over to racket (what he wanted us to use) 20:32 Pauan: jonrafkind: yeah, I agree, I wondered that when I first noticed the regexp literal syntax: why bother having a literal syntax if you still need to double-escape \? 20:32 jonrafkind: yea.. 20:32 Huggleslorx goes and makes dinner 20:32 Huggleslorx: then I get to write an post-fix interpreter for this thing 20:32 Huggleslorx: shouldn't be hand now that I've more or less figured out the language 20:32 Huggleslorx: thanks 20:32 Huggleslorx: love you all 20:33 ozzloy: <3 20:34 ozzloy: well i'm glad this is being considered. i'm off to read 20:34 (quit) king_oli: 20:35 (join) jeapostrophe 20:43 (nick) samth -> samth_away 20:45 (quit) jeapostrophe: Ping timeout: 240 seconds 20:55 (join) realitygrill 20:58 (quit) freakazoid: Quit: Computer has gone to sleep. 20:59 (nick) elliottcable -> lightf 20:59 (nick) lightf -> SphereCat1 21:01 (nick) SphereCat1 -> ec 21:03 (join) RackN00b 21:05 RackN00b: Hello all! I have a function when called as: (foo 3 2 +) creates the following output: (list (list 0 1 2) (1 2 3)). This is all good and I've got the points for the question but I've seen someone post elsewhere that this can be solved using abtract list functions and lambda in something like two lines of code! Would anyone know how? 21:05 ozzloy: jonrafkind, if you're willing to make that part of racket proper and willing to wait for me to learn how to make a reader macro, i'm happy to make that change and submit it via pull request on github 21:07 ozzloy: ok, back to reading 21:08 RackN00b: The solution I have is above 12 lines of code and I can't seem to think of how to make it any better... 21:08 offby1: rudybot: (define (foo . args) (list (list 0 1 2) (1 2 3))) 21:08 rudybot: *offby1: Done. 21:08 offby1: RackN00b: that's my solution. Very simple. 21:08 offby1: rudybot: (foo 3 2 +) 21:08 rudybot: *offby1: error: procedure application: expected procedure, given: 1; arguments were: 2 3 21:09 offby1: hmm 21:09 offby1: rudybot: (define (foo . args) (list (list 0 1 2) (list 1 2 3))) 21:09 rudybot: *offby1: Done. 21:09 offby1: rudybot: (foo 3 2 +) 21:09 rudybot: *offby1: ; Value: ((0 1 2) (1 2 3)) 21:09 offby1: there. 21:09 RackN00b: Sorry.. I'm lost - what's . args ? 21:09 offby1: it means "any number of arguments, all squished into a single list" 21:10 offby1: rudybot: (define (foo x y z) (list (list 0 1 2) (list 1 2 3))) 21:10 rudybot: *offby1: Done. 21:10 offby1: rudybot: (foo 3 2 +) 21:10 rudybot: *offby1: ; Value: ((0 1 2) (1 2 3)) 21:10 offby1: that also works, but is less general. 21:10 Pauan: In other words: ((lambda (x . args) args) 1 2 3 4) returns '(2 3 4) 21:10 RackN00b: I'm not getting 21:10 offby1: RackN00b: I'm making fun of you, by the way. 21:10 RackN00b: I figured as much 21:10 offby1: :) 21:10 offby1: seriously, you haven't defined what you want your function to do 21:10 RackN00b: true.. 21:11 Pauan: how about explaining why you are passing the + function to foo? 21:11 RackN00b: That's actually not part of the issue, that's a sidenote, and I can use map to do that... 21:12 Pauan: well, considering the issue is "my code works but I want it to be shorter!" I think it's pretty important to understand what it is your code is doing 21:12 RackN00b: What I want to do is supply two integers v and x and have the function produce a list of lists with each nested list of length v and a total of x rows... 21:12 Pauan: hm... 21:13 RackN00b: Imagine a multiplication table I guess - I used code that I had written for a multiplication table for this function and it works - passes everything but I'm very interested to see a two line solution! 21:13 Pauan: okay, but why is the output ((0 1 2) (1 2 3))? Is the output of (foo 3 3 +) ((0 1 2) (1 2 3) (2 3 4))? 21:14 RackN00b: It doesn't go to three rows 21:15 RackN00b: The number of columns and rows in the final "table" is r-1 and c-1 21:16 RackN00b: where r and c are the consumed integers 21:17 RackN00b: sorry - I retract that... the number of rows are equal to the second integer, the columns are 1 less... it starts at 0 21:18 RackN00b: Crap... now I'm confused :P Let me put it this way... the first nested list for (foo 3 2 list) => '((0 0) (0 1) (0 2)) 21:18 RackN00b: Does that make it any clearer? 21:18 RackN00b: brb... 21:19 Pauan: hm 21:19 jonrafkind: ozzloy, most likely someone else would make it a part of racket proper (either eli or matthew) 21:19 Pauan: actually, could we just see the code that you wrote that works? 21:19 Pauan: it'd probably be easier to take that and optimize it 21:19 jonrafkind: also you can't use #rx because that would break backwards compatibility 21:19 Pauan: rather than write the better version from scratch 21:20 (quit) realitygrill: Quit: realitygrill 21:25 RackN00b: Sure... I';; pastebin it... 21:25 Pauan: thanks 21:25 RackN00b: no, thank you! 21:25 RackN00b: http://pastebin.com/GssmnupW 21:26 RackN00b: The original function I wrote for the multiplication table made use of three helper functions, hence the locals. 21:27 Pauan: why not just use (define ...)? 21:27 Pauan: that should work within the function's body 21:28 RackN00b: I will definitely spruce it up a bit, but there are another ten or so functions I need to write so I'll be prettying everything up once those are done :P 21:28 Pauan: gimme a moment, I'm pretty sure this here has a higher-order function... 21:28 RackN00b: Also, offby1, not sure if you remember my powerset function that I was trying to write but I finally code it working entirely with lambdas... 21:28 RackN00b: Oh yeah? 21:29 Pauan: by the way... 21:29 Pauan: I just copied that into Racket 21:29 Pauan: and evaluated (build-2dlist2 3 2 list) 21:29 Pauan: and got this: 21:29 Pauan: '(((0 0) (1 0) (2 0)) ((0 1) (1 1) (2 1))) 21:29 Pauan: I'm just gonna assume that's the expected output 21:30 RackN00b: It is, yes 21:32 (join) jeapostrophe 21:40 (join) dnolen 21:41 (quit) dnolen: Client Quit 21:49 RackN00b: I might have an aneurysm before I figure out how to create the multiplication table in a more elegant way without explicit recursion :P 21:51 Pauan: okay, I abstracted it a little by using build-list 21:51 Pauan: now to see if I can abstract out the remaining messy bits 21:51 RackN00b: I was thinking of build-list as well but I couldn't seem to get it working properly... 21:52 offby1: rudybot: (build-list 10 values) 21:52 rudybot: *offby1: ; Value: (0 1 2 3 4 5 6 7 8 9) 21:52 offby1: rudybot: (build-list 10 add1) 21:52 rudybot: *offby1: ; Value: (1 2 3 4 5 6 7 8 9 10) 21:52 offby1: rudybot: (build-list 10 (curry cons 'fred)) 21:52 rudybot: *offby1: ; Value: ((fred . 0) (fred . 1) (fred . 2) (fred . 3) (fred . 4) (fred . 5) (fred . 6) (fred . 7) (fred . 8) (fred . 9)) 21:52 Pauan: yes, well, I'm getting it working properly :P 21:52 RackN00b: Really? Wowza 21:52 Pauan: well it got rid of the "cols-from" function 21:53 Pauan: now I'm trying to get rid of "rows-from" 21:53 RackN00b: I see 21:53 Pauan: okay 21:53 Pauan: I think that does it 21:53 Pauan: yup 21:53 Pauan: and now to add in curries 21:53 Pauan: for fun! 21:54 RackN00b: I don't have curry as a defined function at my language level but I wrote one a few weeks ago. Cool stuff... 21:54 Pauan: I guess this is short enough to paste in here... 21:54 Pauan: (define (build-2dlist2 cols rows func) 21:54 Pauan: (build-list rows (lambda (c) 21:54 Pauan: (build-list cols (curry func c))))) 21:54 Pauan: well 21:54 Pauan: guess not! 21:54 Pauan: time for pastebin 21:54 RackN00b: haha 21:54 Pauan: http://pastebin.com/N6A7Nc5T 21:54 Pauan: it'll expire in an hour 21:55 RackN00b: Just out of curioisty, could you use map on the lists there? 21:55 Pauan: well 21:55 eli: jonrafkind: ? 21:55 Pauan: yes, but... 21:55 Pauan: why would you *want* to? it would be mapping over a list of numbers 21:55 Pauan: whereas the point of build-list is that it already does that 21:55 jonrafkind: eli, #rx should read a regex literal 21:55 Pauan: so it'd probably be way less efficient to use map 21:55 RackN00b: Of course... 21:56 eli: jonrafkind: Huh? It already does. 21:56 jonrafkind: no its shorthand for (regex ...) 21:56 jonrafkind: you have to give it a string so you have to escape stuff 21:56 eli: No, it's not. 21:56 Pauan: by the way, (curry func c) is equivalent to (lambda (r) (func r c)) in case you prefer the longer form 21:56 Pauan: eli: he means that you need to use #rx"\\n" rather than just #rx"\n" 21:57 Pauan: in other words, it's not the same as /foo\nbar/ in say... JavaScript, or Perl 21:57 RackN00b: I know - I wrote it recently - Is currying particular useleful , real-world? I've asked a lot of people recently and many seem to have differing opinions on the matter 21:57 eli: jonrafkind: It's not shorthand for `regexp', and the syntax just happens to be convenient when it's like a string. 21:57 eli: Pauan: And how do you write a newline? 21:57 Pauan: uh... with \n? 21:57 Pauan: the point is that you need to double-escape the \s 21:58 Pauan: so if you want to match, say, "\\" you need to write #rx"\\\\" 21:59 eli: Pauan: If the #rx"\\n" regexp is written as some new #newrx_\n_, then you need to find also a way to write the regexp that is currently written as #rx"\n". 21:59 Pauan: RackN00b: I guess it depends on what the language supports. Currying is used *all the time* in Haskell, but Arc doesn't even have a curry form, for instance. I think currying is the sort of thing that needs a certain synergy with the rest of the language 21:59 eli: Trying to avoid backslash-escaping is a dangerous and mostly hopeless game. 21:59 RackN00b: hmmm 21:59 Pauan: in other words, different language features help or hinder with regards to currying (as with pretty much everything else regarding languages) 21:59 jonrafkind: eli, I didn't understand that. you can still write #rx"\n" 22:00 Pauan: eli: JavaScript (and other languages with literal regexp syntax like Perl) manage it just fine 22:00 Pauan: even Python has better support for it 22:00 Pauan: with the so-called "raw strings" 22:00 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/plc2_g 22:00 RacketCommitBot: [racket/master] fix non-ELF unix starter creation - Matthew Flatt 22:00 jonrafkind: #rx can't be changed since it would break backwards compatability 22:00 Pauan: so you can just write r"\n" in Python. 22:01 jonrafkind: so I misspoke when I said #rx should read a regex literal, i meant there should be some reader macro that can read regex literals (and syntax) 22:01 eli: jonrafkind: So you want *two* syntaxes? Where some patterns just cannot be written in one of them? 22:01 eli: Pauan: What does r"\n" match in python? 22:01 Pauan: RackN00b: I personally program in Arc, so I don't use currying at all, mostly. 22:01 Pauan: It matches a single newline character. 22:01 jonrafkind: hold on, is (regex "\\n") different from (regex "\n") ? 22:01 RackN00b: cool... 22:01 (quit) rudybot: Ping timeout: 260 seconds 22:01 Pauan: Because that's what the regexp syntax /\n/ means. 22:02 Pauan: as far as I know, that's how all the major languages do it (JavaScript, Perl, Python) 22:02 eli: Pauan: Then how is that different than in Racket, where #rx"\n" matches a single newline character? 22:02 Pauan: it isn't 22:02 jonrafkind: also I find it strange that you would defend the utility of #rx in that you can write a literal \n in your pattern, as if thats worth double-escaping stuff 22:02 Pauan: the problem is with things like #rx"\\d" 22:03 Pauan: which matches a regexp class 22:03 eli: Pauan: Please don't assume that I don't know what I'm talking about. 22:03 Pauan: in that case, digits 22:03 eli: There are two different escapes here -- in racket, they are clearly different: #px"\\d" and #px"\n" -- the first is a regexp-level escape, the second is a string-level escape. 22:03 Pauan: yes 22:04 eli: String-level escapes are used to escape characters that you cannot write in a different way. 22:04 Pauan: and what jonrafkind and I are saying is that it would be useful if there was an easier way to insert literal regexp syntax 22:04 jonrafkind: with a regex literal you could write #rx/\d/ 22:04 eli: s/in a different way/in plain source code/ 22:04 jonrafkind: instead of #rx"\\d" 22:04 Pauan: so you can just say "\d" rather than "\\d" 22:04 eli: Yes, I realize that this is what you want. 22:05 Pauan: then I guess it's a simple question: is there any hope of such a syntax making it's way into Racket anytime in the near future? 22:05 eli: But what I'm saying is that this is essentially a request for a *string* syntax that does not have *string*-level backslash escapes. 22:05 jonrafkind: yes 22:05 Pauan: it doesn't have to be delimited by quotes 22:05 Pauan: it could use / 22:06 jonrafkind: it can use anything for delimiters if a reader macro is used 22:06 Pauan: so for instance, #rx/foobar/ 22:06 eli: Such a string syntax would be useful (for both regexps and plain strings) *except* when you need one of those backslash characters. 22:06 (join) freakazoid 22:06 jonrafkind: then you escape the backslash in the regex 22:06 eli: Pauan: As long as you're mentioning python, then at least generalize it and face the fact that you want a different *string* syntax. 22:07 Pauan: not necessarily 22:07 Pauan: I'm fine if the new syntax applies only to regexps 22:07 Pauan: and not strings in general 22:07 eli: Pauan: Sure, r'bleh' is just a string. 22:07 eli: (In python.) 22:07 Pauan: I merely mentioned Python because it currently handles things better than Racket in that regard. 22:07 Pauan: I personally prefer the // delimiters used in JavaScript 22:07 eli: In any case, I personally see little use for such a feature. 22:08 eli: But you can hack whatever you want, or, like Sam mentioned, use the scribble @-form syntax. 22:08 eli: (Which is far better than what python's 300 kinds of quotes give you.) 22:11 eli: jonrafkind, Pauan: http://tmp.barzilay.org/x -- optimize to taste. 22:11 jonrafkind: not a perfect solution but it will do for now, ozzloy ^ 22:11 eli: jonrafkind: Why isn't it a perfect solution? 22:12 jonrafkind: because you need to define `rx' and add the at-exp reader to your module 22:12 jonrafkind: neither of those things are obvious 22:13 eli: jonrafkind: Defining `rx' is just like how we usually add new stuff. In any language. 22:13 jonrafkind: yes I know its obvious for you 22:13 RackN00b: Is there a built-in function to flatten a list consisting of x number of flat lists? 22:13 eli: jonrafkind: Huh? Is there a language where you add definitions without names? 22:14 jonrafkind: whats not obvious is that you need to implement `rx' at all 22:14 eli: As for using the `at-exp' reader -- that would be a valid feature request (making it part of the default language). 22:14 jonrafkind: because of the way scribble works 22:14 (join) rudybot 22:14 eli: jonrafkind: Say that you want some `foo' function; how is it not obvious that you need to implement `foo' to get it? 22:14 jonrafkind: why do you need foo? 22:15 offby1: Gentlemen, you can't fight here. This is the War Room. 22:15 Pauan: RackN00b: Do you want to flatten all the lists completely into a single flat list, or only flatten it one level? 22:15 RackN00b: one level only 22:16 jonrafkind: eli, remember when I told you that I learned of the string-append trick only by looking at your scribble code at one point? thats not an obvious thing to do 22:16 offby1: rudybot: doc flatten 22:16 rudybot: *offby1: http://docs.racket-lang.org/reference/pairs.html#(def._((lib._racket%2Flist..rkt)._flatten)) 22:16 offby1: rudybot: doc Holiday 22:16 rudybot: *offby1: not found in any library's documentation: Holiday 22:16 RackN00b: oooh 22:17 Pauan: right, but flatten isn't just one level 22:17 Pauan: it may work for you, though 22:17 eli: jonrafkind: That's one of the things that I think I included in every kind of text on @-forms. 22:17 RackN00b: Maybe... 22:17 eli: s/one of the things/the major thing/ 22:17 offby1: rudybot: (define (one-level-flatten . seqs) (apply append* seqs)) 22:17 rudybot: *offby1: Done. 22:17 offby1: rudybot: (one-level-flatten ' ((a b c) (d e f))) 22:17 rudybot: *offby1: ; Value: (a b c d e f) 22:18 RackN00b: append* ? 22:18 offby1: append* . 22:18 offby1 nods gravely 22:18 offby1: rudybot: doc append* 22:18 rudybot: *offby1: http://docs.racket-lang.org/reference/pairs.html#(def._((lib._racket%2Flist..rkt)._append*)) 22:18 RackN00b: I am takin a peek 22:18 Pauan: append* is basically (apply append ...) 22:18 eli: jonrafkind: BTW, another possible extension is to make `regexp' accept any number of inputs and append them -- then you don't even need a new definition. 22:18 jonrafkind: well yes thats good 22:20 RackN00b: cool 22:20 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/u9XQew 22:20 RacketCommitBot: [racket/master] clean up the way the state of the online expansion GUI is kept. - Robby Findler 22:20 RackN00b: What exactly does rubybot do, btw? runs code you enter? 22:25 rudybot: among other things 22:25 offby1: rudybot: source 22:25 rudybot: *offby1: git clone git://github.com/offby1/rudybot.git 22:32 eli: Pauan: BTW, Python is a good example of how to start with a seemingly naive goal of "make things simple", and end up with a mess of 8(!) different kinds of quotations. 22:32 eli: Its only excuse would be "it's better than sh-style quotes". 22:33 Pauan: I do not recall implying that Python was a good language. I personally do not use it anymore and do not consider it a particularly good language. 22:33 Pauan: Why do you think I'm on the #racket IRC if I loved Python? 22:33 eli: They're not mutually exclusive. 22:33 Pauan: I mentioned it because Python's raw strings are currently better than Racket's syntax for regexps; nothing more, nothing less. 22:34 eli: In any case, the more popular JS-like syntax for just /.../s is a little better but messy too. 22:34 Pauan: no doubt 22:34 eli: One thing that it makes hard is dealing with /s for other uses. 22:34 Pauan: just about *any* string syntax suffers from quotation issues 22:34 eli: Another is that the supposed way which "things get simple" tend to leak into the regexp syntax. 22:35 Pauan: of course, one could go the Perl way, and say that the character after #rx is the delimeter 22:35 eli: An example for that is exactly how they deal with newlines -- usually you end up defining a regexp-level backslash-n sequence for matching newlines, 22:35 Pauan: so then you could say #rx@foo@ or anything you like 22:35 Pauan: ...but that too is complex, etc. 22:35 eli: which means that, in the current racket syntax, #rx"\n" and #rx"\\n" match the same thing, even though the regexps are different. 22:36 eli: Yes, that #rx@foo@ thing is another common way to make things simple, but it suffers from the same problem. 22:37 (quit) jeapostrophe: Ping timeout: 240 seconds 22:37 eli: By using an initial "@" delimiter you say that you want it to also be used to terminate it, but you don't really say anything about the use of backslashes. 22:37 Pauan: small anecdote: when I first read the Racket docs for regexps, I was pleased that Racket supported regexps natively, and even more so that Racket supported regexp literals... until I realized that #rx is just a string, so you need to double-escape the \s 22:38 Pauan: it doesn't make sense to me to include a regexp syntax... that's just a thin wrapper around a string 22:38 Pauan: but so it is 22:38 Pauan: in my opinion, a string literal should be a string, and a regexp literal should be a regexp 22:38 eli: IOW, just having a customizable delimiter makes it possible to easily use double-quotes in the string, as in #rx@foo"bar@, but it doesn't say anything about what #rx@foo\nbar@ would be -- and specifying that gets into a non-uniform syntax in a potentially very confusing way. 22:39 eli: Pauan: They are the same -- of course -- the problem that you're talking about has almost nothing to do with regexps. 22:39 eli: The only thing that relates it to regexps is the fact that using backslashes is more common in regexp strings. 22:39 Pauan: actually, it does, because regexp syntax conflicts with string syntax, which is why you need the double \ in the first place 22:40 eli: No, they don't conflict -- since you still need the string-level quotes. 22:40 Pauan: why? 22:40 Pauan: you're writing a regexp 22:40 Pauan: so why would you need the string-level escapes? 22:40 eli: Because you need to include newlines, and NULs, etc. 22:40 eli: How would you write a regexp that matches a NUL character? 22:40 Pauan: that's handled by the regexp syntax \n and \x00 22:41 eli: You can't make \0 be a NUL character, since it already has a meaning for regexps. 22:41 eli: Same goes for the regexp that is Pauancurrently written as "\1" 22:42 eli: (Which, incidentally, is useful for parsing IRC text.) 22:42 Pauan: I think we're thinking of different things, here... 22:42 Pauan: I'm thinking of regexp syntax as a way to create a regexp that matches characters. In other words, #rx"\x00" would create a regexp that matches a single NUL character. 22:42 Pauan: what you're saying is, it needs to be at the string level 22:43 Pauan: you need to insert the NUL directly INTO the string 22:43 Pauan: hence, the string-level escapes 22:43 eli: Yes. 22:43 Pauan: but why can't the regexp parser, when it sees "\x00" 22:43 Pauan: it will say, "aha, I know that's a NUL 22:43 Pauan: and then match it? 22:43 Pauan: that I believe is how other regexp parsers do it, and then avoids the complication between string-level and regexp-level escapes 22:43 eli: So you're adding a backslash-x syntax for octals? 22:43 Pauan: that is the regexp syntax... 22:44 Pauan: /\x00/.test("\x00") in JS returns true 22:44 eli: No, that's not Racket's regexp syntax. 22:44 Pauan: you may say "that's not Racket's regexp syntax" 22:44 Pauan: but it is the regexp syntax used by other popular languages 22:44 Pauan: so it's a matter of how close you want Racket's regexps to be to other implementation's 22:45 (join) jeapostrophe 22:45 Pauan: but considering that Racket already contains "Perl-style" regexps, it would appear that Racket cares at least a little about interoperability 22:45 eli: Do you realize that in that example -- /\x00/.test("\x00") -- the two backslashes are different things? 22:45 Pauan: yes, the first is a regexp backslash 22:45 Pauan: the second is a string escape 22:46 Pauan: the string contains a single character: NUL 22:46 Pauan: whereas the regexp is the string "\\x00" 22:46 eli: And you don't see a problem with that confusion? 22:46 Pauan: nope 22:46 Pauan: because regexp syntax (and escapes) are different from string escapes 22:46 Pauan: so when I'm writing a regexp, I'm not in string mode 22:46 Pauan: string-thinking mode* 22:48 Pauan: what I'm saying is that regexp literals are different from string literals, so I think #rx"\d" should be equivalent to the string "\\d", because hey, it's a regexp literal, not a string literal 22:48 Pauan: you may, I suspect, disagree 22:51 eli: Pauan: Right -- and that can only work sanely if regexp escapes include all string escapes, or vice versa. 22:51 eli: But that can't happen. 22:51 eli: (At least I think it can't.) 22:51 Pauan: they don't necessarily need to include all string escapes 22:52 Pauan: just the ones that other regexp implementations provide 22:52 Pauan: like \n 22:52 eli: Here -- \b has two different meanings in regexps and in strings. 22:52 Pauan: that's right 22:52 Pauan: so in regexp literals, \b would be the regexp version 22:52 Pauan: and in string literals, it'd be the string version 22:52 eli: And -- IMO -- that would be utterly confusing. 22:52 Pauan: how is it more confusing than it is now? 22:53 Pauan: right now you have to write \b or \\b depending on which you want 22:53 Pauan: same level of confusion, imo 22:53 eli: What would /\b/.test("\b") return? 22:53 Pauan: false, I would expect 22:53 eli: Why? 22:53 Pauan: well... 22:53 Pauan: actually 22:53 Pauan: it depends on the semantics of \x 22:53 Pauan: \b* 22:53 eli: Which one? 22:53 Pauan: the regexp one 22:53 Pauan: it's a regexp literal 22:53 Pauan: so it uses the regexp syntax 22:53 eli: (No, it depends on both...) 22:54 Pauan: which means it uses the regexp semantics 22:54 Pauan: (it returns false in Chrome, by the way) 22:54 eli: Why does it return false? 22:54 Pauan: in JavaScript, a regexp literal is a regexp literal 22:54 Pauan: period 22:54 Pauan: if you want a string literal, you write RegExp("foobar") 22:54 eli: Still doesn't answer the question: why does it return false? 22:54 Pauan: because \b is the "word boundary" regexp token 22:54 Pauan: and apparently \b in a string doesn't count as a word boundary 22:55 Pauan: /\b/.test("foo") does return true 22:55 eli: Right -- and you don't think that this explanation is something that 99% of your average programmers would find confusing? 22:55 Pauan: regexps are confusing *in general* 22:55 jonrafkind: no 22:56 Pauan: regexps are ridiculously hacky and concise 22:56 Pauan: to a fault 22:56 Pauan: that's just their nature 22:56 eli: I can only answer those answers with: you have a way too optimistic opinion on that average programmer. 22:56 eli: s/answer/reply to/ 22:57 Pauan: okay, eli 22:57 Pauan: here's how my proposal would work 22:57 Pauan: (regexp-match "\b" "\b") would return a truthy value 22:57 Pauan: because it's matching a string literal 22:57 Pauan: against a string literal 22:57 Pauan: but (regexp-match #rx"\b" "\b") would be #f 22:57 Pauan: because it's matching a regexp literal 22:57 Pauan: against a string literal 22:57 eli: What about (regexp-match #rx"\B" "\B") 22:57 eli: ? 22:57 Pauan: and the regexp literal expands into "\\b" 22:57 Pauan: same thing 22:58 Pauan: if you want a string: use a string 22:58 Pauan: if you want a regexp: use a regexp 22:58 Pauan: right now regexp literals are just glorified strings 22:58 eli: Pauan: and what if you want a regexp that contains a newline? 22:58 Pauan: you'd use \n 22:58 Pauan: because that's the standard newline syntax 22:58 Pauan: in regexps 22:59 eli: So your proposal is actually more than just a syntax -- you also want to extend the regexp syntax, right? 22:59 Pauan: assuming the regexp engine doesn't currently support "\\n" as matching a newline... 22:59 Pauan: then yes 22:59 eli: You want both (regexp-match "\n" "\n") and (regexp-match "\\n" "\n") to return true, right? 22:59 Pauan: yes 23:00 Pauan: and the same for all other standard escapes 23:00 eli: OK, so now you see what I meant when I said "tend to leak into the regexp syntax"? 23:00 Pauan: (though \n is the most common) 23:00 Pauan: oh no doubt 23:00 Pauan: regexps are clunky 23:00 Pauan: they have an incompatible syntax with strings 23:00 eli: Do you see the mistake in what you said above? 23:00 eli: "same for all other standard escapes" 23:01 Pauan: no... 23:01 Pauan: "standard escapes" meaning "what other regexp implementations support" 23:01 eli: You can't do that for all of them. 23:01 Pauan: not "standard Racket string escapes" 23:01 Pauan: other regexp engines support \n 23:01 Pauan: so it's standard regexp syntax 23:01 Pauan: but they don't support all the Racket string escapes 23:01 Pauan: (or at least, I would think not!) 23:01 eli: Do they support \" too? 23:02 Pauan: hm 23:02 Pauan: do you mean with the // delimiters or "" delimiters? 23:02 Pauan: in JS, you can just do /"/.test("\"") 23:02 Pauan: because there's no " delimiter 23:02 Pauan: but if you use string syntax... 23:02 Pauan: that would be RegExp("\"").test("\"") 23:02 Pauan: so I suppose you'd have to support that, if you were going to use #rx"..." 23:03 Pauan: thus, #rx"\"" would match a single " character 23:03 eli: No, I'm talking about: /\"/.test("\"") 23:03 Pauan: yes, that's true 23:03 Pauan: apparently, \ when not followed by a special character 23:03 Pauan: just returns that character 23:03 eli: Yes, I can see the result in my browser. It's the confusion that I'm talking about -- is that backslash-" or not? 23:04 Pauan: it's the same result either way 23:04 Pauan: which is different from Racket, which errors when given an escape it doesn't understand 23:04 Pauan: I guess the question is: how much does Racket care about regexp compatibility with other regexp engines? 23:05 Pauan: if the answer is: not very much, then I guess I can see that literal regexp syntax wouldn't be very appealing 23:05 eli: That (erroring more) is BTW, a very common thing for Racket to do. 23:05 Pauan: but if the answer is: a lot, then literal regexp syntax would be very useful 23:06 Pauan: in other words, it's useful to be able to find a regexp that somebody wrote (in a different language) and paste it into a Racket regexp literal and have it work 23:06 Pauan: rather than having to go in and escape the backslashes 23:06 Pauan: but not escape them for \n or others 23:06 Pauan: etc. 23:06 eli: There are two kinds of compatibility you can talk about -- the semantics of regexps, and the syntax. 23:06 Pauan: yes 23:06 Pauan: I assume Racket's semantics are already very compatible 23:06 Pauan: so I'm talking about the syntax 23:06 eli: You're currently talking about the second, which is inherently a less interesting problem in the racket world. 23:07 Pauan: then it comes back to my question earlier: is there any hope of such a syntax making it's way into Racket anytime in the near future? 23:07 eli: But when you're talking about that, the danger is that leak into the first part. 23:08 eli: For example, that design eventully leads JS to do just that -- accept any \whatever escape, and if it's not a known escape, then make that the same as just whatever. 23:08 eli: For example, in JS I get true for: RegExp("\\z").test("z") 23:09 Pauan: I suspect they copied it from Perl, actually, but I'm not a Perl programmer 23:09 eli: Alternatively, for /\z/.test("z") 23:09 Pauan: for better or worse, Perl regexps *are* regexps, as far as the average programmer is concerned 23:09 eli: Now, this means that someone, somewhere has a regexp with \z in it. 23:09 eli: And now if you find some great new extension for regexps you have a problem where to hook it. 23:10 eli: If you want to hook it onto \z, you end up breaking that someone's code. 23:10 Pauan: yup! regexps are a mess 23:10 eli: Right. 23:10 eli: In the JS world, this is basically a guarantee that regexps would never be extended. 23:11 eli: The design decisions in Racket tend to go differently. That is, if you can, then throw an error so a future extension can be possible without destroying the world. 23:11 eli: (Incidentally, this is why we ended up having `#px' in addition to `#rx'.) 23:11 Pauan: well then, I'll take that as a "no", in which case I guess that settles that 23:12 eli: It's not really a "no". 23:12 eli: I'm trying to get you to find a way to face the syntax problem independently from the semantics problem. 23:13 Pauan: No, I'm aware that Racket does things differently, and that there are reasons for it. 23:13 eli: A suggestion that does that would be interesting, yet I didn't see such a thing, yet. 23:13 Pauan: But regexps did not originate in Racket, yet Racket is trying to copy them from the outside world. 23:13 Pauan: and I'm pointing out an inconsistency with regard to that outside world 23:14 Pauan: whether that inconsistency is good or not is a different matter 23:14 eli: Exactly. 23:15 Pauan: so what I'm saying is basically, "yes regexps are clunky, but hey, they work (sorta), and other languages with regexps do it this way, so it would be easier for people new to Racket (or new to regexps) if the syntax were more consistent" 23:15 eli: An argument such as "Racket should support a regexp \n syntax (as #rx"\\n") to match newlines because do that" is likely to work. 23:15 Pauan: you may have different priorities, and think that solving the syntax irregularities is more important than matching syntax 23:15 eli: But the same argument applied to \ is much less likely to work. 23:15 Pauan: but that argument is only really useful if a better regexp literal syntax is *also* supported 23:16 Pauan: why would anybody write "\\n" rather than "\n"? 23:16 Pauan: thus supporting "\\n" is only useful with a corresponding regexp literal syntax 23:16 (quit) jeapostrophe: Ping timeout: 248 seconds 23:16 eli: I'm just phrasing the argument using the current syntax -- independent of the syntax that you want to end up with. 23:16 Pauan: but the whole premise of the argument is based on the syntax 23:17 Pauan: it's based on the idea that "hey, there's too many backslashes in here!" 23:17 Pauan: so whether Racket supports "\\n" or not is pretty independent of the syntax, yes 23:17 eli: I don't see why. The argument is simply pointing at a certain regexp escape that racket doesn't have. 23:17 Pauan: I just don't see a *reason* to support "\\n" *without* the syntax 23:17 Pauan: right 23:17 Pauan: but, why would I make that argument? 23:17 eli: Um, you talked about interoperability -- that's what I'm talking about now. 23:17 Pauan: "let's add in \\n syntax and be done with it" 23:18 eli: It's interoperability of regexps, much more important than interoperability of "code" since the latter is a dead case anyway. 23:18 Pauan: okay, let's back up. When writing regexps in Racket, it's annoying to have to type two backslashes for certain things, like character classes 23:19 Pauan: i.e. having to write "\\d" rather than just "\d" 23:19 Pauan: string syntax isn't going to change to accomodate that 23:19 eli: Once that's settled, you can continue with the syntax argument -- and if the answers to the previous questions was "yes, we'll add them", then that becomes easier. 23:19 Pauan: what I'm saying is 23:19 eli: (But that's a question of what exactly will get in.) 23:19 Pauan: adding in \\n syntax is *necessary* for regexp literal syntax 23:19 Pauan: so discussing it is good 23:20 Pauan: but I don't see discussing \\n by *itself* as very useful 23:20 Pauan: because you can already just use \n 23:20 Pauan: but hey, if you want to discuss that first, then okay 23:20 Pauan: so how about adding in \\n syntax to Racket regexps? 23:21 eli: Yes, I know all that -- I'm trying to get you to come up with an organized argument -- more organized than "backslashes are evil, I want less". 23:22 eli: So, having a \n regexp escape is one step, now you need to check the list of these things that is getting used, and clealy list them all. 23:22 Pauan: I'm not sure how it can be more organized than... #rx"\d" is a regexp literal which will expand into the regexp string "\\d" 23:22 Pauan: oh, you want a list? 23:22 Pauan: okay 23:22 eli: No -- we already have \d (using regexp escape here). 23:22 eli: Just the new things. 23:22 (part) RackN00b 23:23 Pauan: right 23:23 eli: The big question here -- and I really don't know the answer to it -- is how important is it to have the hack of \ match . 23:23 eli: That one would be a much bigger pill to swallow. 23:23 Pauan: I don't think that's useful, personally 23:23 Pauan: if you *really* cared about interop, then sure, add it in 23:24 Pauan: but I'm not *that* huge of a stickler for it 23:24 Pauan: so I'm fine with \\ throwing an error for escapes it doesn't know about 23:24 eli: No, I'm saying that adding that one goes against a certain common theme in Racket's design. 23:24 eli: If it's not essential, then that's good news for your proposal. 23:24 eli: (Since it means that there's a small number of escapes to add, and nothing else. Then the syntax issue is easy to talk about.) 23:25 Pauan: the only really essential thing is less backslashes, and \\ matching any character isn't helpful in that, really 23:26 Pauan: I'm just going to make a list of all \\ escapes that Racket currently doesn't support 23:26 Pauan: (as you say, it should be a small list) 23:26 (join) shofetim 23:26 eli: Yes. 23:27 Pauan: ...okay, I'll only list the *common* ones 23:27 (join) dnolen 23:27 Pauan: I don't think \a \e \f \v are that useful... 23:27 eli: When you're done, post it to the list. 23:27 Pauan: the Racket mailing list? 23:27 eli: Yes. 23:27 Pauan: alrighty 23:32 (quit) dnolen: Quit: dnolen 23:34 shofetim: How do I add a doctype to an xexpr/response? I don't see anything in the docs, the only thing I see in the mailing list archives refers to make-xexpr-response which doesn't seem to be in the docs either... 23:39 Pauan: eli: when posting to the Racket mailing list, should I insert newlines every 80 characters, or is overflow ok? Also, should it be in users or dev? 23:47 eli: Pauan: I personally prefer well-formatted emails, not the HTML kind, or the kind where people write long lines and expect clients to show it sensibly, but it's a mailing list so do whatever you want. 23:48 ozzloy: oh man, i missed quite the discussion 23:48 eli: Pauan: As for the list, either one will work, with the obvious differences: more people on users, and potentially more distracting noise -- this might be good for what you want (if many people say how much they'd love to have that), or bad (having the discussion drown in that noise). 23:49 Pauan: Well, the topic is just adding in regexp escapes that Racket currently doesn't support: not terribly interesting or exciting in and of itself 23:49 Pauan: even more so since the escapes don't really add in new functionality 23:50 eli: Yeah, but you'd want to motivate it, and that's where the fun begins... 23:55 ozzloy: eli, could you go through the same exercise you just did with Pauan with me? i didn't quite follow it when scanning 23:55 ozzloy: the backlog 23:55 ozzloy: i too would like less \ when typing out my regex 23:57 eli: ozzloy: That would take a lot of typing... Just read it carefully... 23:57 ozzloy: k 23:58 Pauan: long story short: before we can even consider better regexp literal syntax, we need to get some regexp escapes added in, which I'm writing up now