00:21 (join) RacketCommitBot 00:21 RacketCommitBot: [racket] plt pushed 4 new commits to master: http://git.io/RY8_lg 00:21 RacketCommitBot: [racket/master] Fix requires to avoid circular dependencies. - Asumu Takikawa 00:21 RacketCommitBot: [racket/master] Class contracts for racket/draw. - Asumu Takikawa 00:21 RacketCommitBot: [racket/master] Class contracts for racket/snip. - Asumu Takikawa 00:21 (part) RacketCommitBot 00:45 (join) RacketCommitBot 00:45 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/eR65yQ 00:45 RacketCommitBot: [racket/master] Fix docs for `get-selected-text-color` method. - Asumu Takikawa 00:45 (part) RacketCommitBot 01:04 (join) realitygrill 01:15 (quit) ssbr__: Ping timeout: 252 seconds 01:15 cky: So, apparently, with the version of Racket that rudybot is on, vector->list is busted when srfi/43 is loaded. (It works correctly in Racket 5.2.1, however.) 01:15 cky: rudybot: init 01:15 rudybot: cky: your sandbox is ready 01:15 cky: rudybot: (require srfi/43) 01:15 rudybot: cky: Done. 01:15 cky: rudybot: eval vector->list 01:15 rudybot: cky: error: car: expects argument of type ; given: #f 01:15 cky: rudybot: eval (vector->list '#(1 2 3 4 5)) 01:15 rudybot: cky: error: car: expects argument of type ; given: #f 01:16 mithos28: rudybot: (version) 01:16 rudybot: mithos28: your sandbox is ready 01:16 rudybot: mithos28: ; Value: "5.2.900.1" 01:17 mithos28: rudybot: vector->list 01:17 rudybot: mithos28: ; Value: #list> 01:17 mithos28: rudybot: (require srfi/43) 01:17 rudybot: mithos28: Done. 01:17 mithos28: rudybot: vector->list 01:17 rudybot: mithos28: error: car: expects argument of type ; given: #f 01:17 mithos28: rudybot: (version) 01:17 rudybot: mithos28: ; Value: "5.2.900.1" 01:17 mithos28: iteresting 01:17 cky: Yep. 01:18 mithos28: rudybot: vector? 01:18 rudybot: mithos28: I've got a vector of N^2 length. How can I print a 'square' of N values per line? I know it's trivial, but I haven't done scheme in awhile. 01:18 cky: rudybot: eval vector? 01:18 rudybot: cky: ; Value: # 01:18 mithos28: rudybot: eval vector? 01:18 rudybot: mithos28: ; Value: # 01:18 mithos28: it is not even applying vector->list 01:18 cky: Indeed. 01:19 mithos28: is it a macro? 01:19 cky: No. 01:19 (join) jeapostrophe 01:19 mithos28: positive? many things are macros but act like procedures 01:19 cky: > vector->list 01:19 cky: #list|> 01:19 cky: ^--- 5.2.1 01:19 mithos28: that doesn't mean that the binding is not a macro 01:20 cky: Well, I can't speak about that. :-) 01:20 mithos28: almost all contracted exports are macros 01:20 cky: Right. That's one of those, it seems. 01:21 mithos28: yep it is contracted 01:22 mithos28: https://github.com/plt/racket/blob/master/collects/srfi/43/vector-lib.rkt 01:22 mithos28: who runs rudybot? 01:23 mithos28: looks like offby1 01:23 mithos28: offby1: ping 01:55 (join) RacketCommitBot 01:55 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/h18I3Q 01:55 RacketCommitBot: [racket/master] Moving tests re: Sam - Jay McCarthy 01:55 (part) RacketCommitBot 01:55 (join) Kaylin 02:33 (quit) jeapostrophe: Ping timeout: 245 seconds 02:41 (quit) realitygrill: Quit: realitygrill 02:44 (quit) Skola: Quit: Lost terminal 03:15 (join) fftb 03:23 lewis1711: man some of those racket bench makrs on the shootout are cheating 03:23 mithos28: which ones? 03:23 lewis1711: surely. I mean one of them just opens up a C library with ffi-lib 03:24 lewis1711: hold up 03:24 lewis1711: http://shootout.alioth.debian.org/u32/program.php?test=pidigits&lang=racket&id=2 03:24 rudybot: http://tinyurl.com/3pen4sc 03:26 mithos28: Did you read the comment? It is based on the perl one 03:26 mithos28: http://shootout.alioth.debian.org/u32q/program.php?test=pidigits&lang=perl&id=2 03:26 rudybot: http://tinyurl.com/c57przc 03:26 mithos28: also using gmp 03:26 mithos28: http://shootout.alioth.debian.org/u32q/program.php?test=pidigits&lang=python3&id=2 03:26 rudybot: http://tinyurl.com/bq77ex9 03:26 mithos28: python using gmp 03:27 mithos28: So if its 'cheating', then everyone is doing it 03:27 lewis1711: oh dear 03:27 lewis1711: no wonder that shootout is worthless :D 03:27 lewis1711: the ruby one doesn't do it, and is of course very slow 03:28 (quit) Kaylin: Quit: Leaving. 03:28 mithos28: which isn't a great benchmark, because if you needed to do that you would use gmp 03:28 lewis1711: using foreign libs in language shootouts are a bit like using peroformance enhancing drugs in sport. It's wrong but everyone else is doing it and you have to stay competitive! 03:29 mithos28: I have also made racket ones for mandelbrot and nbody that perform at C speed 03:29 lewis1711: mithos28: yeah but I figured the point of the benchmark was to test numerical speed, not see which language can called gmp the fastest 03:29 mithos28: but invoking the LLVM compiler might be a little over the top 03:31 mithos28: but that requires arbitrary precision arithmetic 03:31 (quit) cdidd: Remote host closed the connection 03:31 mithos28: so you either have a language which has it, use gmp, or implement it in the language 03:32 mithos28: implementing it in the language isn't testing numerical speed 03:32 mithos28: and most languages that have it built in, will be using gmp as the backend 03:32 lewis1711: yeah but still, it then becomes part of the language and fair game IMO 03:33 mithos28: what is part of the language in the racket ecosystem? 03:33 mithos28: only #%kernel? 03:37 mrcarrot: somebody should make a better benchmark site with strict rules 03:37 mithos28: what rules would you want to see? 03:38 mrcarrot: very clear rules telling what is allowed... like this with using foreign libraries or not 03:39 mithos28: In addition to language specific multiprecision arithmetic, we will accept programs that use GMP. 03:39 mithos28: http://shootout.alioth.debian.org/u64q/performance.php?test=pidigits 03:39 mithos28: what is unclear about that 03:39 mrcarrot: ah, okay 03:42 mrcarrot: hmm. haskell is not doing it 03:42 mrcarrot: and it is still pretty fast 03:43 mithos28: what is it not doing? 03:44 mithos28: The Integer type is now provided by a separate integer package, which provides an API that hides the implementation details. By default this is integer-gmp. 03:44 mithos28: http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes 03:44 mithos28: It is using gmp, just the same 03:45 mrcarrot: yeah, but not calling an outside library from the code 03:46 mithos28: I don't understand the distinction 03:46 mithos28: It is calling the library that is baked into the compiler, which by default is gmp 03:58 (quit) fftb: Remote host closed the connection 04:30 (quit) mithos28: Quit: mithos28 04:39 (join) bas_ 04:39 (nick) bas_ -> Skola 04:43 (quit) dous: Remote host closed the connection 05:21 (join) mceier 05:47 (join) gciolli 05:50 (join) masm 07:04 (join) bitonic 07:16 (join) dous 07:50 (quit) dous: Remote host closed the connection 08:02 (part) gciolli 08:05 (part) lewis1711 08:06 (join) RacketCommitBot 08:06 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/G7KZrA 08:06 RacketCommitBot: [racket/master] Synch German string constants with latest. - Mike Sperber 08:06 (part) RacketCommitBot 08:18 (join) fftb 08:24 (join) samth 08:36 (join) dous 08:45 (join) cdidd 09:26 (join) jeapostrophe 09:27 em: for a struct do you do it like this: (struct foo (bar baz #:mutable)) 09:27 em: does that just make the baz mutable or does it make the bar and baz both mutable? 09:27 em: can you add more fields later? 09:31 (quit) noam: Ping timeout: 260 seconds 09:37 (quit) samth: Ping timeout: 246 seconds 09:41 (join) noam 09:51 (join) RacketCommitBot 09:51 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/jY9Shg 09:51 RacketCommitBot: [racket/master] try to improve docs for `make-keyword-procedure' - Matthew Flatt 09:51 (part) RacketCommitBot 10:02 asumu: em: you can't add fields to an existing struct, but you can make sub-structs that inherit. 10:05 em: too hard. I'll just use hashes. 10:06 em: asumu: is it okay to 'initialise' a hash by doing something like (begin (hash-set! .... ) (hash-set! ....) (hash-set! .... ) ) ? 10:06 em: is using (begin ..) frowned on ? 10:15 asumu: em: It's more straightforward to initialize a hash by using #hash(('a . "foo) ...) or something. 10:16 asumu: Also, yes, if you are putting a variable number of keys use a hash. 10:16 asumu: If you have a fixed number of keys, use a struct. 10:18 (quit) jeapostrophe: Ping timeout: 246 seconds 10:19 em: asumu: but #hash(...) makes an immutable hash and i need mutable ones. 10:22 em: asumu: here' something kind of interesting, I tried a (begin (hash-set!...) (hash-set! ....) ) as i described above, and it worked, but the resulting hash does not have the keys in the same order as I included them in the (begin... ) sequence. 10:22 em: its like begin did those sets in some other order than the way I wrote them 10:28 (join) gridaphobe 10:30 em: Im trying to see how do you change an immutable hash into a mutable hash. It isn't in the guide or the reference where it should be. 10:33 (quit) gridaphobe: Ping timeout: 264 seconds 10:33 chandler: em: Hashes are unordered; they'll be printed out in some arbitrary order, but any ordering is equivalent. 10:34 chandler: em: To get a mutable copy of an immutable hash, use `hash-copy'. 10:36 em: chandler: oh and then i can give that copy a new name to work with? 10:36 em: chandler: doesn't a hash have to be mutable if you want to add keys to it, or change the values of existing keys? Otherwise what does mutable and immutable mean? 10:39 (join) gridaphobe 10:43 chandler: em: In a mutable hash, you can mutate the values of keys within the hash object itself. In an immtable hash, you can use the functional update procedures such as `hash-set' and `hash-remove'; these procedures return a new immutable hash table which is like the old one with the update applied. 10:44 chandler: em: Here's an example of how that works: 10:44 chandler: rudybot: eval (define h (make-hash '((a . 1) (b . 2)))) 10:44 rudybot: chandler: your sandbox is ready 10:44 rudybot: chandler: Done. 10:44 chandler: rudybot: eval (hash-ref h 'a) 10:44 rudybot: chandler: ; Value: 1 10:44 chandler: rudybot: eval (hash-set! h 'a 3) 10:44 rudybot: chandler: Done. 10:44 chandler: rudybot: eval (hash-ref h 'a) 10:44 rudybot: chandler: ; Value: 3 10:45 chandler: So, that's a mutable hash. `h' still points to the same hash object, and that hash object has been mutated. 10:45 chandler: Here's an immutable hash: 10:45 chandler: rudybot: eval (define i (make-immutable-hash '((a . 1) (b . 2)))) 10:45 rudybot: chandler: Done. 10:45 chandler: rudybot: eval (hash-ref i 'a) 10:45 rudybot: chandler: ; Value: 1 10:45 chandler: rudybot: eval (hash-set i 'a 3) 10:45 rudybot: chandler: ; Value: #hash((b . 2) (a . 3)) 10:46 chandler: em: Here's a difference: `hash-set!' on a mutable hash returns void; `hash-set' (no exclamation point) on a mutable hash returns a value. Now let's see if the original hash has changed: 10:46 chandler: rudybot: eval (hash-ref i 'a) 10:46 rudybot: chandler: ; Value: 1 10:46 chandler: Nope; it's still the same. 10:47 em: hm. 10:47 em: yeah you didn't change a to 3. 10:48 chandler: Not in the original immutable hash, but `hash-set' returned a new hash where `a' was associated with 3. 10:48 em: yes i see. 10:48 em: i think i probably want a mutable hash then 10:49 asumu: em: what are you using a hash for? 10:49 asumu: (whether you use mutable/immutable depends on what you're doing...) 10:50 asumu: But generally avoiding mutation is nice. 10:50 chandler: Unless you're just exchanging mutation of the hash for `set!' of a global or its equivalent, in which case it makes more sense to use the mutable hash. 10:55 em: im building an application that i can use to keep track certain facts and details about my clients. Like "number of visits", "money spent" etc. 10:56 em: so I have one giant master hash that looks like #hash( ("name" . #hash()) 10:57 em: for each client, and then the hash for that client has stuff like, #hash(("name" . name) ("phone" . phone) ("visits" . visits) ("spent" . hash-of-spent-by-date) ) etc 10:58 em: so then eventually what my app will do is let me enter in stuff like this (visit+ "name") and update the visits part of "name"'s hash. 11:00 em: or (spent "name" 320) and it will (hash-set! (hash-ref (hash-ref master name) spent) "date" 320) 11:00 em: do you get what i have in mind. 11:00 em: it will be a big hash of data that i can quickly update and analyse 11:03 (join) dnolen 11:05 asumu: em: Why not use a struct in this case? Or are you concerned that your representation will change? 11:06 em: asumu: im concerned that since this is new I will not anticipate data i want to start keeping in the future. 11:08 em: so if I want to create a literal mutal hash i would do (hash-copy #hash(("first" . "firstname") ("last" . "lastname"))) ? 11:08 asumu: I see. Well, it's hard to say what you want in this case. It sounds like it's really a DB. 11:08 asumu: What you probably want is make-hash 11:08 asumu: rudybot: doc make-hash 11:08 rudybot: asumu: your sandbox is ready 11:08 rudybot: asumu: http://docs.racket-lang.org/reference/hashtables.html#(def._((quote._~23~25kernel)._make-hash)) 11:09 em: can you just initialise (make-hash) in the first place somehow? like (make-hash ("first" . "firstname") ("last" . "lastname")) 11:09 asumu: rudybot: (define h (make-hash '((a . "Banana") (b . "Grape"))) 11:09 rudybot: asumu: Is there a difference between (make-hash) and (hash) ? 11:09 asumu: rudybot: (define h (make-hash '((a . "Banana") (b . "Grape")))) 11:09 rudybot: asumu: Done. 11:09 asumu: rudybot: (dict-ref h 'a) 11:09 rudybot: asumu: error: car: expects argument of type ; given: #f 11:09 em: asumu: I agree it is probably a database. Im basically making a database from hashes. But i don't have time to figure out databases :) 11:10 asumu: rudybot: (hash-ref h 'a) 11:10 rudybot: asumu: ; Value: "Banana" 11:10 asumu: rudybot: (hash-set! h 'a "Apple") 11:10 rudybot: asumu: Done. 11:10 asumu: rudybot: (hash-ref h 'a) 11:10 rudybot: asumu: ; Value: "Apple" 11:11 asumu: `hash` makes an immutable hash, `make-hash` mutable. 11:11 em: okay 11:11 em: and you just initialise it by using a quote? 11:11 asumu: You initialize it with some list of pairs. 11:11 asumu: Which can be a quoted literal list of pairs or just some list of pairs you have somewhere (e.g. in a variable). 11:11 em: do you have to use cons for that or can you type out (key . "value") ? 11:12 asumu: '(key . value) is a literal pair. 11:12 asumu: So yes. 11:13 em: so you have to put a quote then 11:13 em: i don't get what you said yes to given the way i asked the question, sorry 11:14 em: asumu: but it looked like your key was not a string. 11:14 em: when you did (make-hash '((a . "banana") .. ) 11:15 em: you just typed (a . "banana") and it recognised that as a key-value pair. 11:15 em: and the 'a' was not a string. 11:20 asumu: em: that's because the whole list of pairs is quoted 11:21 asumu: rudybot: '((a . "blueberry") (b . "raspberry")) 11:21 rudybot: asumu: ; Value: ((a . "blueberry") (b . "raspberry")) 11:21 asumu: rudybot: '(a . "blueberry") 11:21 rudybot: asumu: ; Value: (a . "blueberry") 11:21 asumu: rudybot: (a . "fruit") 11:21 rudybot: asumu: error: #:1:0: application: bad syntax in: (a . "fruit") 11:21 em: okay 11:22 em: asumu: is there a way to create a field like '((future . place-holder).. ) 11:22 em: where place-holder is some null value thing that i will set later? 11:22 em: like say i don't know a phone number. 11:22 em: '((phone . ?) .. ) 11:23 em: or maybe just give it a value like 000000000 and overwrite it huh? 11:23 asumu: em: there is no special null value in Racket. 11:23 asumu: Most people use #f for that. 11:23 em: oh okay. 11:23 asumu: Unless #f is something that is otherwise meaningful. 11:23 asumu: In which case there are some tricks you can play to use an value, but it's better to avoid that. 11:24 em: so it would be okay to put like '((phone . #f) .. ) but later on overwrite that with (phone . 212-343-3452 ) etc 11:24 em: just as an initial value 11:24 em: when you do (make-hash) with no extra stuff it seems to make a null hash. 11:25 asumu: Well as long as you design your program with that data definition in mind, that should work. 11:25 asumu: Since #f isn't a valid phone number ever. 11:54 em: Im on Ubuntu, what is (current-seconds) measuring from? 11:54 bremner: probably Jan. 1, 1970 or so. 11:55 em: does the key part of a key-value pair in a hash have to be a string? 11:55 em: I want to make a hash of comments where it is like '(time-of-comment . "my comment goes here it is one big string") 11:57 em: sorry i just realised i can answer some of these questions just by trying it in the repl 11:59 (join) jeapostrophe 12:03 asumu: Yea, REPLs are great. 12:03 bremner: rudybot: init racket 12:03 rudybot: bremner: your sandbox is ready 12:03 bremner: rudybot: eval (- 2012 (/ (current-seconds) (* 24 3600.0 365.25))) 12:03 rudybot: bremner: ; Value: 1969.7531302443786 12:03 bremner <- too lazy to leap years properly 12:04 bremner: hmm. kindof better without "do" 12:05 jamessan: personally, I only leap seconds :) 12:05 em: i look before i leap years 12:06 bremner: good plan. Otherwise you may end up getting old. 12:07 (quit) asdfhjkl: Quit: Leaving 12:09 bremner: jamessan: I have a sneaking suspicion that the problem with libracket3m for $USER is that they are trying to link it to a shared library. In which case it might make more sense to provide libracket3m.so as a private library. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666201 12:10 em: rudybot: init racket 12:10 rudybot: em: your sandbox is ready 12:10 em: rudybot: eval (let ((time-of-post (current-seconds))) (make-hash '((time-of-post . "this is my comment")))) 12:10 rudybot: em: ; Value: #hash((time-of-post . "this is my comment")) 12:10 em: i'm trying to get the key to be the time in seconds when the comment was made 12:10 em: but it is just saying 'time-of-post' 12:14 em: how do you get the key of a hash to be the time/date ? 12:14 em: at the moment you are setting it 12:15 asumu: em: it's because `time-of-post` is a quoted symbol, not the value stored in the variable. 12:15 asumu: You want to use quasiquote and unquote. 12:15 asumu: rudybot: (let ((time-of-post (current-seconds))) (make-hash `((,time-of-post . "this is my comment")))) 12:15 rudybot: asumu: ; Value: #hash((1333210544 . "this is my comment")) 12:16 asumu: see http://docs.racket-lang.org/guide/qq.html 12:16 (join) mithos28 12:16 em: asumu: holy cow 12:19 (join) HBu 12:20 HBu: hi 12:22 HBu: can anyone tell me how to change the user interface language in the drracket ide? it's always in german but I want the interface in english 12:22 mithos28: are you running linux, windows, or mac? 12:22 HBu: starting from the terminal with LANG=en_US.UTF-8 set doesn't work either 12:22 HBu: mac 12:23 mithos28: is osx set to german? 12:23 asumu: HBu: you should be able to change it from the help menu 12:24 em: is it safe for me to assume that if I leave it as (current-seconds) that is giving me some integer. and there will be some built in racket procdure for turning that integer into a human readable date? 12:25 HBu: @asumu thanks, i didn't think of that 12:25 HBu: *facepal* 12:25 HBu: m 12:25 HBu: bye 12:25 (part) HBu 12:27 jamessan: bremner: I guess I'm not sure how that'd help, but it's also not clear to me what upstream's stance on linking against the lib is. I do know that Vim provides mzscheme bindings, but I've never enabled them in my packaging due to my uncertainty about the lib 12:28 bremner: I guess it's documented: http://docs.racket-lang.org/inside/index.html 12:28 jamessan: yeah, just found that 12:29 em: rudybot: init racket 12:29 rudybot: em: your sandbox is ready 12:29 em: rudybot: eval (date->string (seconds->date 1333210982)) 12:29 rudybot: em: error: reference to an identifier before its definition: date->string in module: 'program 12:29 em: eval (require date/time) 12:29 em: rudybot: eval (require date/time) 12:29 rudybot: em: error: #:1:9: date/time: standard-module-name-resolver: collection not found: "date" in any of: (#) in: date/time 12:30 em: rudybot: evalu (require racket/date) 12:30 rudybot: em: eval (require racket/date) (date->string (seconds->date (current-seconds))) 12:30 (quit) jeapostrophe: Ping timeout: 252 seconds 12:30 em: rudybot: eval (require racket/date) 12:30 rudybot: em: Done. 12:30 em: rudybot: eval (date->string (seconds->date 1333210982)) 12:30 rudybot: em: error: car: expects argument of type ; given: #f 12:30 em: that should have worked 12:34 (join) anRch 12:34 (join) RacketCommitBot 12:34 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/ie_JLQ 12:34 RacketCommitBot: [racket/master] Uncomment & fix racket/draw contracts - Asumu Takikawa 12:34 RacketCommitBot: [racket/master] Remove dynamic checks from racket/draw. - Asumu Takikawa 12:34 RacketCommitBot: [racket/master] Update racket/draw contracts. - Asumu Takikawa 12:34 (part) RacketCommitBot 12:36 (join) realitygrill 12:39 rapacity: looks like a bug 12:39 em: offby1: we found a bug 12:39 em: rapacity: but what i really am trying to get is, how do i convert the given seconds into not just the year-month-day but also the time of the day. 12:39 mithos28: I think it is with the contract library 12:40 rapacity: rudybot: (version) 12:40 rudybot: rapacity: ; Value: "5.2.900.1" 12:40 mithos28: cky showed a similar bug last night with vector->list from srfi/43 12:40 em: (date->string (seconds-date 1333210982)) is only returning 2012-03-31 12:41 em: i want to get 2012-03-31 hour:minute 12:41 em: anyone know how ? 12:41 em: it doesn't have to be that order, just to include year, month, day, hour, minute at least 12:42 rapacity: rudybot: (seconds->date 1333210982) 12:42 rudybot: rapacity: ; Value: #(struct:date* 2 23 16 31 3 2012 6 90 #f 0 0 "UTC") 12:42 (join) mmajchrzak 12:42 rapacity: rudybot: (match (seconds->date 1333210982) [(struct* ([hour h])) h]) 12:42 rudybot: rapacity: error: #:1:35: struct*: bad syntax in: (struct* ((hour h))) 12:42 em: rapacity: so date->string loses the hours and minutes? 12:43 rapacity: rudybot: (match (seconds->date 1333210982) [(struct* date ([hour h])) h]) 12:43 rudybot: rapacity: ; Value: 16 12:43 rapacity: I don't know how to make date->string outpu the hours/minutes 12:43 mmajchrzak: Hi . I am a newbie. Can any one tell me how i can generate list with element from 50 to 50000 (50 100 150 200 ...) by lambda and build-list ? 12:44 rapacity: rudybot: (match (seconds->date 1333210982) [(struct* date ([hour h] [minute m])) (format "~a:~a" h m)]) 12:44 rudybot: rapacity: ; Value: "16:23" 12:44 em: i dont know what you did there. 12:45 asumu: mmajchrzak: the `range` function might be easier to use. 12:45 asumu: rudybot: doc range 12:45 rudybot: asumu: http://docs.racket-lang.org/reference/pairs.html#(def._((lib._racket%2Flist..rkt)._range)) 12:45 rapacity: ah 12:45 asumu: mmajchrzak: Oh shoot, I think it's not in the latest release version... 12:46 rapacity: date->string takes an optional parameter 12:46 em: rapacity: anyway if my program is saving the seconds then i can always figure out how to format that data later right> 12:46 em: ? 12:46 rapacity: (date->string (seconds->date x) #t) 12:46 (quit) dented42: Quit: Computer has gone to sleep. 12:46 rapacity: that outputs the time 12:47 asumu: rudybot: (build-list (lambda (n) (* n 50)) (/ 50000 50)) 12:47 rudybot: asumu: error: build-list: expected argument of type ; given: # 12:47 asumu: rudybot: (build-list (/ 50000 50) (lambda (n) (* n 50))) 12:47 rudybot: asumu: ; Value: (0 50 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 1500 1550 1600 1650 1700 1750 1800 1850 1900 1950 2000 2050 2100 2150 2200 2250 2300 2350 2400 2450 2500 2550 2600 2650 2700 2750 2800 2850 2900 2950 3000 3050 3100 3150 3200 3250 3300 3350 3400 3450 3500 3550 3600 3650 3700 3750 3800 3850 3900 3950 4000 4050 4100 4150 4200 4250 4300 12:47 mmajchrzak: thank you . Its great :) 12:47 em: rapacity: oh i saw that but i put the #t on the inside of the (seconds->date ..) procedure and not the (date->string ..) procedure! 12:47 em: rapacity: thanks. 12:48 em: rapacity: do you know if there is a way, in Dr. Scheme to 'get back' something you wrote in a previous line, sort of like using the up-down arrows in bash? 12:48 em: Dr. Racket that is. 12:48 rapacity: alt+p maybe? though I'm using emacs-style keybindings 12:50 em: hey alt-p worked! 12:54 rapacity: great 13:01 mmajchrzak: If i would like to make a plot with numbers from my list then i make something like that (plot (lambda (x) x) (mylist)) #:x-min 0 #:x-max 50000) but it doesnt work . Why ? 13:09 (join) Kaylin 13:13 (join) RacketCommitBot 13:13 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/uHPxPw 13:13 RacketCommitBot: [racket/master] select the contents of the search string in the 'search in files' dialog - Robby Findler 13:13 (part) RacketCommitBot 13:18 (quit) gridaphobe: Remote host closed the connection 13:18 mmajchrzak: I read a doc from plot but I still dont know how to plot my numbers from my list . 13:23 mithos28: Is it possible to create mutually recursive contracted structs? I am having issues because they are very eager in evaluating the contract binding. 13:23 mithos28: https://gist.github.com/2266898 13:25 em: for "write-to-file" i want to replace old data with new data. Should I use #:exists 'truncate or #:exists 'replace ? 13:26 mithos28: depends on whether or not you want to keep the same file (i.e. in ode) 13:26 mithos28: inode* 13:26 (quit) Skola: Quit: leaving 13:26 em: i am just trying to save a big hash so i can close the program and start again when i open it. 13:26 mithos28: Either should work, I would go with replace 13:27 mithos28: Also they require slightly different permissions, but I don't think you will need to deal with that 13:28 em: I will have some hash saved as text in a file. Then when I start my program it will read that file to define the master hash. I will work on the master hash inside the program, and along the way the master hash with change values, at the end (or ideally if i can figure out how, after so many minutes) it will write the new (current) version of the master hash back to the same file name. 13:28 (quit) anRch: Read error: Connection reset by peer 13:29 mithos28: are you manipulating the file from multiple programs or reading it while it is being written to? If no, than either will give the same behaviour 13:30 em: yes oka, Imn not doing those things. 13:31 em: it is just one file. I think the way to 'write it' is with (write-to-file master-hash /path/to/file/master.txt #:exists 'replace) 13:31 em: do you happen to know how to read it back in? do i have to open ports and all that? 13:32 mithos28: (call-with-input-file "/path" read) 13:33 rapacity: (file->value "/path/to/file/master.txt") works as well 13:33 mithos28: yeah that is better 13:36 em: rapacity: does that automatically take care of the opening and closing ports and all that? 13:36 mithos28: yep 13:37 rapacity: yeah 13:38 em: the "/path/to/file/master.txt" is with respect to your home directory right? 13:38 em: so you would not do /home/em/data/master.txt you could just do /data/master.txt ? 13:39 mithos28: no 13:39 em: you put in the full path? 13:39 mithos28: or use ~ 13:39 em: oh i didn't realise racket understood what ~ meant 13:40 mithos28: It shouldn't need to, just pass it to the os which understands 13:40 mithos28: unless it is a shell thing 13:41 mithos28: there is expand-user-path aswell 13:41 mithos28: which does the expansion if it doesn't work without it 13:41 (join) samth 13:43 mithos28: even adding recursive-contract to my example doesn't fix it 13:46 mithos28: this seems like an error because recursive-contract, says that it delays evaluation till the contract is checked 13:46 mithos28: and I'm never checking the contract 13:59 mithos28: but eta expansion works as expected, that is weird 14:01 asumu: mmajchrzak: you probably want to use the `points` renderer in plot. 14:03 (quit) mmajchrzak: Ping timeout: 265 seconds 14:05 (quit) rudybot: Remote host closed the connection 14:05 (join) rudybot 14:06 offby1: em: thanks, noted: http://goo.gl/zDIRm 14:07 em: mithos28: is it possible to build a string in your program, and give it a name like my-string and then use that in write-to-file like: (write-to-file value ~/my-string) 14:07 (join) jeapostrophe 14:07 em: in other words have the name of the file be a variable that you determine in your program 14:08 mithos28: use string-append 14:12 em: mithos28: thanks 14:12 em: offby1: im kind of getting my program to work now. It's going to be great. 14:13 offby1: \o/ 14:15 (quit) Kaylin: Quit: Leaving. 14:30 (join) mmajchrzak 14:35 (join) dented42 14:36 (join) asdfhjkl 14:37 (join) yoklov 14:45 (join) Shvillr_ 14:45 (quit) Shviller: Disconnected by services 14:45 (nick) Shvillr_ -> Shviller 14:47 (quit) Shvillr: Ping timeout: 265 seconds 14:47 (join) Shvillr 14:57 (quit) jeapostrophe: Ping timeout: 252 seconds 14:58 mmajchrzak: Anyone here use plot with list of numbers ? 15:03 (join) jeapostrophe 15:08 (quit) realitygrill: Quit: realitygrill 15:17 (quit) dnolen: Ping timeout: 272 seconds 15:20 (part) scyrmion 15:55 (join) realitygrill 15:55 (quit) realitygrill: Client Quit 16:17 (join) bremner` 16:26 bremner: mmajchrzak: I use it to plot histograms 16:27 mmajchrzak: bremner Could you tell me how to plot a list of numbers ? 16:27 bremner: mmajchrzak: I'm not sure what that means. 16:28 bremner: here is what I know, pretty much http://www.cs.unb.ca/~bremner/blog/posts/racket-histogram/ 16:29 mmajchrzak: bremner i have list of numbers like (list 10 20 30 40 50 ) and i would like to plot them like function f(x)=(list-ref (my-list) x) 16:31 bremner`: so just (define (f x) (list-ref my-list x)) and then plot it? 16:32 bremner: hmm. Not sure how you tell plot to only plot integers. 16:32 (quit) bremner`: Quit: Coyote finally caught me 16:32 (join) bremner` 16:33 mmajchrzak: bremner maybe plot only points and after that connect them by a line ? 16:35 (quit) fftb: Read error: Connection reset by peer 16:35 (join) dee 16:36 (join) fftb 16:37 dee: what's the most idiomatic way to draw Mandelbrot's fractal in racket? 16:39 mmajchrzak: dee i have a example...give me a one minute 16:39 dee: ok, thanx 16:40 mmajchrzak: dee http://pastebin.com/AD5UY8SU i found that on a roseta code repository. 16:42 dee: this is ok, but how to draw it using 2htdp drawing lib? 16:46 dee: beside, i love for/fold construct and got the feeling that is possible to code mandelbrot elegantly with for/fold... 16:48 dee: but, because of "sound of silence" here, the most probable outcome will be to code it in the nicest language ever invented: in Shen! :) 16:48 dee: Shen rules! 16:48 dee: HAHAHAHAHA 16:49 dee: rudybot: shen the 16:49 rudybot: dee: shen, web doc sucks etc, and ban on that 16:49 dee: oh, how clever idea, rudybot! 16:50 mmajchrzak: dee I told you that this isn't mine. But if you write your version with for/fold then add alternative version to http://rosettacode.org/wiki/Mandelbrot_set#Racket 16:50 dee: i sure will, maybe in Shen 16:51 mithos28: mmajchrzak: ignore him 16:51 dee: hi mithos 16:51 dee: why he should ignore me?? 16:51 dee: i'm chater just like you 16:52 (quit) fftb: Remote host closed the connection 16:53 dee: hahaha, samth has banned all my country from this channel, all because of your blind hate directed on me! 16:53 dee: oh god, hehehehe 16:53 (join) tommc 16:54 dee: congratulations, community! that's the job! :))) 16:56 dee: rudybot: racketnoob 16:56 rudybot: dee: For all we know, Racketnoob is trolling #shen and saying that Racket is better! 16:56 dee: rudybot: racketnoob the 16:56 rudybot: dee: you should drink at a pub, not in other people's workplaces 16:56 dee: hahahahaha, poor boys! 16:56 (quit) dous: Remote host closed the connection 16:57 dee: eli: hi, dude! 16:57 dee: chandler: hi, pal! 16:57 dee: bremner: hi, stud! 16:58 dee: offby1: hy, bro! :) 16:58 dee: noam: long live Scala! 16:59 dee: samth: ola, you artificial ban-loving scientist! :))) 16:59 (join) dous 17:00 dee: stamourv: hating isn't good for health, dude! :) 17:00 dee: asumu: hi, IP address genius! 17:02 (quit) jeapostrophe: Ping timeout: 244 seconds 17:04 dee: good night, racket community! Good day, Shen! 17:04 (part) dee 17:15 mmajchrzak: How to run executable racket file on linux ? Program works fine but when i create executable file then nothing happend 17:16 mithos28: mmajchrzak: It should just work. I assuming you are using the create executable from DrRacket 17:17 mmajchrzak: mithos28 yes i created stand-alone file with DrRacket. 17:18 mithos28: what happens when you try to run it? 17:18 mithos28: nothing, and the prompt comes back? 17:19 mmajchrzak: mithos28 nothing 17:19 mithos28: what is the error code? 17:20 mithos28: run 'echo $?' right afterwords, before any other command 17:20 mithos28: also what is your program supposed to do? 17:20 chandler: mmajchrzak: Does the program do anything if you run it through "racket foo.rkt" (where foo.rkt is the filename of your program)? 17:21 (quit) bremner`: Quit: Coyote finally caught me 17:21 (join) bremner` 17:22 (quit) dous: Remote host closed the connection 17:22 mmajchrzak: chandler if i run him from terminal he works fine . 17:25 mmajchrzak: mithos28 My program make a plot and after that saves this plot with a png file in the same place where is source. 17:26 mithos28: is it using a gui at all? That sometimes is an issue, and you need to select that when build the executable 17:28 mmajchrzak: mithos28 aaa i see now . Thank you . That was the issue . Thank you and sorry for problem . I am a tottaly newbie in scheme and DrRocket 17:29 mithos28: No problem 17:29 mithos28: I hang out here to help people out 17:38 mmajchrzak: mithos28 Are you using racket in your work or this is only a hobby ? 17:38 mithos28: I wish I used it in my work 17:39 mithos28: Its just a hobby 17:40 mithos28: I also TAd many classes that were taught in Racket 17:41 mithos28: but the real world doesn't appreciate good languages 17:41 mmajchrzak: mithos28 I am a newbie but for now i prefer racket from lisp . Its more... hmm ...clearer. But I think that this is a only academic use language. For now of course. Maybe some one make a nice web framework like rails for ruby 17:43 mithos28: The problem is that you need a community and good standard libraries. And racket has these but they are just a lot smaller than other languages 17:43 mithos28: Racket is also still trying to figure out their story on distributing packages 17:44 mithos28: Hopefully planet v2 will be out soon 17:44 mmajchrzak: So you dont see a bright future for racket ? 17:44 mithos28: I don't see it becoming as popular as say ruby or python 17:45 mithos28: but I wouldn't say that the future doesn't look good for racket 17:48 mmajchrzak: I think that ruby is a good example for be popular in the reason of only one technology . 17:49 mithos28: I don't get the craze of ruby, rails is not that great a framework 17:49 mithos28: I worked with it for two summers 17:52 mmajchrzak: I prefer php frameworks . But on my university i have Django 17:55 mmajchrzak: And i think that django hava a one big fault...his documentation . But if python or ruby or even Smalltalk have theirs own frameworks then why not racket ? 18:00 mithos28: It does have a web framework 18:00 mithos28: Why it hasn't seen high adoption rates I don't know 18:01 mmajchrzak: Do you know name of this framework ? 18:02 samth: mmajchrzak, it doesn't really have a name -- it's just built in to the racket web server 18:02 mithos28: It is just the web-server libraries in racket 18:02 mithos28: http://docs.racket-lang.org/web-server/index.html 18:02 mithos28: as samth said 18:03 (quit) mceier: Quit: leaving 18:04 mmajchrzak: i see . It looks that it is very basic web-server . 18:07 (join) jeapostrophe 18:09 samth: mmajchrzak, in what sense is it basic? 18:09 mithos28: samth: I think it is that it doesn't do any orm stuff that most other web frameworks do 18:13 (quit) jeapostrophe: Ping timeout: 264 seconds 18:15 mmajchrzak: But from those basic stuff someone can create a nice and useful web framework 18:18 samth: ah yes, it's basic as a web development framework like django or rails 18:19 mithos28: does anyone use rails without activerecord? 18:33 samth: i don't think so 18:37 (quit) Nisstyre: Read error: Connection reset by peer 18:39 (join) Nisstyre 18:49 (quit) Nisstyre: Quit: Leaving 18:52 (join) Nisstyre 18:59 (quit) bremner`: Quit: Coyote finally caught me 18:59 (join) bremner` 19:07 (join) dnolen 19:08 (join) lewis1711 19:15 (join) dous 19:15 (quit) tommc: Remote host closed the connection 19:19 (quit) dous: Ping timeout: 246 seconds 19:27 (join) startling 19:36 (quit) mmajchrzak: Ping timeout: 246 seconds 19:38 (quit) dnolen: Ping timeout: 252 seconds 19:39 (join) Lunaqus 19:43 Lunaqus: so whats special about racket? 19:44 lewis1711: Lunaqus: it uses lots of round brackets. it has a contract system. 19:45 Lunaqus: a contract system? 19:45 asumu: Lunaqus: It's a general-purpose & kitchen-sink Scheme/Lisp that comes with lots of libraries and language features. 19:46 asumu: And for the so-inclined, it's a "programming language language". 19:46 Lunaqus: would it be any good for doing IRC bots? 19:46 asumu: rudybot: (banner) 19:46 rudybot: asumu: your sandbox is ready 19:46 rudybot: asumu: ; Value: "Welcome to Racket v5.2.900.1.\n" 19:46 asumu: ^ as you can see, yes. 19:47 asumu: offby1 is your man. 19:47 Lunaqus: thats a full sandbox? 19:47 asumu: Yep, try it out. 19:47 mithos28: rudybot: (let loop (()) (loop)) 19:47 rudybot: mithos28: your sandbox is ready 19:47 rudybot: mithos28: error: #:1:11: let: bad syntax (not an identifier and expression for a binding) at: () in: (let loop (()) (loop)) 19:47 mithos28: rudybot: (let loop () (loop)) 19:48 rudybot: mithos28: error: with-limit: out of time 19:48 mithos28: prevents you from crashing it 19:50 rudybot: Also my fearsome countenance. 19:50 offby1: rudybot: will you help Lunaqus in his quest? 19:50 rudybot: *offby1: it uses lots of round brackets. it has a contract system. 19:50 offby1: rudybot: we already know that 19:50 rudybot: *offby1: Seems, that someone has already struggled with free-vars and gave up, according to these thread and piece of code: http://list.cs.brown.edu/pipermail/plt-scheme/2008-March/023857.html and http://socrates-lang.cvs.sourceforge.net/socrates-lang/socrates/free-vars.ss?revision=1.5 19:53 lewis1711: it's full featured unlike many schemes, and cross platform unlike many common lisps. that's the shallow reason I like it. also I prefer scheme style syntax 19:59 offby1: also, it has rudybot 19:59 rudybot beams 19:59 offby1: APRIL FOOL 20:08 (quit) samth: Ping timeout: 246 seconds 20:10 Lunaqus: how many of lines of code does it take to write a client that can win at idlerpg? 20:10 Lunaqus: not time out atleast ;) 20:12 lewis1711: is there anyway to have something in a procedure that keeps state? like a static field? 20:12 offby1: lewis1711: sure 20:12 offby1: lewis1711: easiest way is to just whack a global 20:13 offby1: hopefully you have enough taste to find that disagreeable :) 20:13 mithos28: rudybot: (define counter (let ((v 0)) (lambda () (begin0 counter (set! counter (add1 counter)))))) 20:13 rudybot: mithos28: Done. 20:13 lewis1711: lol 20:13 mithos28: rudybot: (counter) 20:13 rudybot: mithos28: error: add1: expects argument of type ; given: # 20:13 offby1: lewis1711: yeah, mithos28's way is the traditional not-so-horrible way 20:13 mithos28: if you use the right variable names 20:13 offby1: once he fixes the spelling errors 20:13 mithos28: rudybot: (define counter (let ((v 0)) (lambda () (begin0 counter (set! counter (add1 v)))))) 20:13 rudybot: mithos28: Done. 20:14 mithos28: rudybot: counter 20:14 rudybot: mithos28: ; Value: # 20:14 offby1: lewis1711: paul graham has a whole essay about judging languages by how well they handle this problem 20:14 mithos28: rudybot: (counter) 20:14 rudybot: mithos28: ; Value: # 20:14 offby1: lewis1711: http://paulgraham.com/accgen.html 20:14 lewis1711: begin0 eh.. 20:14 lewis1711: hmm 20:14 mithos28: ugh 20:14 mithos28: rudybot: (define counter (let ((v 0)) (lambda () (begin0 v (set! counter (add1 v)))))) 20:14 rudybot: mithos28: Done. 20:14 mithos28: rudybot: (counter) 20:14 rudybot: mithos28: ; Value: 0 20:14 offby1: \o/ 20:14 mithos28: rudybot: (counter) 20:14 rudybot: mithos28: error: procedure application: expected procedure, given: 1 (no arguments) 20:15 offby1: *snicker* 20:15 mithos28: lol 20:15 mithos28: rudybot: (define counter (let ((v 0)) (lambda () (begin0 v (set! v (add1 v)))))) 20:15 rudybot: mithos28: Done. 20:15 offby1: mithos28: once you get this working, do it again without using set! (or calls to other processes, or writes to the file system) 20:15 mithos28: rudybot: (counter) 20:15 rudybot: mithos28: ; Value: 0 20:15 mithos28: rudybot: (counter) 20:15 rudybot: mithos28: ; Value: 1 20:15 asumu: offby1: I find it odd that the Scheme solution uses set!. 20:16 lewis1711: does the "static variable" have to be a let field? 20:16 asumu: Or is it supposed to be mutable to solve the exercise? 20:16 mithos28: rudybot: (define counter (let ((v (box 0))) (lambda () (begin0 (unbox v) (set-box! v (add1 (unbox v))))))) 20:16 rudybot: mithos28: Done. 20:16 mithos28: rudybot: (counter) 20:16 rudybot: mithos28: ; Value: 0 20:16 mithos28: rudybot: (counter) 20:16 rudybot: mithos28: ; Value: 1 20:16 mithos28: offby1: there you go 20:17 lewis1711: https://gist.github.com/2269946 not sure if this explains the problem 20:17 lewis1711 looks up begin0 20:17 mithos28: it is begin, but returns the first value in the sequence 20:18 mithos28: offby1: were you originally thinking of call/cc way to do it? 20:20 offby1: rudybot: (define counter (thread (thunk (let loop ([count 0]) (let ([client (thread-receive)]) (thread-send client count)) (loop (add1 count)))))) 20:20 rudybot: *offby1: your sandbox is ready 20:20 rudybot: *offby1: Done. 20:20 lewis1711: wait so the point of begin is that every expression but the last is a sideffect? 20:20 lewis1711: rudybot: (+ 1 (begin 3 49)) 20:20 rudybot: lewis1711: your sandbox is ready 20:20 rudybot: lewis1711: ; Value: 50 20:20 offby1: mithos28: technically correct but not in the spirit I meant 20:20 offby1: rudybot: (begin (thread-send counter (current-thread)) (thread-receive)) 20:20 rudybot: *offby1: ; Value: 0 20:20 offby1: rudybot: (begin (thread-send counter (current-thread)) (thread-receive)) 20:20 rudybot: *offby1: ; Value: 1 20:20 offby1: rudybot: (begin (thread-send counter (current-thread)) (thread-receive)) 20:20 rudybot: *offby1: ; Value: 2 20:20 offby1: that's the Erlang way to do it 20:20 offby1: no set-! anywhere 20:21 offby1: lewis1711: yes, that is exactly the point of "begin" 20:21 offby1: us die-hard functional-programming aficionados don't use it much 20:22 lewis1711: the exercise? I must be one of the few people that comes here not for school :D 20:23 offby1 raises his hand 20:23 offby1: long done with school, thank god 20:23 offby1: still have nightmares about it :-p 20:24 mithos28: i'm done with school as well, at least for the time being 20:24 asumu: I guess technically I am in school... 20:25 lewis1711: I mean in terms of noobs that ask questions, like me 20:25 mithos28: oh, I still ask questions 20:25 lewis1711: rudybot: (define counter (let ((v 0)) (lambda () (begin0 v (set! v (add1 v)))))) 20:25 rudybot: lewis1711: Done. 20:25 lewis1711: I don't get how begin, which seems to have to do with letting some part of a group of sexpressions be side effects, keeps the state of v for each call 20:26 offby1: "begin" doesn't keep the state. 20:26 offby1: the "let" keeps the state. 20:26 offby1: or rather -- the "closure" keeps the state. 20:26 offby1: "begin" simply does one thing after the other, returning the value of the last thing. 20:26 Lunaqus: anyone up for coding a poker dealing bot? I'd be up for paying a comission if anyones interested 20:27 offby1: that should be very easy 20:27 offby1: rudybot: (define *deck* (build-list 52 values)) 20:27 rudybot: *offby1: Done. 20:27 offby1: rudybot: (shuffle *deck*) 20:27 rudybot: *offby1: ; Value: (25 1 26 23 37 47 15 48 39 6 36 42 43 16 44 8 17 3 7 49 13 50 19 24 29 35 30 0 31 21 38 20 28 45 34 14 41 46 32 18 5 12 22 51 33 4 2 10 9 27 40 11) 20:27 offby1: now map the integers to "cards", find a way to distribute "cards" to "hands" ... pretty straightforward 20:27 offby1: next find a way to evaluate hands -- also ought to be easy 20:28 mithos28: offby1: that step is a little more tricky 20:28 offby1: rudybot: give *deck* to Penn 20:28 rudybot: *offby1: error: reference to an identifier before its definition: to in module: 'program 20:28 mithos28: especially with wilds 20:28 offby1: rudybot: he's the taller louder of the two 20:28 rudybot: *offby1: talks louder 20:28 lewis1711: offby1: I had no idea that let keeps state 20:29 mithos28: lewis1711: that is how set! works 20:29 mithos28: it just modifies what value is bound to the variable from let 20:29 offby1: lewis1711: it does -- what you've got there is the classic example of a closure. Study it well; it comes up all over the place (in real languages) 20:29 mithos28: and in bad languages, but they have to fake it 20:30 offby1: I was about to say 20:31 lewis1711: ok right so begin is just a tricky smoke screen 20:31 lewis1711: I'm not sure how to do it in my example, because the end procedure may or may not mutate the state 20:31 lewis1711: so I dunno whether to use begin or not 20:31 mithos28: (begin e) is the same as e 20:32 mithos28: so there shouldn't be any harm in using begin 20:32 offby1: lewis1711: it's not tricky, and it's not a smoke screen. 20:32 offby1: It's a way to ensure that expressions get evaluated in order. 20:33 offby1: and that's all it is. 20:33 asumu: lewis1711: re: let & state, the reference page on the evaluation model might help http://docs.racket-lang.org/reference/eval-model.html 20:33 offby1: you could always use (let () this that the-other); in fact it's possible that (begin this that the-other) macroexpands into that. 20:34 asumu: In particular, the section on imperative update explains how mutation on function arguments actually works. 20:34 lewis1711: offby1: ok that makes sense 20:34 lewis1711: but here 20:34 asumu: (though it's kinda dense too) 20:34 lewis1711: https://gist.github.com/2270048 20:34 lewis1711: "msg" may or may not mutate state 20:34 lewis1711: ie it only will if it is sent 'make-slot 20:36 offby1: from what I can see, "msg" will never mutate state 20:37 (join) dnolen 20:37 offby1: but I think I can guess what you meant. 20:38 lewis1711: offby1: what if msg is 'make-slot 20:38 offby1: that's what I meant by guess. 20:38 offby1: except I tried it and it didn't do what I expected. 20:39 offby1: http://ix.io/2gm 20:39 (join) lebro 20:39 offby1: see if you can guess what I expected from that transcript. 20:39 lewis1711: offby1: that's what I am expecting as well 20:39 lewis1711: that's the whole issue 20:40 offby1: OH, so you want me to DEBUG it, EH?! 20:40 lewis1711: lol 20:40 lewis1711: so are you saying, in your eyes, that it SHOULD keep state? 20:40 lewis1711: slots I mean 20:42 offby1: this sorta works -- http://ix.io/2gn 20:43 offby1: but I'm not sure it's what you ultimately want 20:43 offby1: yes, I think _something_ should keep state. 20:43 offby1: otherwise, "make-slot" has no real effect anywhere 20:43 offby1: ultimately I don't know what "root" is. Perhaps if the function were named "new-object" or something. 20:44 offby1: you should write your tests first, that way you have a design in view while you code. 20:44 offby1: otherwise (if you're like me, anyway) you keep forgetting whether you're writing code for a single object, as opposed to for the entire system ... 20:45 lewis1711: offby1: it's for a single object. for a prototype system 20:46 lewis1711: also that lambda thing means any other message returns a procedure 20:47 offby1: you're the one who put all those lambda in there 20:47 (quit) masm: Quit: Leaving. 20:49 lewis1711: no I mean now any message returns a procedure of a procedure.. 20:56 (quit) asdfhjkl: Quit: Leaving 20:57 offby1: wasn't that the case originally? 20:58 lewis1711: no 20:58 offby1: ok ok so http://ix.io/2go 20:58 lewis1711: before I could do ((root 'responds to)) and it would return a quoted list 20:58 offby1: whiner 21:00 lewis1711: i don't get that at all 21:00 lewis1711: how does 'responds-to work with that 21:00 lewis1711 tries to figure it out 21:00 lewis1711: I'm not whining, just useless 21:01 offby1: Try It And See™. 21:01 offby1: rudybot: (define root (let ([slots (make-hash)]) (hash-set! slots 'responds-to (λ() (hash-keys slots))) (hash-set! slots 'make-slot (λ (key value) (hash-set! slots key value))) (hash-set! slots 'clone (λ() ("implement me!"))) (lambda (msg . args) (apply (hash-ref slots msg) args)))) 21:01 rudybot: *offby1: Done. 21:01 lewis1711: I am trying it 21:01 offby1: rudybot: (root 'make-slot 'poop (lambda () "Here I go!")) 21:01 rudybot: *offby1: Done. 21:01 offby1: rudybot: (root 'responds-to) 21:01 rudybot: *offby1: ; Value: (poop make-slot responds-to clone) 21:01 offby1: *shrug* 21:01 lewis1711: ((root 'responds-to) 'responds-to) 21:02 lewis1711: what how did you do that 21:02 lewis1711: ok I've missed something 21:02 offby1: you saw everything I did. 21:02 offby1: it's all out in the open. 21:02 offby1: albeit poorly formatted. 21:02 lewis1711: yeah you changed something I missed I mean 21:02 offby1: diff mine against yours. 21:04 lewis1711: oh right 21:04 lewis1711: ok that's not quite how I wanted it, because now the call is different but I will figure it out. thanks for your help 21:10 lewis1711: aha! got it. thanks offby1 21:11 offby1: \o/ 21:42 offby1: lewis1711: "clone", although I'm not sure I'm happy with it: http://ix.io/2gp 21:50 (join) wtetzner 21:51 lewis1711: offby1: to be clear "root" is kind of an internal definition, I have a defobject macro that does the nice syntax transformation (with a bit of help from someone here of course) 21:51 lewis1711: but I will see what I can understand from your clone 21:52 offby1: I'd probably make objects be structs, and keep state more or less explicitly 21:52 offby1: might not use closures, or at least, might not use them for everything 21:53 lewis1711: why structs over hashtables? I thought about that too btw 21:54 offby1: dunno really. 21:54 offby1: just seems more "right" 21:54 lewis1711: javascript and self use something like hashtables IIRC. which is why i went with it 21:54 offby1: sure 21:54 lewis1711: not a very good reason, but I guess neither is yours :D 21:56 offby1: actually the only struct member I can think of would be "slots", which would be ... a hash table. 21:56 offby1: sorta makes the struct pointless. 21:57 offby1: I wonder if you could make a new type that is mostly ordinary hash table ... but "hash?" returns #f for it, and it prints like #, but all the existing functions like "hash-set" etc still work on it 22:00 (join) Kaylin 22:03 (join) cmadd 22:04 (quit) cdidd: Remote host closed the connection 22:05 lewis1711: offby1: something like luas metatables? 22:07 offby1: dunno 22:07 offby1: dunno lua 22:07 lewis1711: https://gist.github.com/2270048 my attempt at clone 22:07 offby1: dude. Where's your tests?! 22:08 offby1: How'm I supposed to tell if it works? 22:08 lewis1711: good thinking 22:08 (quit) bitonic: Quit: WeeChat 0.3.5 22:08 offby1: for that matter ... how are _you_ supposed to tell? 22:09 lewis1711: I've been meaning to get into unit testing. especially for dynamically typed languages 22:09 lewis1711: guess now is as good a time as any 22:13 offby1: never too late etc 22:13 lewis1711: wait, should two cloned objects be equal? or eq? or eqv..? hmm I guess objects are functions so.. 22:13 offby1: cosmetic update: http://ix.io/2gq 22:13 lewis1711: (or I have defined them as) 22:15 offby1: my hunch is: they should not be eqv? or eq? or equal? 22:15 offby1: they're different. 22:16 offby1: maaaaaybe equal? 22:16 offby1: probably not possible to actually implement though 22:18 lewis1711: I guess what you did 22:18 lewis1711: which is check to see they respond to the same methods 22:19 lewis1711: (define new (root 'clone)) 22:19 lewis1711: (check-equal? ([root 'responds-to]) ([new 'responds-to])) 22:19 offby1: but you'd also want to check that the respond _in the same way_, and that's not possible 22:19 offby1: I suspect that'd be equivalent to solving the Halting Problem 22:20 offby1: s/that the/that they/ 22:21 lewis1711: yeah i guess once you clone it you're on your own 22:23 cmadd: I got a quick question about macros 22:23 lewis1711: what does racket use for nil? 22:24 cmadd: is there a reason (syntax-test (a c) b) doesn't match the pattern in this macro: 22:24 cmadd: (define-syntax-rule (syntax-test (a ...) b ...+ ) (b ...+ a ...)) 22:31 offby1: rudybot: (null? ' ()) 22:31 rudybot: *offby1: ; Value: #t 22:37 (join) dous 22:39 (quit) lewis1711: Ping timeout: 246 seconds 22:41 (quit) dous: Ping timeout: 246 seconds 22:59 (join) realitygrill 23:07 (join) dyoo 23:18 (join) lewis1711 23:19 (quit) dyoo: Ping timeout: 245 seconds 23:22 asumu: cmadd: ...+ isn't something built into syntax-rules, so it's matching it as an identifier. 23:23 mithos28: use b0 b ... 23:23 mithos28: eh we were an hour late 23:24 (join) gridaphobe 23:25 rapacity: there's syntax-parse that has ...+ 23:26 asumu: Too bad dyoo isn't here right now. 23:26 asumu: He deserves a virtual high-five for his april fools joke. 23:28 (quit) gridaphobe: Ping timeout: 265 seconds 23:40 asumu: Hmm, it appears Rosettacode used to consider Racket a separate language and now does not. http://rosettacode.org/wiki/Racket 23:43 (quit) lebro: Ping timeout: 246 seconds 23:44 lewis1711: god dman it stat eisn't being kept again 23:44 (join) lebro 23:46 offby1: say what now? 23:47 (join) RacketCommitBot 23:47 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/km_WuA 23:47 RacketCommitBot: [racket/master] improve the gui for specifying the submodules to run - Robby Findler 23:47 (part) RacketCommitBot 23:48 lewis1711: offby1: once again the changes to slot aren't kept between method calls. I have no clue how I got it working in the first place. or why it isn't now. 23:52 (join) dous 23:53 lewis1711: https://gist.github.com/2271048 line 24 check passes, but line 27 fails. can't figure that out