00:00 offby1: no effing clue. 00:00 offby1: next question. 00:06 (topic) -: Racket -- http://racket-lang.org/ (logs at http://racket-lang.org/irc-logs/ ) 00:06 (names) -: gabot mithos28 eli lewis1711 mwolfe jonrafkind tewk erikc martinhex Demosthenes chturne Fare corruptmemory jbd saint_cypher offby1 MK_FG Tasser Lajla abbe Fill zakwilson jrm-rnl _p4bl0 misterm danking jeapostrophe stamourv em bremner rien_ hyko shachaf cky drhodes alexsuraci` mattmight @ChanServ clklein Guest74073 mario-goulart rapacity fds rudybot fmu lisppaste askhader 00:06 (quit) stamourv: Ping timeout: 265 seconds 00:06 rapacity: have you considered reading other people's codes that used the ffi? 00:07 lewis1711: not a bad idea 00:08 rapacity: I'm not sure if you've checked them, but in collects/ffi/examples there are a bunch of examples for it 00:10 rapacity: they're a bit old though 00:12 lewis1711: yeah. I can't even read it 00:14 rapacity: rudybot: (require ffi/unsafe) 00:14 rudybot: rapacity: Done. 00:15 rapacity: rudybot: (quit) 00:15 rudybot: rapacity: error: reference to undefined identifier: quit 00:15 offby1: rudybot: are you just rapacity's slave now? 00:15 rudybot: *offby1: in those cases I would get a slave to transcribe it for me 00:15 offby1: rudybot: you can write? 00:15 rudybot: *offby1: To wgreenhouse's point: SICP can write, "Call-with-current continuation blah blah blah..." at the beginning of a sentence. It seems like a small point, but I feel that that property of the language was important to the culture. 00:15 rapacity: rudybot: (exit) 00:15 rudybot: rapacity: error: evaluator: terminated (exited) 00:15 rudybot: ha ha ha 00:15 rapacity: :p what? 00:16 rapacity: I wanted to see if you allowed ffi/unsafe but I didn't need the interpreter so I closed it 00:17 rapacity: hmm I wonder if an error with ffi/unsafe would leak out of the sandbox 00:17 offby1: shouldn't. 00:17 offby1: try it! 00:17 offby1: I dare ya 00:17 rapacity: :p 00:18 offby1 pokes rapacity 00:18 offby1: c'mon@! 00:19 offby1 berates rapacity and insults his lineage, manhood, etc 00:19 rapacity: :p 00:19 rapacity: I'm trying it locally first 00:20 rapacity: rudybot: (require ffi/unsafe/atomic) 00:20 rudybot: rapacity: your sandbox is ready 00:20 rudybot: rapacity: Done. 00:21 rapacity: rudybot: (define (x) (thread (lambda () (printf "AA"))) (thread (lambda () (call-as-atomic (lambda () (printf "BBB")))))) 00:21 rudybot: rapacity: error: eval:1:67: compile: access from an uncertified context to protected variable from module: "/usr/local/plt/collects/ffi/unsafe/atomic.rkt" in: call-as-atomic 00:21 rapacity: rudybot: call-as-atomic 00:21 rudybot: rapacity: error: eval:1:0: compile: access from an uncertified context to protected variable from module: "/usr/local/plt/collects/ffi/unsafe/atomic.rkt" in: call-as-atomic 00:22 rapacity: same error I got locally :p 00:28 (quit) mithos28: Quit: mithos28 00:37 (part) lewis1711 00:56 em: im done. i fixed it. This is my first program (not just in Racket but in any language, ever) http://paste.lisp.org/display/119162 00:56 em: offby1: ^ 00:58 offby1: yikes, pretty long 01:00 offby1: egad 01:00 offby1: it seems to have modified the input file! 01:01 offby1: it also seems to give odd results. 01:02 offby1: I created /tmp/testdir/rawhtml.txt, whose contents were (modulo some line breaks): 01:02 offby1: sorry 01:02 offby1: whose contents were:

Hi folks

01:03 offby1: after running the program, I found in "sorted-wordcount.txt": 01:03 offby1:

Hi folks

01:03 offby1: oops 01:03 offby1: .... 2 01:03 offby1: and 01:03 offby1: hi .... 2 01:03 offby1: both those those two lines seem wrong. 01:03 em: id say so! 01:03 offby1: the first seems to be telling me that the empty string appeared twice. 01:03 offby1: the second seems to be telling me that the word "hi" appeared twice. 01:04 offby1: The first is uninteresting, if not wrong; the second is simply wrong. 01:04 em: did you run the program twice? 01:04 offby1: don't think so 01:04 offby1: on the other hand, if this is your first-ever program ever ... 01:04 em: if you run the program twice it will just add the line to rawhtml.txt 01:04 em: i just keep deleting that. 01:04 offby1: lemme delete that file and run it again. 01:04 offby1: gosh, now it says that "hi" appears four times. 01:04 em: same with the sorted-wordcount.txt 01:05 offby1: I think that's related to its modification of the input file. 01:05 em: it might be including the sorted-wordcount file in what it's reading. 01:05 offby1: as it happens, I'm a bit ... distracted at the moment. 01:05 em: try deleting both rawhtml.txt and sorted-wordcount.txt 01:05 em: it reads every thing that's a file in that directory as part of its data. 01:06 offby1: But I actually think that's a good thing: your program should be so simple, so obvious, so robust, that even a distracted person can run it and find it useful and comprehensible. 01:06 em: hehe true 01:06 offby1: if I delete rawhtml, won't it then have no input, and whine at me? 01:06 offby1 duly tries anyway 01:06 offby1: it whined. 01:06 offby1: I knew it would. 01:07 em: i wonder if it is because you created your file named the same thing that rawhtml.txt is going to be called. I would have called that "anything-else.html or something. 01:07 offby1: ok, but will your program somehow know how to read that file? 01:07 em: it looks for files in testdir and combines them all into rawhtml.txt, it creates rawhtml.txt for you. 01:08 em: yes and then it reads rawhtml.txt itself. 01:08 offby1: hmm, mysteriouser and mysteriouser. 01:08 offby1: it did indeed create a rawhtml.txt file. 01:08 em: yep 01:08 offby1: alas, the sorted-wordcount.txt file is empty. 01:08 em: so if you create that first it's going to read it and then add to it, which will throw off results. 01:08 offby1: probably my fault since my anything-else.html file didn't have any

in it. 01:08 offby1: Lemm try again. 01:08 em: yes that's why. 01:09 em: i am bravely assuming that any html file will have at least one

pair. 01:09 offby1: well, better: it correctly reports that "hi" appeared once. 01:09 offby1: unfortunately it still tells me about the empty string. 01:09 offby1: or maybe it's a string with a single space in it. 01:09 em: that's very likely. 01:10 offby1: if this is really your first program ever, then I'm impressed. 01:10 em: maybe im not too sure because if it really was counting those, they would be very common and i never noticed those showing up when i did this with a gig of webpage data. 01:10 em: oh thank you. 01:11 offby1: just curious: why are you assuming that your input is HTML? Wouldn't it be easier to just assume the input is raw text? 01:11 em: it's not the first time ive ever made any procedures with scheme. I worked to about 1/3rd the way through SICP. 01:11 offby1: geez, I never made it all the way through SICP. 01:11 offby1: And people pay me to write code :) 01:11 em: But you probably know that those problems are not 'programs' they are like.. ideas. 01:12 erikc: is there a function for running a shell command and getting stdout in a string? 01:12 erikc: before i go write one 01:12 offby1: erikc: absoloosely 01:12 em: For a long time i felt this huge barrier between being able to write algorithms and being able to make programs that 'do something'. Especially since Scheme is the first language im trying to learn. 01:12 em: subprocess ? 01:12 offby1: look for "subprocess" in the index 01:12 offby1: em: ka-chine 01:12 offby1: em: ka-ching 01:13 offby1: rudybot: doc subprocess 01:13 rudybot: *offby1: your scheme sandbox is ready 01:13 rudybot: *offby1: http://docs.plt-scheme.org/reference/subprocess.html#(def._((quote._~23~25kernel)._subprocess)) 01:13 rapacity: gather can be rewritten as (port->list read-char input), if you want to get a directory and its sub directories "in-directory" does that, instead of writing your own using directory-list 01:13 offby1: erikc: for example ^^ 01:13 em: offby1: im getting pretty familiar with the documentation :P 01:13 offby1: good 01:13 erikc: yea, found that one, k 01:13 erikc: wasnt sure if there was something higher level 01:14 offby1: there are a bunch of procedures like "subprocess". It's kind of confusing. 01:14 em: offby1: hey i just noticed a pretty big typo in something i said above. I meant that i worked 1/3rd the way through CHAPTER 2 of SICP. Not the book. 01:14 erikc: im just turning a bash script into a racket script and building up whatever macroing i need for pipes 01:14 offby1: if I recall correctly, if you carefully read all the dox, you'll probably find one that has the right combination of features that you want. 01:15 offby1: em: Oh :-) 01:15 offby1: erikc: many have gone where you're going; none arrived 01:15 offby1: erikc: a Mr Shivers got the furthest. 01:16 em: I got up to about where it has those pictures of the first president of MIT. Then I burnt out. 01:16 (join) lewis1711 01:16 offby1: :) 01:16 em: offby1: Have you heard of project euler? 01:16 offby1: I remember those. 01:16 fds: offby1: Just wait, I'll resurrect Scsh! 01:16 offby1: em: Project Euler! Of course. 01:16 offby1: I submitted a few, I think. 01:16 offby1: never made it to the point where I registered on their Wall of Fame, though. 01:17 offby1: em: https://github.com/offby1/project-euler in fact. 01:17 offby1: guess what programming language I used. 01:17 offby1: Just guess. 01:17 fds: Perl? 01:17 em: Ive never done those but i think i get the gist of those. I make a distinction between 'algorithms' which are like solving project euler problems, and 'prorams' which are like using racket to interact with the outside world and create something new. 01:18 erikc: offby1: im not interested in a scheme shell so much as moving 20kloc of bash scripts to something sane :) 01:18 em: I felt like Scheme was hard to get from 'making algorithms' to 'writing programs' but now I think Racket makes it possible. 01:18 erikc: they'll probably be like 2k of scheme 01:19 offby1 slaps fds upside the haid 01:19 erikc: racket and drracket work on aix quite well heh 01:20 em: offby1: I have a feeling Scheme is probably exceptionally well suited to project euler type problems. 01:20 offby1: erikc: alas, racket is probably not the obvious choice. 01:20 offby1: em: it's OK. 01:20 erikc: it isnt, perl or pythong is 01:21 offby1: It's my choice for project Euler, since it's my favorite and I'm familiar with it, but other languages are probably fine too. 01:24 offby1: erikc: I'm glad to see that someone besides me misspells python as "Python". 01:24 offby1: Python. 01:24 offby1: GAASH 01:24 offby1: I have my IRC client autocorrecting! 01:25 offby1: 01:25 offby1: pythong 01:25 offby1: *whew* 01:25 offby1: anyway. 01:25 offby1: I used to do that so much that I taught my IRC client to autocorrect it. 01:26 em: hehehe 01:27 offby1: http://ix.io/1rc, all my typos, for all the world to see 01:28 offby1: you could probably work up a good psychological profile of me from that. 01:28 erikc: :) 01:28 em: facebook and google are salivating at the thought. 01:29 offby1: alas, it doesn't seem to reveal any brand preferences, apart from Emacs. 01:30 fds: Heh, "Gentlemen, you can't fight here. This is the War Room." 01:31 offby1: em: I think your distinction between "algorithms" and "programs" is roughly equivalent to "academic wanking" and "the real world", if you'll pardon my French. 01:36 erikc: (display (port->string (first (process "/usr/bin/echo 'hi\nthere'")))) 01:37 (quit) erikc: 01:40 offby1: let's try that out! 01:40 offby1: rudybot: (display (port->string (first (process "/usr/bin/echo 'hi\nthere'")))) 01:40 rudybot: *offby1: error: reference to an identifier before its definition: process in module: 'program 01:40 offby1: :-( 01:41 offby1: curious 01:41 offby1: dox imply it should be available 01:42 rapacity: I have it on my version 01:42 rapacity: 5.0.99.7 01:43 offby1: rudybot: version 01:43 rudybot: *offby1: 0e4bd7e 01:43 rapacity: rudybot: (version) 01:43 rudybot: rapacity: ; Value: "5.0.1" 01:43 offby1: hmph 01:43 rapacity: docs should be 5.0.2 01:45 offby1: guess I need to update rudybot. 01:46 offby1: of course, simply passing a string to the shell is ... icky. 02:08 (quit) mwolfe: Remote host closed the connection 02:36 lewis1711: get into my C function without getting corrupted you bastard! 04:24 (part) lewis1711 05:00 (quit) jonrafkind: Ping timeout: 260 seconds 05:05 (join) stis 06:07 (join) mceier 06:37 (join) MayDaniel 06:44 (quit) MayDaniel: Read error: Connection reset by peer 07:13 (quit) Fare: Quit: Leaving 07:23 (quit) em: Ping timeout: 276 seconds 07:25 (join) em 07:47 (join) MayDaniel 07:55 (quit) MayDaniel: Read error: Connection reset by peer 08:54 (quit) Lajla: Read error: Connection reset by peer 08:55 (join) Lajla 08:58 (join) masm 09:21 (part) Guest74073 09:35 em: offby1: yep that's probably a pretty accurate description! I know a little bit of math so the academic questions are still interesting, but I was getting nervous about whether you could do 'real life' programs in Scheme. I think with Racket you can. 09:36 em: offby1: Like, seems like, for reading as much SICP as I did, I do feel intellectually rewarded, but meanwhile my friends who chose python as their first languages were busy making bots and stuff, if you get me. 10:00 (quit) corruptmemory: Quit: Leaving 10:01 (join) MayDaniel 10:40 (join) carleastlund 10:57 (join) PLT_Notify 10:57 PLT_Notify: racket: master Matthew Flatt * 46dc2d6 (2 files in 2 dirs): Scribble: improve `interaction', `examples', etc. for non-text ... - http://bit.ly/if8Pn8 10:57 (part) PLT_Notify 10:57 em: what is, technically speaking the #rx"foo" ? 11:01 (join) evhan 11:10 offby1: it's a regular expression that matches "foo" 11:11 offby1: technically speaking. 11:11 (join) jonrafkind 11:22 (quit) masm: Quit: Leaving. 11:38 (join) mwolfe 11:40 em: offby1: but it's actually a regular expression object. 11:41 em: like if you do (regexp "foo") I think it returns #rx"foo" but what advantage does the new form have over the original? 11:43 rapacity: it's compiled? 11:44 rapacity: so if you're going to reuse that regexp multiple times you're voiding the overhead of recompiling it each time 12:00 offby1: never noticed how similar Clojure's logo is to PLT's: http://clojure.org/file/view/clojure-icon.gif 12:10 (join) masm 12:15 Lajla: offby1, they use a lambda too 12:16 Lajla: They stole PLT's original idea of using a lambda 12:16 Lajla: shame on them 12:18 (quit) MayDaniel: Read error: Connection reset by peer 12:20 (join) PLT_Notify 12:20 PLT_Notify: racket: master Robby Findler * e05e6ef (1 files in 1 dirs): added a missing syntax error check - http://bit.ly/hNzv8w 12:20 (part) PLT_Notify 12:27 offby1: Lajla: well, it's not just that it's a lambda; it's that it's in a circle that evokes the cover of the Grateful Dead's 1973 album "Steal Your Face" 12:27 offby1 nods gravely 12:40 (join) rien 12:46 (join) anRch 13:04 (join) PLT_Notify 13:04 PLT_Notify: racket: master Eli Barzilay * f190e3e (1 files in 1 dirs): Post-release version for the v5.1 release - http://bit.ly/efz37S 13:04 (part) PLT_Notify 13:07 (quit) anRch: Quit: anRch 13:19 (join) anRch 13:22 (quit) mwolfe: Remote host closed the connection 13:26 rapacity: "Steal Your Logo" 13:28 (join) PLT_Notify 13:28 PLT_Notify: racket: master Robby Findler * 4090eab (3 files in 3 dirs): added a color:text method get-token-range and then used that to improve how f1 in drracket works ... - http://bit.ly/glvd2O 13:28 (part) PLT_Notify 13:29 (join) MayDaniel 13:31 (quit) masm: Quit: Leaving. 13:47 (quit) MayDaniel: 13:59 (quit) anRch: Quit: anRch 14:02 (quit) misterm: Read error: Connection reset by peer 14:08 (join) misterm 14:35 (join) mwolfe 14:38 (join) dnolen 14:42 (join) PLT_Notify 14:42 PLT_Notify: racket: master Matthew Flatt * e43fa46 (1 files in 1 dirs): doc typo 14:42 PLT_Notify: racket: master Matthew Flatt * 0e169cf (1 files in 1 dirs): fix version number 14:42 PLT_Notify: racket: master commits 4090eab...0e169cf - http://bit.ly/hT15I0 14:42 (part) PLT_Notify 14:48 (quit) dnolen: Quit: dnolen 14:49 (join) lucian 14:54 (quit) mceier: Quit: leaving 15:42 (join) MayDaniel 15:50 (join) kingless 16:01 (join) anRch 16:27 (join) PLT_Notify 16:27 PLT_Notify: racket: master Casey Klein * 3250ff8 (3 files in 3 dirs): Adds a Redex version of Jay's continuation mark transformation - http://bit.ly/fRN8jw 16:27 (part) PLT_Notify 16:30 (quit) stis: Remote host closed the connection 16:41 (quit) MayDaniel: Read error: Connection reset by peer 16:48 (quit) kingless: Remote host closed the connection 16:51 (join) masm 17:01 (quit) mwolfe: Remote host closed the connection 17:04 (join) MayDaniel 17:09 (join) dnolen 17:09 (quit) dnolen: Client Quit 17:17 (quit) anRch: Quit: anRch 17:19 (quit) MayDaniel: Read error: Connection reset by peer 17:29 (join) mwolfe 18:08 (quit) lucian: Remote host closed the connection 18:10 (join) lucian 18:22 (part) chturne 18:26 (quit) clklein: Remote host closed the connection 18:28 (quit) masm: Ping timeout: 240 seconds 18:29 (join) groovy2shoes 18:29 groovy2shoes: hi, all 18:31 groovy2shoes: Is there a container type that can scroll in racket/gui? Unless I'm missing something, it seems like only a canvas can scroll, but it isn't a container. 18:31 (join) masm 18:55 (quit) carleastlund: Quit: carleastlund 18:58 (quit) groovy2shoes: Read error: Connection reset by peer 18:59 (join) groovy2shoes 19:00 (quit) jonrafkind: Ping timeout: 240 seconds 19:10 em: is there something in racket that can sort of prompt the user of a program for data? 19:12 groovy2shoes: em: you mean something like (display "> ") ? 19:12 rapacity: read-line ? 19:12 (join) RyanRN 19:13 em: No i mean like.. Enter an integer to be squared: 19:13 em: the user types in 10 and then it gives back 100. 19:13 em: a way to interact with the user of the program. 19:15 em: something like (define input (prompt)) 19:15 em: where prompt would wait for some data from the person using it. 19:15 em: and then assign that to input so your program could use it. 19:15 rapacity: read 19:16 fds: (define input (read__ 19:16 fds: (define input (read)) even 19:17 (join) tony_ 19:19 rapacity: I wonder how rudybot deals with prompts d: 19:20 rapacity: rudybot: (define input (read)) 19:20 rudybot: rapacity: your sandbox is ready 19:20 rudybot: rapacity: Done. 19:20 rapacity: rudybot: sff 19:20 rudybot: rapacity: error: reference to undefined identifier: sff 19:20 fds: Badly, I see. :-) 19:20 rapacity: ok so it doesn't 19:20 rien: rudybot: (define input (read)) 22 (display input) 19:20 rudybot: rien: ; stdout: "#" 19:23 em: is there a 'best way' to read a file into a form that is useable? 19:23 offby1: em: interaction is surprisingly tricky. 19:23 offby1: seriously, I'd avoid it as long as I could 19:23 rapacity: (port->list reader input-port) 19:24 em: the way that I did it was I used open-input-file, and then i used read-char to read in one character at a time into a list, and then i turned that list into a string. 19:24 em: It feels like a rube goldberg way, is there a better way? 19:24 rapacity: I mentioned it on the channel yesterday 19:25 em: oh sorry i missed it. 19:25 rapacity: "gather can be rewritten as (port->list read-char input)," 19:25 em: ahh 19:26 em: if you can read one char at a time or one line at a time, why not just one file at a time? 19:26 tony_: why not just use with-input-from-file and getline... 19:26 rapacity: there is file->list 19:26 tony_: (sorry, getline->read-line) 19:27 em: tony_: i dont think sorry, is a built in procedure. 19:28 tony_: em: grrr... 19:29 em: rapacity: so that is for files with text what about like music files or whatever other kind of file? 19:29 rapacity: you'd probably want to do file->bytes 19:30 rapacity: and use binary, though I've never done any programming reading anything other than text 19:31 em: offby1: how is interactivity surprisingly tricky? 19:31 offby1: oh, sometimes your program doesn't "see" any input until the guy hits the Enter key. 19:31 offby1: Then the guy hits Control-C and it hangs 19:32 offby1: all kindsa stuff like that 19:32 em: seems like any kind of gui programs have to be able to take data from a user. 19:32 offby1: yes, but interactivity with guis is reasonable. 19:32 offby1: More complex than the simple programs you've written so far, but not too bad 19:33 em: For my next program id like to do something with a web interface and maybe a database. 19:33 (quit) eli: Remote host closed the connection 20:03 (topic) -: Racket -- http://racket-lang.org/ (logs at http://racket-lang.org/irc-logs/ ) 20:03 (names) -: gabot eli tony_ RyanRN masm lucian mwolfe misterm rien evhan Lajla em tewk martinhex Demosthenes jbd saint_cypher offby1 MK_FG Tasser abbe Fill zakwilson jrm-rnl _p4bl0 danking jeapostrophe bremner rien_ hyko shachaf cky drhodes alexsuraci` mattmight askhader lisppaste fmu rudybot fds rapacity mario-goulart @ChanServ 20:27 (join) sreque 20:40 (quit) tony_: Quit: Page closed 20:54 em: Do any of you know of a webhost that has Racket on it? 20:58 bremner: in what sense? 20:59 em: I dont know somehow so you can use Racket as the backend for a webapp. 21:00 bremner: ah, you're maybe thinking of the web server 21:02 em: Im thinking like, I pay some company to host my website right now, but I assume the same server that hosts the website has to have Racket on it in order to use Racket as the backend for a webapp 21:02 em: I use http://nearlyfreespeech.net 21:04 bremner: em: right, you would need racket on the web host. Most likely you would have to administer it yourself. 21:04 bremner: virtual private servers start at around $10 a month 21:04 em: oh well that's not bad at all. 21:05 bremner: but you have to do the linux administration 21:05 em: I dont understand why do people pay for web hosting when they can get a virtual server for 10 dollars a month? 21:05 em: but i know linux! 21:05 em: i use ubuntu! 21:34 (quit) lucian: Remote host closed the connection 21:35 (join) jonrafkind 22:02 (join) mithos28 22:09 (quit) mithos28: Quit: mithos28 23:15 (join) joe_shmo 23:15 joe_shmo: hey everyone 23:15 (quit) masm: Quit: Leaving. 23:15 joe_shmo: lets say I define a local variable in a recursive function 23:15 joe_shmo: and I'm gonna mutate that local variable throughout the functions 23:16 joe_shmo: when the function recurses, won't it always reset the local variable? 23:18 joe_shmo: you know what I mean? 23:20 (quit) mwolfe: Remote host closed the connection 23:26 jonrafkind: yea, so make a new function to do the recursion in 23:27 jonrafkind: (define (foo) (define x 0) (define (recursive-thing) ...)) 23:27 joe_shmo: ohhhh 23:27 joe_shmo: gotcha 23:28 joe_shmo: lol never thought of that 23:35 (quit) joe_shmo: Quit: Page closed 23:50 Lajla: em, because I pay 2 EUR per month. =P 23:51 Lajla: em, and note how he just said you didn't know linux, assuming so because you are girl subconsciously no doubt. 23:58 (quit) sreque: Quit: Page closed