#clojure logs

2011-01-01

00:00Crowbar7Happy New Year!
00:00qbgStill an hour to go here
00:00RaynesHappy new year for those in the eastern time zone.
00:00Raynesqbg: Likewise.
00:01programblestupid non-easterners
00:10auserokay... so um... I have a LazySeq... can I transform it into a non lazy sequence?
00:11qbg,(doc doall)
00:11clojurebot"([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:11qbg^ Likely what you want
00:12auserI see... can you do a filter inside of a doall?
00:12qbg,(doall (filter odd? (range 10)))
00:12clojurebot(1 3 5 7 9)
00:13qbgdoall works on any seq
00:14Raynes&(apply str (reverse (map #(.toUpperCase (str %)) (interleave [\r \e \space \e \space \p \a] [\a \y \w \n \y \p \h]))))
00:14sexpbot⟹ "HAPPY NEW YEAR"
00:15ausernm, it worked
00:15auserthanks
00:17qbgTasty new year goodness: https://github.com/qbg/syntax-rules/wiki/defn-implementation
00:18cemerickqbg: looks like you've got something serious cooking over there :-)
00:19qbggit log --oneline | wc -l reports 42 commits so far...
00:20qbgTemplates are terrible; I need to create more powerful ones sometime later
00:21qbgI also need to get it supporting lexical scope in +code templates
00:21qbgAnd fix the progress implementation
00:21qbgetc. *sigh*
00:24qbgThe pattern matcher could be cleaned up too; its currently 471 lines in a single file
00:25qbgShould do an alpha release either tomorrow or the day after
00:28cemerickqbg: the defn walkthrough helps me see things dimly :-)
00:29cemerickSome side-by-side syntax-quote vs. syntax-rules macros would likely be a good addition.
00:29qbgYeah, it needs to be improved before I make a release
00:30qbgsyntax-quote annoys me so much right now; I'm basically reimplementing it in the templates
00:30qbgI want to snarf parts of it, but its implemented in the reader...
00:32qbgcemerick: I've reimplemented a few macros from core in src/qbg/syntax-rules/examples.clj
00:32qbghttps://github.com/qbg/syntax-rules/blob/master/src/qbg/syntax_rules/examples.clj
00:39qbgI 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:41cemerickI guess I'll finally have to buckle down and learn them finally :-)
00:44qbgsyntax-rules and syntax-case are easy enough
00:45qbgsyntax-parse is quite new (it has been in Racket for about a year)
00:46qbgIt adds more powerful patterns and a focus on good error messages
00:46qbgWho can resist good error messages for free after all?
00:58qbgHappy New Years from CST
01:02Raynesqbg: Happy New Years! :>
01:02qbg:D
01:03qbgI wonder what will happen in the next year of Clojure
01:03qbgAbout this time last year 1.1 was released; so much has happened since then
01:03Raynesqbg: 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:04qbg(read: Clojure development has _NOT_ stalled)
01:11iveyRaynes: happy new year
01:11ivey'bama time
02:05Gigarobyhappy new year everyone
06:44ejacksonHappy 2011 #Clojure.
06:44kumarshantanuejackson: +1
06:46xenyl1 year to go for 2012, cool :)
06:50ejacksonalthough 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:52kumarshantanuejackson: more debatable date of th year -- 11/11/11
06:55ejacksonthat's more fun
06:55kumarshantanuJapan probably writes yyyy-mm-dd, so I guess 11/11/11 will get them too ;-)
06:56Adamantkumarshantanu: I don't think anyone does that unless they do ISO dates
06:56Adamantthat's kinda why they chose it
06:56Adamantless to bitch about while being unambiguous
06:57ejacksonlove the Japanese
06:58kumarshantanuAdamant: ISO dates are such a spoilsport *grin*
06:59Adamant:P
06:59Adamanttrolling, trolling, to keep those lines scrolling
06:59AdamantI almost lost control and, replied!
07:02fliebelgood morning, and happy new year!
07:07kumarshantanufliebel: happy new year (oh.. what's the IRC mechanism of RT?)
07:07fliebel$sed -kumarshantanu s///
07:07sexpbotfliebel: Format is sed [-<user name>] s/<regexp>/<replacement>/ Try <prefix>help sed
07:07kumarshantanuRT as in Re-Tweet
07:08fliebelI was trying to trick sexpbot into repeating your message :
07:08fliebel:)
07:10kumarshantanu$sed -fliebel s/x/x/
07:12kumarshantanucan anybody talk about how are dynamic vars distinguished from static ones in Clojure 1.3 ?
07:13kumarshantanuwhat is the syntax?
07:13kumarshantanudo I still get to earmuff them etc?
07:17fliebelkumarshantanu: I don't know much about them, but it seems rather quiet in here, so I'll just try my best.
07:17kumarshantanufliebel: sure, please go ahead
07:18fliebelFrom what I understand, vars are static by default in 1.3, so you can't change them at all.
07:18fliebelAn optimization of some sort.
07:18fliebelThen you can add ^:dynamic metadata to them, and they work like vars work currently.
07:19fliebelearmuffs are still a good convention for marking dynamic vars, but it just that, a convention.
07:20kumarshantanufliebel: is it like (def ^{:dynamic true} *dyn* "ha ha, dynamic") ?
07:21fliebelkumarshantanu: I never use metadata much, but if that is the syntax, yes.
07:22kumarshantanufliebel: Okay...in fact I am writing some code using 1.2 that I might adjust to support 1.3
07:23kumarshantanufliebel: thanks!
07:23fliebelkumarshantanu: I'm sure though there was a shorthand for the dynamic.
07:26fliebelkumarshantanu: You might want to try this: (def ^:dynamic *test* "hoi")
07:27kumarshantanuokay..need to setup 1.3 JARs *lazy* :)
07:28ejacksonmy first 2011 New Years resolution is to step up to 1.3
07:31fliebelWhat is the latest 1.3 alpha?
07:33fliebel(and is Cake already working with that?)
07:40kumarshantanualpha4 I guess, not sure about Cake
08:07kumarshantanufliebel: I tested with alpha-4 -- that works, and so does ^{:dynamic true :doc "Some documentation abt the var"}
08:08fliebelkumarshantanu: Good.
08:10fliebelDoes anyone in here understand Gloss? Because I don't… I'm trying to read some weird binary format.
09:35fliebelHow 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:40midswhat are you trying to do? pastebin?
09:40fliebelmids: Pastebin a binary file? Strange sense of humor ;)
09:41fliebelI'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:43midsgetting 404s on their test .nbt files
09:44fliebelMe to… Try this: http://dl.dropbox.com/u/10094764/World2.zip
09:44fliebelIs there an easy way to look at binary files to study the actual data?
09:45midson unix; hexdump
09:46kumarshantanufliebel: maybe you should develop functions to output/parse binary files vs "od -x filename.bin" first for pastebin ;-)
09:48fliebelkumarshantanu: I don't think I get you…
09:48midsfliebel: are you gunzipping the data before decoding?
09:48kumarshantanupastebin won't take binary files, so why not paste the output of this -- $ od -x filename.bin
09:49fliebelmids: No, I'm putting them through GZIPInputStream ;)
09:51fliebelhttp://pastebin.com/0CW1KRDK
09:51fliebelWhat are all the null bytes?
09:53fliebelWhat is supposed to be there I think is 0a 0a and then 10 bytes of text.
09:54kumarshantanugenerally ZIP uses symbols to pack data...null bytes may be the filler for every block
09:54fliebelkumarshantanu: But this is not zipped data anymore, right?
09:55kumarshantanufliebel: oh, didn't notice that..okay
09:58fliebelSo, the strange thing is that there are more bytes then I expected reading the spec.
11:05ruheHi 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:05fliebelruhe: apply?
11:06ruhefliebel: could you please provide an example?
11:06raek&(max 1 2 3)
11:06sexpbot⟹ 3
11:07raek&(apply max [1 2 3])
11:07sexpbot⟹ 3
11:07ruheok, got it
11:07ruhethanks guys
11:07raekalso (apply f a b c [d e f]) is the same as (apply f [a b c d e f])
11:08raekso you can add some arguments in front of the ones from the collection
11:18BobFunkanyone here using got the clojure bundle for TextMate to work with rvm?
11:37currentB`(reduce #(into [] %) [1 2 3 4 5])
11:38currentB&(reduce #(into [] %) [1 2 3 4 5])
11:38sexpbotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: sandbox6382$eval8585$fn
11:39raek&(reduce conj [] [1 2 3 4 5])
11:39sexpbot⟹ [1 2 3 4 5]
11:39currentBthanks :)
11:39raekinto is defined using reduce and conj
11:40raek&(into [] [1 2 3 4 5])
11:40sexpbot⟹ [1 2 3 4 5]
13:55fliebelCan 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:22Null-AMy job uses clojure, starting in a few days :)
14:22Null-Aneed to learn it
14:23Null-AI really liked "How to write a scheme interpreter in haskell" is there anything similar for clojure?
14:28qbgPeople have done exercises from SICP in Clojure
14:36Null-Aqbg: interesting, hadn't heard of SICP
14:36qbgIt is a classic book
14:36qbgUses Scheme, but is more about programming than Scheme
14:36Null-Ahave you read joy of clojure?
14:37qbgI've looked through it
14:37qbgProgramming Clojure is another good book
14:37Null-Awhat do you think is the best starting point between the two?
14:37Null-Aor the three
14:37Null-AI know some haskell, and lots of C++
14:37RaynesProgramming Clojure is fairly outdated, and will be even more outdated when 1.3 comes out.
14:38RaynesPractical Clojure is probably the next logical step after Programming Clojure.
14:38RaynesThe Joy of Clojure is a fantastic book.
14:38Null-A*nods*
14:38Null-Amaybe start there..
14:39qbgIt'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:39qbgSeems like it should be a good book
14:43Null-Ascip first chapter is already pretty enlightening
14:43Null-Asicp*
14:44qbgThe video lectures that follow the first edition are also amazing
14:44RaynesRemember that Scheme and Clojure are two very different languages, albeit Lisp languages.
14:45Null-ARaynes: I'm reading sicpinclojure.com that should help
14:46Raynes:)
14:48MayDanielNull-A: sicpinclojure.com is (I think) just SICP at the moment, with no Clojure.
14:48Null-Aoh ok
14:48RaynesMayDaniel: It is? Darn, I presumed that at least /some/ progress had been made.
14:49Rayness/presumed/assumed/
14:49sexpbot<Raynes> MayDaniel: It is? Darn, I assumed that at least /some/ progress had been made.
14:49MayDanielI thought they'd adapted a little to Clojure, but checking the "Current Status" page, apparently not.
14:50Null-ARaynes: heh, that's a subtle distinction between the two terms
14:51Raynes$seen cemerick
14:51sexpbotcemerick was last seen quitting 3 hours and 5 minutes ago.
14:51LauJensenI saw a website with quite a few SICP lessions translated to Clojure a year or so ago
15:23qbgNow better explained: https://github.com/qbg/syntax-rules/wiki/defn-implementation
15:59serp__I have something bound to the variable x. how do I check if it's a sequence?
16:00fliebelserp__: ##(seq? (list 1 2 3))
16:00sexpbot⟹ true
16:00Raynes&(seq? '(1 2 3))
16:00sexpbot⟹ true
16:00Raynes&(seq? [1 2 3])
16:00sexpbot⟹ false
16:00serp__oh..
16:00fliebel&(coll? [1 2 3])
16:00sexpbot⟹ true
16:00opqdonut_&(not (nil? (seq [1 2 3])))
16:00sexpbot⟹ true
16:00opqdonut_that's what I use...
16:01Raynesopqdonut_: A vector isn't a sequence, so your example is actually incorrect.
16:01RaynesIt is, however, sequential: ##(sequential? [1 2 3])
16:01sexpbot⟹ true
16:02opqdonut_(.class '(1 2 3))
16:02opqdonut_gah
16:02opqdonut_&(.class '(1 2 3))
16:02sexpbotjava.lang.IllegalArgumentException: No matching field found: class for class clojure.lang.PersistentList
16:02qbg,(class '(1 2 3))
16:02clojurebotclojure.lang.PersistentList
16:02opqdonut_there
16:02qbg,(class (seq [1 2 3]))
16:02clojurebotclojure.lang.PersistentVector$ChunkedSeq
16:02RaynesPersistentList implements the seq API directly, so it is an actual seq.
16:03opqdonut_anyway, I find it kinda weird that a list is a sequence according to... oh
16:03opqdonut_okay
16:03qbgDon't use list? to check for seqs
16:03fliebelserp__: As you see, it completely depends on what you want to know and consider a sequence.
16:04opqdonut_indeed
16:04Raynes&(parents clojure.lang.PersistentList)
16:04sexpbot⟹ #{clojure.lang.ASeq java.util.List clojure.lang.IReduce clojure.lang.IPersistentList clojure.lang.Counted}
16:06fliebel&(ancestors clojure.lang.PersistentList)
16:06sexpbot⟹ #{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:20dsophmm is there a way to define a private method in a deftype?
16:21qbgdsop: Why would you want such a thing?
16:21dsopqbg: to encapsulate helper methods
16:22qbgAny reason why your helper methods can't be regular functions?
16:22dsopno, they can, just asking myself if there is a way
16:22qbgprotocols = interfaces
16:23qbgSo no
16:35fliebeldsop: 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:15BobFunktrying to get https://github.com/gcv/appengine-magic to work - but can't start the app from the repl
17:16BobFunkworks fine when running appengine-prepare and then dev_appserver.sh
17:16BobFunkbut when trying (ae/start my-app) - I just get: java.lang.Exception: No such var: ae/start (NO_SOURCE_FILE:3)
17:31BobFunkhmm, why would I get "java.lang.Exception: Unable to resolve symbol: compile in this context" from the lein repl ?
17:34tonylis ae imported/required/used before being used?
17:34tonylI don't know about appendine-magic, but that might be a problem
17:37leafwhi all. 'd apreciate help on figuring out why a loop gets number boxing warnings, when it shouldn't: http://clojure.pastebin.com/9uLZqGhy
17:37BobFunkmanaged to advance a bit by including swank in the dev dependencies
17:38leafwthe loop is defined as (loop [l (int left) r (int right)], and then only dec and inc are used on such numbers.
17:41BobFunknow I'm just getting a java.lang.NullPointerException when trying to start the app
17:44BobFunkany hints on how to get some more info on the error from the repl?
17:46qbg(.printStackTrace *e)
17:46BobFunkthanks
17:54raekhrm, did 'num' have something to do with this?
18:32rak85hi
18:34auserhola
18:34auserop later
19:51auseris there a way to pause a thread?
20:01auseror wait()
20:02pdk(Thread/sleep) ?
20:03auserno... that just sleeps
20:03auserbasically 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:05auserdoesn't seem like it should be difficul
20:05ausert
20:06auserright?
20:12pdkhmm
20:12pdkthis'll probably sound dumb but have you read up on the promises/futures features in clojure
20:19auseryeah, guess so
20:48bendlas(contains? (transient {:x 1}) :x)
20:48bendlas,(contains? (transient {:x 1}) :x)
20:48clojurebotfalse
20:48bendlas,(clojure-version)
20:48clojurebot"1.2.0"
20:48bendlas&(clojure-version)
20:48sexpbot⟹ "1.2.0"