2011-01-01
| 00:00 | Crowbar7 | Happy New Year! |
| 00:00 | qbg | Still an hour to go here |
| 00:00 | Raynes | Happy new year for those in the eastern time zone. |
| 00:00 | Raynes | qbg: Likewise. |
| 00:01 | programble | stupid non-easterners |
| 00:10 | auser | okay... so um... I have a LazySeq... can I transform it into a non lazy sequence? |
| 00:11 | qbg | ,(doc doall) |
| 00:11 | clojurebot | "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time." |
| 00:11 | qbg | ^ Likely what you want |
| 00:12 | auser | I see... can you do a filter inside of a doall? |
| 00:12 | qbg | ,(doall (filter odd? (range 10))) |
| 00:12 | clojurebot | (1 3 5 7 9) |
| 00:13 | qbg | doall works on any seq |
| 00:14 | Raynes | &(apply str (reverse (map #(.toUpperCase (str %)) (interleave [\r \e \space \e \space \p \a] [\a \y \w \n \y \p \h])))) |
| 00:14 | sexpbot | ⟹ "HAPPY NEW YEAR" |
| 00:15 | auser | nm, it worked |
| 00:15 | auser | thanks |
| 00:17 | qbg | Tasty new year goodness: https://github.com/qbg/syntax-rules/wiki/defn-implementation |
| 00:18 | cemerick | qbg: looks like you've got something serious cooking over there :-) |
| 00:19 | qbg | git log --oneline | wc -l reports 42 commits so far... |
| 00:20 | qbg | Templates are terrible; I need to create more powerful ones sometime later |
| 00:21 | qbg | I also need to get it supporting lexical scope in +code templates |
| 00:21 | qbg | And fix the progress implementation |
| 00:21 | qbg | etc. *sigh* |
| 00:24 | qbg | The pattern matcher could be cleaned up too; its currently 471 lines in a single file |
| 00:25 | qbg | Should do an alpha release either tomorrow or the day after |
| 00:28 | cemerick | qbg: the defn walkthrough helps me see things dimly :-) |
| 00:29 | cemerick | Some side-by-side syntax-quote vs. syntax-rules macros would likely be a good addition. |
| 00:29 | qbg | Yeah, it needs to be improved before I make a release |
| 00:30 | qbg | syntax-quote annoys me so much right now; I'm basically reimplementing it in the templates |
| 00:30 | qbg | I want to snarf parts of it, but its implemented in the reader... |
| 00:32 | qbg | cemerick: I've reimplemented a few macros from core in src/qbg/syntax-rules/examples.clj |
| 00:32 | qbg | https://github.com/qbg/syntax-rules/blob/master/src/qbg/syntax_rules/examples.clj |
| 00:39 | qbg | I also need to change the name; its actually syntax-rules + syntax-case, with many of the advanced patterns from syntax-parse also being supported |
| 00:41 | cemerick | I guess I'll finally have to buckle down and learn them finally :-) |
| 00:44 | qbg | syntax-rules and syntax-case are easy enough |
| 00:45 | qbg | syntax-parse is quite new (it has been in Racket for about a year) |
| 00:46 | qbg | It adds more powerful patterns and a focus on good error messages |
| 00:46 | qbg | Who can resist good error messages for free after all? |
| 00:58 | qbg | Happy New Years from CST |
| 01:02 | Raynes | qbg: Happy New Years! :> |
| 01:02 | qbg | :D |
| 01:03 | qbg | I wonder what will happen in the next year of Clojure |
| 01:03 | qbg | About this time last year 1.1 was released; so much has happened since then |
| 01:03 | Raynes | qbg: At least two books will come out sometime in the early months of 2011. Another Conj conference in October. Rich Hickey's hair will become more curly. All sorts of awesome stuff. |
| 01:04 | qbg | (read: Clojure development has _NOT_ stalled) |
| 01:11 | ivey | Raynes: happy new year |
| 01:11 | ivey | 'bama time |
| 02:05 | Gigaroby | happy new year everyone |
| 06:44 | ejackson | Happy 2011 #Clojure. |
| 06:44 | kumarshantanu | ejackson: +1 |
| 06:46 | xenyl | 1 year to go for 2012, cool :) |
| 06:50 | ejackson | although today is 1/1/11 which is worth celebrating, if only for the fact that the US and rest of the world can agree on how to write it. :) |
| 06:52 | kumarshantanu | ejackson: more debatable date of th year -- 11/11/11 |
| 06:55 | ejackson | that's more fun |
| 06:55 | kumarshantanu | Japan probably writes yyyy-mm-dd, so I guess 11/11/11 will get them too ;-) |
| 06:56 | Adamant | kumarshantanu: I don't think anyone does that unless they do ISO dates |
| 06:56 | Adamant | that's kinda why they chose it |
| 06:56 | Adamant | less to bitch about while being unambiguous |
| 06:57 | ejackson | love the Japanese |
| 06:58 | kumarshantanu | Adamant: ISO dates are such a spoilsport *grin* |
| 06:59 | Adamant | :P |
| 06:59 | Adamant | trolling, trolling, to keep those lines scrolling |
| 06:59 | Adamant | I almost lost control and, replied! |
| 07:02 | fliebel | good morning, and happy new year! |
| 07:07 | kumarshantanu | fliebel: happy new year (oh.. what's the IRC mechanism of RT?) |
| 07:07 | fliebel | $sed -kumarshantanu s/// |
| 07:07 | sexpbot | fliebel: Format is sed [-<user name>] s/<regexp>/<replacement>/ Try <prefix>help sed |
| 07:07 | kumarshantanu | RT as in Re-Tweet |
| 07:08 | fliebel | I was trying to trick sexpbot into repeating your message : |
| 07:08 | fliebel | :) |
| 07:10 | kumarshantanu | $sed -fliebel s/x/x/ |
| 07:12 | kumarshantanu | can anybody talk about how are dynamic vars distinguished from static ones in Clojure 1.3 ? |
| 07:13 | kumarshantanu | what is the syntax? |
| 07:13 | kumarshantanu | do I still get to earmuff them etc? |
| 07:17 | fliebel | kumarshantanu: I don't know much about them, but it seems rather quiet in here, so I'll just try my best. |
| 07:17 | kumarshantanu | fliebel: sure, please go ahead |
| 07:18 | fliebel | From what I understand, vars are static by default in 1.3, so you can't change them at all. |
| 07:18 | fliebel | An optimization of some sort. |
| 07:18 | fliebel | Then you can add ^:dynamic metadata to them, and they work like vars work currently. |
| 07:19 | fliebel | earmuffs are still a good convention for marking dynamic vars, but it just that, a convention. |
| 07:20 | kumarshantanu | fliebel: is it like (def ^{:dynamic true} *dyn* "ha ha, dynamic") ? |
| 07:21 | fliebel | kumarshantanu: I never use metadata much, but if that is the syntax, yes. |
| 07:22 | kumarshantanu | fliebel: Okay...in fact I am writing some code using 1.2 that I might adjust to support 1.3 |
| 07:23 | kumarshantanu | fliebel: thanks! |
| 07:23 | fliebel | kumarshantanu: I'm sure though there was a shorthand for the dynamic. |
| 07:26 | fliebel | kumarshantanu: You might want to try this: (def ^:dynamic *test* "hoi") |
| 07:27 | kumarshantanu | okay..need to setup 1.3 JARs *lazy* :) |
| 07:28 | ejackson | my first 2011 New Years resolution is to step up to 1.3 |
| 07:31 | fliebel | What is the latest 1.3 alpha? |
| 07:33 | fliebel | (and is Cake already working with that?) |
| 07:40 | kumarshantanu | alpha4 I guess, not sure about Cake |
| 08:07 | kumarshantanu | fliebel: I tested with alpha-4 -- that works, and so does ^{:dynamic true :doc "Some documentation abt the var"} |
| 08:08 | fliebel | kumarshantanu: Good. |
| 08:10 | fliebel | Does anyone in here understand Gloss? Because I don't… I'm trying to read some weird binary format. |
| 09:35 | fliebel | How can I possibly figure out Gloss? Unless I figure out the whole thing at once, I can't even toy with it: java.lang.Exception: Bytes left over after decoding frame. |
| 09:40 | mids | what are you trying to do? pastebin? |
| 09:40 | fliebel | mids: Pastebin a binary file? Strange sense of humor ;) |
| 09:41 | fliebel | I'm doing http://www.minecraft.net/docs/NBT.txt with https://github.com/ztellman/gloss/wiki/Introduction and I got this: (defcodec nbt (ordered-map :type (enum :byte :end :byte :short :int :long :float :double :bytes :string :list :compound) :name (finite-frame :byte (string :utf-8)))) |
| 09:43 | mids | getting 404s on their test .nbt files |
| 09:44 | fliebel | Me to… Try this: http://dl.dropbox.com/u/10094764/World2.zip |
| 09:44 | fliebel | Is there an easy way to look at binary files to study the actual data? |
| 09:45 | mids | on unix; hexdump |
| 09:46 | kumarshantanu | fliebel: maybe you should develop functions to output/parse binary files vs "od -x filename.bin" first for pastebin ;-) |
| 09:48 | fliebel | kumarshantanu: I don't think I get you… |
| 09:48 | mids | fliebel: are you gunzipping the data before decoding? |
| 09:48 | kumarshantanu | pastebin won't take binary files, so why not paste the output of this -- $ od -x filename.bin |
| 09:49 | fliebel | mids: No, I'm putting them through GZIPInputStream ;) |
| 09:51 | fliebel | http://pastebin.com/0CW1KRDK |
| 09:51 | fliebel | What are all the null bytes? |
| 09:53 | fliebel | What is supposed to be there I think is 0a 0a and then 10 bytes of text. |
| 09:54 | kumarshantanu | generally ZIP uses symbols to pack data...null bytes may be the filler for every block |
| 09:54 | fliebel | kumarshantanu: But this is not zipped data anymore, right? |
| 09:55 | kumarshantanu | fliebel: oh, didn't notice that..okay |
| 09:58 | fliebel | So, the strange thing is that there are more bytes then I expected reading the spec. |
| 11:05 | ruhe | Hi folks. I'm trying to pass sequence to function which accepts an "&" argument. But without any success yet. Is this possible? Example: < (struct mystruct (map fn collection)) > |
| 11:05 | fliebel | ruhe: apply? |
| 11:06 | ruhe | fliebel: could you please provide an example? |
| 11:06 | raek | &(max 1 2 3) |
| 11:06 | sexpbot | ⟹ 3 |
| 11:07 | raek | &(apply max [1 2 3]) |
| 11:07 | sexpbot | ⟹ 3 |
| 11:07 | ruhe | ok, got it |
| 11:07 | ruhe | thanks guys |
| 11:07 | raek | also (apply f a b c [d e f]) is the same as (apply f [a b c d e f]) |
| 11:08 | raek | so you can add some arguments in front of the ones from the collection |
| 11:18 | BobFunk | anyone here using got the clojure bundle for TextMate to work with rvm? |
| 11:37 | currentB | `(reduce #(into [] %) [1 2 3 4 5]) |
| 11:38 | currentB | &(reduce #(into [] %) [1 2 3 4 5]) |
| 11:38 | sexpbot | java.lang.IllegalArgumentException: Wrong number of args (2) passed to: sandbox6382$eval8585$fn |
| 11:39 | raek | &(reduce conj [] [1 2 3 4 5]) |
| 11:39 | sexpbot | ⟹ [1 2 3 4 5] |
| 11:39 | currentB | thanks :) |
| 11:39 | raek | into is defined using reduce and conj |
| 11:40 | raek | &(into [] [1 2 3 4 5]) |
| 11:40 | sexpbot | ⟹ [1 2 3 4 5] |
| 13:55 | fliebel | Can anyone help me with reading some binary data with Gloss? Gloss: https://github.com/ztellman/gloss/wiki/Introduction Data: https://github.com/preble/InsideJob/raw/master/test.nbt Spec: http://www.minecraft.net/docs/NBT.txt Code: http://pastebin.com/M4KA6am1 |
| 14:22 | Null-A | My job uses clojure, starting in a few days :) |
| 14:22 | Null-A | need to learn it |
| 14:23 | Null-A | I really liked "How to write a scheme interpreter in haskell" is there anything similar for clojure? |
| 14:28 | qbg | People have done exercises from SICP in Clojure |
| 14:36 | Null-A | qbg: interesting, hadn't heard of SICP |
| 14:36 | qbg | It is a classic book |
| 14:36 | qbg | Uses Scheme, but is more about programming than Scheme |
| 14:36 | Null-A | have you read joy of clojure? |
| 14:37 | qbg | I've looked through it |
| 14:37 | qbg | Programming Clojure is another good book |
| 14:37 | Null-A | what do you think is the best starting point between the two? |
| 14:37 | Null-A | or the three |
| 14:37 | Null-A | I know some haskell, and lots of C++ |
| 14:37 | Raynes | Programming Clojure is fairly outdated, and will be even more outdated when 1.3 comes out. |
| 14:38 | Raynes | Practical Clojure is probably the next logical step after Programming Clojure. |
| 14:38 | Raynes | The Joy of Clojure is a fantastic book. |
| 14:38 | Null-A | *nods* |
| 14:38 | Null-A | maybe start there.. |
| 14:39 | qbg | It's hard for me to evaluate The Joy of Clojure because I already knew a lot of Clojure by the time I read it |
| 14:39 | qbg | Seems like it should be a good book |
| 14:43 | Null-A | scip first chapter is already pretty enlightening |
| 14:43 | Null-A | sicp* |
| 14:44 | qbg | The video lectures that follow the first edition are also amazing |
| 14:44 | Raynes | Remember that Scheme and Clojure are two very different languages, albeit Lisp languages. |
| 14:45 | Null-A | Raynes: I'm reading sicpinclojure.com that should help |
| 14:46 | Raynes | :) |
| 14:48 | MayDaniel | Null-A: sicpinclojure.com is (I think) just SICP at the moment, with no Clojure. |
| 14:48 | Null-A | oh ok |
| 14:48 | Raynes | MayDaniel: It is? Darn, I presumed that at least /some/ progress had been made. |
| 14:49 | Raynes | s/presumed/assumed/ |
| 14:49 | sexpbot | <Raynes> MayDaniel: It is? Darn, I assumed that at least /some/ progress had been made. |
| 14:49 | MayDaniel | I thought they'd adapted a little to Clojure, but checking the "Current Status" page, apparently not. |
| 14:50 | Null-A | Raynes: heh, that's a subtle distinction between the two terms |
| 14:51 | Raynes | $seen cemerick |
| 14:51 | sexpbot | cemerick was last seen quitting 3 hours and 5 minutes ago. |
| 14:51 | LauJensen | I saw a website with quite a few SICP lessions translated to Clojure a year or so ago |
| 15:23 | qbg | Now better explained: https://github.com/qbg/syntax-rules/wiki/defn-implementation |
| 15:59 | serp__ | I have something bound to the variable x. how do I check if it's a sequence? |
| 16:00 | fliebel | serp__: ##(seq? (list 1 2 3)) |
| 16:00 | sexpbot | ⟹ true |
| 16:00 | Raynes | &(seq? '(1 2 3)) |
| 16:00 | sexpbot | ⟹ true |
| 16:00 | Raynes | &(seq? [1 2 3]) |
| 16:00 | sexpbot | ⟹ false |
| 16:00 | serp__ | oh.. |
| 16:00 | fliebel | &(coll? [1 2 3]) |
| 16:00 | sexpbot | ⟹ true |
| 16:00 | opqdonut_ | &(not (nil? (seq [1 2 3]))) |
| 16:00 | sexpbot | ⟹ true |
| 16:00 | opqdonut_ | that's what I use... |
| 16:01 | Raynes | opqdonut_: A vector isn't a sequence, so your example is actually incorrect. |
| 16:01 | Raynes | It is, however, sequential: ##(sequential? [1 2 3]) |
| 16:01 | sexpbot | ⟹ true |
| 16:02 | opqdonut_ | (.class '(1 2 3)) |
| 16:02 | opqdonut_ | gah |
| 16:02 | opqdonut_ | &(.class '(1 2 3)) |
| 16:02 | sexpbot | java.lang.IllegalArgumentException: No matching field found: class for class clojure.lang.PersistentList |
| 16:02 | qbg | ,(class '(1 2 3)) |
| 16:02 | clojurebot | clojure.lang.PersistentList |
| 16:02 | opqdonut_ | there |
| 16:02 | qbg | ,(class (seq [1 2 3])) |
| 16:02 | clojurebot | clojure.lang.PersistentVector$ChunkedSeq |
| 16:02 | Raynes | PersistentList implements the seq API directly, so it is an actual seq. |
| 16:03 | opqdonut_ | anyway, I find it kinda weird that a list is a sequence according to... oh |
| 16:03 | opqdonut_ | okay |
| 16:03 | qbg | Don't use list? to check for seqs |
| 16:03 | fliebel | serp__: As you see, it completely depends on what you want to know and consider a sequence. |
| 16:04 | opqdonut_ | indeed |
| 16:04 | Raynes | &(parents clojure.lang.PersistentList) |
| 16:04 | sexpbot | ⟹ #{clojure.lang.ASeq java.util.List clojure.lang.IReduce clojure.lang.IPersistentList clojure.lang.Counted} |
| 16:06 | fliebel | &(ancestors clojure.lang.PersistentList) |
| 16:06 | sexpbot | ⟹ #{clojure.lang.IPersistentStack clojure.lang.Sequential clojure.lang.IPersistentCollection clojure.lang.ASeq java.lang.Object java.io.Serializable clojure.lang.IObj java.util.List clojure.lang.IMeta java.lang.Iterable clojure.lang.IReduce java.util.Collection clojure... http://gist.github.com/762007 |
| 16:20 | dsop | hmm is there a way to define a private method in a deftype? |
| 16:21 | qbg | dsop: Why would you want such a thing? |
| 16:21 | dsop | qbg: to encapsulate helper methods |
| 16:22 | qbg | Any reason why your helper methods can't be regular functions? |
| 16:22 | dsop | no, they can, just asking myself if there is a way |
| 16:22 | qbg | protocols = interfaces |
| 16:23 | qbg | So no |
| 16:35 | fliebel | dsop: Put only in the interface what belongs to the api, helper functions are an implementation details, so don't put them in a protocol. |
| 17:15 | BobFunk | trying to get https://github.com/gcv/appengine-magic to work - but can't start the app from the repl |
| 17:16 | BobFunk | works fine when running appengine-prepare and then dev_appserver.sh |
| 17:16 | BobFunk | but when trying (ae/start my-app) - I just get: java.lang.Exception: No such var: ae/start (NO_SOURCE_FILE:3) |
| 17:31 | BobFunk | hmm, why would I get "java.lang.Exception: Unable to resolve symbol: compile in this context" from the lein repl ? |
| 17:34 | tonyl | is ae imported/required/used before being used? |
| 17:34 | tonyl | I don't know about appendine-magic, but that might be a problem |
| 17:37 | leafw | hi all. 'd apreciate help on figuring out why a loop gets number boxing warnings, when it shouldn't: http://clojure.pastebin.com/9uLZqGhy |
| 17:37 | BobFunk | managed to advance a bit by including swank in the dev dependencies |
| 17:38 | leafw | the loop is defined as (loop [l (int left) r (int right)], and then only dec and inc are used on such numbers. |
| 17:41 | BobFunk | now I'm just getting a java.lang.NullPointerException when trying to start the app |
| 17:44 | BobFunk | any hints on how to get some more info on the error from the repl? |
| 17:46 | qbg | (.printStackTrace *e) |
| 17:46 | BobFunk | thanks |
| 17:54 | raek | hrm, did 'num' have something to do with this? |
| 18:32 | rak85 | hi |
| 18:34 | auser | hola |
| 18:34 | auser | op later |
| 19:51 | auser | is there a way to pause a thread? |
| 20:01 | auser | or wait() |
| 20:02 | pdk | (Thread/sleep) ? |
| 20:03 | auser | no... that just sleeps |
| 20:03 | auser | basically I have a reference that holds a boolean. I want to be able to pause/resume the thread based on the value of the (ref) |
| 20:05 | auser | doesn't seem like it should be difficul |
| 20:05 | auser | t |
| 20:06 | auser | right? |
| 20:12 | pdk | hmm |
| 20:12 | pdk | this'll probably sound dumb but have you read up on the promises/futures features in clojure |
| 20:19 | auser | yeah, guess so |
| 20:48 | bendlas | (contains? (transient {:x 1}) :x) |
| 20:48 | bendlas | ,(contains? (transient {:x 1}) :x) |
| 20:48 | clojurebot | false |
| 20:48 | bendlas | ,(clojure-version) |
| 20:48 | clojurebot | "1.2.0" |
| 20:48 | bendlas | &(clojure-version) |
| 20:48 | sexpbot | ⟹ "1.2.0" |