#clojure logs

2010-11-03

00:12amalloyi'll get the hang of spelling my name one of these years :P
00:18quizmewhen i (run-tests 'myproject.core) i get, 0 failures, 0 errors.
00:18quizmebut there is a test there.
00:18quizmeshouldn't there be at least 1 failure ?
00:19quizmehttp://www.pastie.org/1268633
00:21amalloyquizme: (run-tests 'collatz.test.core)
00:21quizmeamalloy thanks i'll try
00:23quizmeamalloy: awesome thank you
00:23amalloynp. maybe one of these days i'll get around to learning how to use clojure.test myself :P
01:01_na_ka_na_hellos.. how do I override equals, hashcode using deftype?
01:05_na_ka_na_(defprotocol P (foo [this]) (^boolean equals [this ^Object o]))
01:06_na_ka_na_(deftype T [] P (foo [this]) (^boolean equals [this ^Object o]))
01:07_na_ka_na_gives an error
01:07_na_ka_na_java.lang.VerifyError: (class: user/T, method: equals signature: (Ljava/lang/Object;)Ljava/lang/Object;) Expecting to find object/array on stack (repl-1:37)
01:08_na_ka_na_maybe this is the right way
01:08_na_ka_na_(deftype T [] P (foo [this]))
01:08_na_ka_na_(deftype T [] P (foo [this]) Object (equals [this o]))
01:08amalloy_na_ka_na_: i just tried (deftype x [] Object (equals [this other] true)) and it works for me
01:09_na_ka_na_amalloy: yes thx
01:09_na_ka_na_I figured
01:20_na_ka_na_amalloy: how can i add static methods to my deftype which can called as T/a-static-fn
01:20amalloy_na_ka_na_: why would you want to? just use a defn
01:21_na_ka_na_amalloy: hmm you're right
02:06_na_ka_na_I have a bunch of protocols P1, P2, P3 ... it is possible to have master protocol P which is the union of P1, P2, P3
02:08_na_ka_na_for example I want my abstraction to be a union of a protocol I wrote P + Serializable + Comparable
02:10amalloy_na_ka_na_: would you mind explaining why you're doing this? it kinda smells like using clojure to write java, and there might well be an easier way than these protocol gymnastics
02:14_na_ka_na_amalloy: I want an abstraction which comprises of a set of operations i define + i want it to be serializable + so i can use it in sorted-sets (which is really TreeSet and so Comparable)
02:14_na_ka_na_how do you think i define that abstraction?
02:15_na_ka_na_do I even need an abstraction is a separate concern :)
02:17amalloy_na_ka_na_: what about (deftype MyThing [] P Commparable Serializable) and require callers to extend MyThing?
02:17amalloyi don't do a lot of java interop, so this may be a crazy suggestion
02:34_na_ka_na_amalloy: but deftype doesn't define an abstraction
03:22octewhat's the best way of finding memory leaks in clijyure programs?
03:22octeclojure*
03:23kryft...Memory leaks in clojure programs? How do you get a memory leak with garbage collection?
03:23octeno idea.
03:23octei'm quite curious about it myself.
03:28octei'm quite curious about it myself.
03:28octeoops
03:37eugukryft: This way - you accidentally retain references to the objects which are not used in your program anymore. If this occurs regularly it accumulates and can cause OutOfMemory
03:37albinoholding references will usually do it
03:37albinohttp://www.eclipse.org/mat/
03:38kryfteugu: Ok, if that counts as a memory leak. :)
03:38albinokryft: it does, because memory is leaked that should be free()d
03:39kryftDoes that happen easily in clojure then?
03:39albinoHappens often enough in java, I don't know fo clojure
03:41albinohappens in python too
03:42albinoocte: you could try that tool I linked to, I think it's works for jvm implementations and so could work for clojure code
03:42octei'm trying jmap / jhat, built into the jdk
03:47octehmm, that didn't give much useful information..
03:48angermanis there a list somewhere what charactes are allowd as symbol names/
04:27LauJensenMorning
04:38LuminousMonkeyAfternoon. :P
04:57angermanhow do I create a root var?
05:08_na_ka_na_guys can you let me know if this is a bug
05:08_na_ka_na_(deftype T [] Object (equals [this o] (if (instance? T o) true false)))
05:09_na_ka_na_(def t (T.))
05:09_na_ka_na_(.equals t t) => false
05:09_na_ka_na_I'm on 1.2
05:11esjmaybe: (instance this o)
05:11esjin the (if )
05:12esjwait.....
05:12esjit looks like you're checking if things are of the same type instead of equality. Did you mean to ?
05:12jarpiainor (instance? (identity T) ...)
05:14sharat87hello, I want to do an operation on every key-value pair in a map, is there a function for that in clojure or contrib?
05:15_na_ka_na_esj: this is just a dummy to reproduce the issue
05:15jarpiain,(into {} (map (fn [[k v]] [k (* 2 v)]) {:a 1 :b 2 :c 3}))
05:15clojurebot{:a 2, :b 4, :c 6}
05:16_na_ka_na_jarpain: why (identity T) ?
05:16jarpiainthe compiler has a special case for identity? when the first argument is a symbol that resolves to a class
05:17_na_ka_na_jarpain: but (instance? T o) should work as (doc deftype) specifically says that I can use the deftype name inside its methods
05:17jarpiain_na_ka_na_: did you try it?
05:17_na_ka_na_oops its jarpiain, sorry
05:18_na_ka_na_jarpiain: currently I have (= T (class o)) and that works
05:18sharat87oh so I can use the map function on maps too, that's an eye opener
05:19sharat87jarpiain: is that anonymous function using pattern matching to unpack a vector in its first argument?
05:19_na_ka_na_sharat87: you can also do (zipmap (keys m) (map (partial * 2) (vals m)))
05:19sharat87yeah, but in the function I need both the key and the val :)
05:20_na_ka_na_oh ok :)
05:20jarpiain_na_ka_na_: while compiling the deftype, T resolves to a different class object (a compiler-generated stub class)
05:20_na_ka_na_then (map (fn [[k v]] ...) m)
05:20jarpiainwhich might conflict with the special inlining of instance?
05:20sharat87yeah, that's what I need then :) thanks jarpiain and _na_ka_na_
05:21_na_ka_na_jarpiain: hmm that might explain it, but its a bug then ?
05:21esjsharat87: btw, what that pattern matching is called destructuring in clojure (and there's lots you can do with it) just in case you want to google it
05:22sharat87esj: ah thanks for clearing that, as you might have guessed by now, I come from haskell :)
05:23_na_ka_na_sharat87: welcome :) how did you venture here
05:24sharat87browsing peepcode, I came across the clojure video, impressed, here I am :)
05:24sharat87awesome video btw
05:30_na_ka_na_jarpiain: one more thing, (source +) tells us that it is inlined, but (source instance?) doesn't; how did you it might be inlined
05:30jarpiain_na_ka_na_: it's a really special case. You have to look at Compiler.java
05:31_na_ka_na_jarpiain: ok, thanks
05:33fliebelRaynes: I've had my Hammock time, I'm ready for it!
05:33jarpiainhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L3298
05:33LauJensenGuys, does this interface seem intuitive? https://gist.github.com/d835630aff8313980813
05:34fliebelLauJensen: Why the set?
05:34LauJensenfliebel: Which alternative did you have in mind?
05:35fliebelLauJensen: I'm thinking...
05:36bsteuberLauJensen: I do like maps (and would expect an implicit and for more than one entry), but would rather like explicit and and or instead of sets and vectors
05:36bsteuberI also commented on the :invert keyword on github a minute ago
05:37LauJensenbsteuber: Yes thanks I got the notification
05:37LauJensenSo you should prefer [:x 5 :or :y 10] ?
05:37fliebelLauJensen: Yea, more like the ns thing. [a :or b
05:37LauJensenBut wouldnt it be better simply to write pure SQL ?
05:37esjintuitive
05:38angerman(defprotocol Fly "for flying" (fly [this] "..."))
05:38angermanthat's the specification / contract right?
05:39LauJensenesj: what is?
05:39angerman(defrecord [a] Fly (fly [self] (str (:a self) " flies ..."))) should work. no?
05:39fliebelLauJensen: O second thought, I think it should at least be polish notation, so [:or 1 2 3]
05:39bsteuberLauJensen: how about (or {:foo 42} {:bar "baz"})?
05:39angermanbut it tells me "self" not found in context
05:39esjthe #{}, [], {} interface
05:40LauJensenbsteuber: I wont implement the List interface, that'll rob users of too much power
05:40bsteuberwell, [:or] seems fine as well
05:41bsteuberLauJensen: ok, thought of it as plain functions - but I didn't look at your internals
05:42LauJensenbsteuber: The old ClojureQL grabbed all of your Lisp syntax, and made everything (and (> :x 5) (or (< :y 10) (:z 15))) style notation. But that turned out to be a bad idea... I realized after 2.5 yers
05:42LauJensenyears
05:42bobo_hm, why have one map for each statement? and not {:rank "Top" :title "Dev}
05:44LauJensenbobo_: The statements are separated, so it makes to show that in the data structure dont you think?
05:46bobo_hm, maybe
05:46Chousukehm
05:46bobo_it makes more sense in the or example
05:46LauJensenbobo_: You can do both though. The compiler is recursive, so its your choice
05:47LauJensenclojureql.core> (compile {:rank "top" :title "dev"})
05:47LauJensen"rank=top AND title=dev"
05:47LauJensen
05:47ChousukeI think it's got maybe a bit too much syntax :P
05:47LauJensenChousuke: Suggestions?
05:47clojurebotHuh?
05:48Chousukethat case is good though. but for the OR case having to wrap each thing in a map might get boring pretty quickly
05:48bsteuberLauJensen: but can't you implement a function and that returns [:and ..] then?
05:48fliebel"To many notes" "Which notes did you hand in mind?" - Mozart
05:48bsteuberso people could still use list notation but don't lose power
05:49LauJensenbsteuber: Sure its possible with a helper
05:49fliebelbsteuber: macroes are icing ;)
05:49Chousukewith that syntax you could save lists for "user-defined" things I suppose
05:50LauJensenWell. I dont want lists in the protocol, that would break {:x 5 :y (let [z ...] z)}
05:50Chousukelike [{:id 5} (like :foo "something")] where like returns something that the compiler can handle
05:50Chousukeyeah
05:52LauJensenI'll try to follow the data-structure trail to the end. Then it might be macro/helper time :]
05:52ChousukeI'd be wary of using #{} though
05:52Chousukesince the order is undefined
05:52LauJensenChousuke: Order doesnt matter for OR statements
05:53Chousukeuntil you hit some weird corner case where it does ;P
05:54LauJensenYea I guess you're right.
05:55Chousukebut if you reserve () for things that are evaluated, it should be easy to implement cql/and and cql/or that you can use in queries
05:55Chousukein addition to perhaps having syntax for them
05:55bsteuberI would be in for [:or …] etc then
05:55LauJensenyea
05:56bsteubermaybe then also [:not] for invert
05:56bsteuberthough I still like select-not :)
05:56LauJensen:invert is a bit counter-intuitive "read this, then totally reverse your understanding" :)
05:56bsteuberexactly :)
05:56Chousukemaybe have a basic set of compiler operations like :and :or :not and then just have [operator parameters*]
05:58Chousukeusers wouldn't necessarily have to use that form directly, but it might make sense for the compiler to reduce everything to such vectors before further processing
05:59LauJensenChousuke: Can you gist an example of how you see this playing out?
06:02jjidowrt using structures isn't this more readable? https://gist.github.com/559c305e432ff0b0e41e
06:03LauJensenjjido: For me its the same, but like I said before, the protocol doesnt do lists
06:03jjidook use a different keyword then
06:09ChousukeLauJensen: https://gist.github.com/6fec4a139a299dc17627 ?
06:09bsteuberChousuke: huh, don't like :eq
06:10bsteuberI think maps are fine for k/v-pairs
06:10Chousukebsteuber: it could be an implementation detail
06:10LauJensenbsteuber: as a user, you would use (= ...
06:10LauJensenChousuke: Looks interesting. I'll play around a little and see what comes out. Thanks for your input
06:11Chousukein the sugared form I did use the map thing so I think it's fine.
06:11bsteuberah, sorry, didn't look at the sugared one
06:11bsteuberyeah, seems cool
06:12ChousukeI think compile could support some of the sugar directly, so that user functions wouldn't have to worry about desugaring maps for example
06:13Chousukeso cql/and could just return [:and {'rank "top"} ...] and the compiler would handle that.
06:13bsteuberbut then you don't need :eq at all, I guess :)
06:13Chousukeit might make the implementation easier
06:14LauJensenYea thats how I imaged I would do it
06:14Chousukeand users could still use the compiler ops directly in their own functions
06:18bobo_LauJensen: the idea behind clojureql is to abstract away the parts that differ between databases right?
06:19LauJensenbobo_: That was the old idea. The revised idea, which I might blog about today, is just to have some slick integration, where the differences between backends are left to the user
06:21bobo_ok, please do blog! :-)
06:22jjidohttps://gist.github.com/559c305e432ff0b0e41e
06:22LauJensenYes sir :)
06:23LauJensenjjido: Thats definitely not bad
06:24jjidoLauJensen: inspired by SQL ;)
06:24LauJensenWho needs hammock time when you've got #clojure :)
06:25bobo_hm, so [] is or in that example?
06:25LauJensenyea
06:25bobo_think i like it
06:25fliebelLauJensen: I do, but I do that when I'm not in #clojure (sleeping)
06:26bobo_i wrote a method that converts all OR to UNIONS yeasterday, things like that would be great to have in clojureql aswell
06:27LauJensenGot gist?
06:27bobo_no it was java :-(
06:27LauJensenouch
06:28bobo_yeh i know. but my sql library at work is getting pretty nice, should write it in clojure for fun.
06:28jjidoLauJensen: do you need nested AND? https://gist.github.com/559c305e432ff0b0e41e
06:28jjidoLauJensen: does not look as good
06:29LauJensenYou're competing against whats already there
06:29LauJensenclojureql.core> (compile #{{:rank "Top"} {:title "Dev" :id 5}})
06:29LauJensen"(rank=\"Top\" OR title=\"Dev\" AND id=5)"
06:29LauJensen
06:30LauJensenThough the parens needs fixing
06:30LauJensenI think your model is showing some code explosion tendencies
06:48ariejanMaybe a stupid question, but is there anything in Clojure to get a current timestamp?
06:49LauJensen&(-> "x.y" (.split ".") first)
06:49sexpbot⟹ nil
06:50LauJensenAm I forgetting my Java-fu, shouldnt that return x ?
06:50bobo_split takes a regexp?
06:50bobo_or?
06:51LauJensenbobo_: Ah right, Regex AS string :)
06:51LauJensen&(-> "x.y" (.split "\\.") first)
06:51sexpbot⟹ "x"
06:51bobo_:-)
06:51LauJensenariejan: try (java.util.Date.)
06:51esjariejan: I just go to java with (java.util.Date.)
06:51esjpffft
06:51LauJensenesj: aaah just a wee bit too slow
06:52LauJensen:D
06:52ariejanI just found: (. System (nanoTime))
06:52LauJensen&(System/nanoTime)
06:52sexpbot⟹ 185913853697964
06:53ariejanExactly. It's just to use some unique value for testing redis performance.
06:53bobo_&(Math/random)
06:53sexpbot⟹ 0.698805992174627
06:54LauJensenbobo_: unique != random
06:54bobo_true
06:55LauJensen&(java.util.UUID/randomUUID)
06:55sexpbot⟹ #<UUID d8ec9da7-ea94-430f-8292-fc802a198180>
06:55LauJensen100% concurrency safe
06:57bobo_i also think redis already has a testsuite for performancetesting. but thats not as fun
06:58ariejanbobo_: Yes, but I wanted to see clojure aleph in combination with setting a key per request. It's blazingly fast. 0.977ms per request on average on my i5 macbook pro.
06:59bobo_:-)
07:00LauJensenariejan: With how many concurrent requests?
07:01ariejan50 concurrent requests.
07:01ariejanBut I see only 8 redis clients connecting. See details here: https://gist.github.com/660970
07:02LauJensenwow
07:03ariejanLauJensen: With 8 concurrent requests I get 0.739ms/req. (1354 req/sec)
07:03ariejanIf there's any optimalisations I can do in my code, please let me know.
07:04LauJensenCould you regist the code, I just logged in/out
07:04ariejanLauJensen https://gist.github.com/660970
07:13ariejanWhat is the reason I see 8 clients connecting to redis? Is that a clojure config option, jvm?
07:17LauJensenI think Aleps caps concurrent connections at 8, hence the speed. A Synced framework wouldnt cap so early
07:29fliebelMan, this is crazy… The Python version of my parser is 6 times faster on just reading files. And even worse, it keeps them in memory all at once. When I do this in Clojure it never finishes and takes up a massive amount of memory.
07:38fliebelHow much memory will a seq of 99844096 bytes consume? (compared to a string or a byte[] of 99844096 itmes)
07:39jarpiain,(doc vector-of)
07:39clojurebot"([t]); Creates a new vector of a single primitive type t, where t is one of :int :long :float :double :byte :short :char or :boolean. The resulting vector complies with the interface of vectors in g...
07:41fliebeljarpiain: I'll try it.
07:41raekfliebel: which seq type?
07:42fliebelraek: I do concat on the byte[]'s, so I guess it becomes a lazy seq then.
07:43raeka lazy seq usually constructs conses, so I guess 99844096 * the size of a clojure.lang.Cons
07:43raekalso, the bytes will be boxed, so they will consume more than one byte of memory
07:45raek,(class (seq (make-array Integer/TYPE 3)))
07:45clojurebotclojure.lang.ArraySeq$ArraySeq_int
07:46raekan array of primitives is probably the most compact way of storing the data, if you really need everything in memory at the same time
07:47fliebelraek: I don't really, but I'm trying to figure out why Clojure is 6 times slower at reading the same data Python does.
07:48raekfliebel: how do you do the IO? one byte at a time?
07:48fliebelraek: No, I use a library which returns a byte[]
07:49raekok. good.
07:50raekdo you have both versions in gists?
07:51fliebelraek: On github at least.
07:52raekalso, did you manage to get rid of the reflection? (I'm just curious)
07:52fliebelraek: I did.
07:54raekgreat!
07:54fliebelPython: https://github.com/l0b0/mian/blob/master/mian/mian.py#L244-254 Clojure: https://github.com/pepijndevos/Clomian/blob/master/src/clomian.clj#L101-119 (gets called at line 133)
07:54raekhow much did it affect the performance?
07:55fliebelraek: Quite a lot. But the biggest win of the day was using a transient.
07:56raekhas this something to do with Minecraft?
07:56fliebelraek: yea, analyzing levels and stuff.
07:58raekcool. IIRC, tomoj has coded something Minecraft-related too
08:00raekis it the data processing or the IO that takes most time?
08:01raekhave you compared just reading data in both the clojure and python without processing it?
08:01fliebelraek: I have compared just getting the blocks, not the pure reading. But the functions that spit out the files are equally fast.
08:01yayitsweiquick question: why does (map #(Integer/parseInt %) '("1" "2")) work whereas (map Integer/parseInt '("1" "2")) does not?
08:01raek(to rule out that the lib is the bottleneck)
08:02Chousukeyayitswei: Integer/parseInt is not a clojure function
08:02raekyayitswei: Integer/parseInt is not a real function (an onbject that implements clojure.lang.IFn)
08:02yayitsweiah, so the reader macro only works with clojure functions
08:03Chousukeno, the reader macro creates a clojure function
08:03fliebelraek: So I should just do the FileInputStream and read?
08:03raekhow is the data read? is it just the bytes of the file?
08:03Chousuke#(Integer/parseInt %) expands to something like (fn [x] (Integer/parseInt x))
08:03Chousukewhich map can use
08:04fliebelraek: it's gzipped, but then it's just bytes I believe.
08:04raek...which expands to something like (fn [x] (. Integer parseInt x))
08:05yayitsweioh, right.. so how does the (. Integer parseInt x) work then?
08:05raekwell, if the java lib was as fast as the python lib, this will not make any difference, right?
08:05raekyayitswei: it is a special form, handled specially by the compiler.
08:06yayitsweii see. thanks guys
08:09raekfliebel: does the time include the JVM startup delay too?
08:09fliebelraek: no :P
08:10raekgood... saw the -main method and started to get suspicious
08:10fliebelraek: nah, did a (time) on the repl
08:11fliebelraek: gtg, I'll test it later. thanks :)
08:55tonylmorning
09:16djpowellhas anyone had a look at microsoft's reactive stuff? i was just playing around doing similar stuff in clojure the other day. it looks pretty cool
09:19chouserdjpowell: rhickey recommended understanding it recently.
09:19djpowellyeah - i saw that
09:20noididjpowell, do you have an URL for that? or should I just google for "microsoft's reactive stuff"? :)
09:21djpowellthe idea is that sequence type things are the dual of observable type things that you can register with to be notified about data - they are both just sources of data, so a function can generically convert any seq to an observable, and any observable to a seq
09:21djpowellhang on...
09:21noidiblimey, I think that google search actually worked
09:21noidiReactive Extensions for .NET
09:22noidiI had to give it a try :)
09:22djpowellhttp://rxwiki.wikidot.com/101samples is a good way to get a quick summary of what you can do with it
09:22noididjpowell, thanks!
09:24djpowelllike clojure, microsoft do lots of things with sequence abstractions - eg LINQ lets you do map/filter higher-order function type stuff with them with an SQL-like syntax. Plus lots of things can be seen as having observable events - Desktop UIs, incoming AJAX requests etc; so bringing the two together seems pretty powerful
09:25BahmanHi all!
09:25djpowellhi
09:38pjstadigre: "reactive stuff" ...i saw a pres on that at the CUFP looked interesting
09:42fogus_pjstadig: Matt P at the CAPCLUG is one of the lead devs... you should corner him about it one day. Very interesting ideas
09:48pjstadigfogus_: he hasn't been in a while has he? i don't recall
09:49fogus_I haven't been in a while either. :-(
11:40bhenrywhat if i want to pull together a handful of imports into one namespace, and then just be able to (:use namespace]) in multiple (ns) calls?
11:41bhenryand have access to all those imported classes
11:41tonylhave you tried it?
11:42bhenryit doesn't work. i'll show you what i tried in a gist
11:46fliebelraek: I tired the file reading thing, and it takes 1961.726 msecs, so I'm afraid it's the NBT library.
11:48bhenrytonyl: https://gist.github.com/b16af68b7e6482734992
11:48pjstadigbhenry: checkout nstools
11:49pjstadigi think that might do what you want
11:49pjstadighttp://code.google.com/p/clj-nstools/
11:52bhenrypjstadig: thanks. looks like i can't avoid having two lines where i want one. i'm just being picky. mine has the (use-karras) after the ns call and that has (use 'nstools.ns) before it.
11:54tonylyeah bhenry, I wouldn't know much about namespaces, but it seems that the ns+ function in nstools might help you
11:56fliebelHow can I get the entire content of a GZIPInputStream?
11:57pjstadigclojure.contrib.io/to-byte-array?
11:57clojurebotYes, Clojure can do that!
11:57pjstadigclojurebot: botsnack
11:57clojurebotthanks; that was delicious. (nom nom nom)
12:01fliebelpjstadig: That might work. What is the classic java way to do that?
12:02pjstadiguh...why would you want to do it in java?
12:02pjstadigit'll set your hair on fire
12:02hiredmanto-byte-array is bad
12:02fliebelTo understand how it works.
12:02pjstadigyou have to use an apache commons library to make it let painful
12:02fliebeland because of what hiredman said ;)
12:02pjstadighiredman knows nothing
12:02joegalloNo! You have to build a ByteArrayOutputStream and copy over the bytes like a boss!
12:02hiredmanlast I checked to-byte-array shoves things into a StringBuilder then calls getBytes on the String
12:02hiredmanhorrible
12:03pjstadigoh
12:03pjstadighiredman is correct
12:03pjstadigbut otherwise you have to copy chunks across like joegallo says
12:03tonylanybody knows of any clojure groups in kansas?
12:04hiredman(with-open [baos (ByteArrayOutputStream.)] (copy gzipstream baoas) (.toByteArray baos))
12:04joegallofliebel: Like this: http://stackoverflow.com/questions/67275/reading-from-a-zipinputstream-into-a-bytearrayoutputstream
12:05pjstadighmm...looks like to-byte-array uses a BAOS http://bit.ly/addDYt for InputStreams
12:05fliebelhiredman: Where does copy live?
12:05hiredmanclojure.java.io
12:06fliebelgreat
12:13rata_hi all
12:13hiredmanactually my local checkouts of clojure and contrib don't seem to have to-byte-array in them
12:18rata_do you know what's the line to put fnparse 3.x as a dependency in project.clj?
12:19edoloughlinAnyone care to shed some light on destructuring forms? http://stackoverflow.com/questions/4089162
12:26Bootvis,`(foo bar)
12:26clojurebot(sandbox/foo sandbox/bar)
12:26Bootvisis it possible to not display the namespace in the above?
12:27rata_Bootvis: why do you want such a thing?
12:27MayDaniel,`(~'foo ~'bar)
12:27clojurebot(foo bar)
12:27Bootvisrata: i'm working through land of lisp in clojure
12:27rata_namespaces are important for macros hygenie IIRC
12:28BootvisMayDaniel: thanks maybe I can put that transformation in a macro
12:48rata_do you know what's the line to put fnparse 3.x as a dependency in project.clj?
12:54fliebelrata_: http://clojars.org/search?q=fnparse
12:54rata_fliebel: oh, thanks a lot =)
12:54fliebelraek: Are you still around?
12:56alpheusIs there a predicate for atom? (I just realized that the obvious meaning of that for a Scheme or Lisp programmer would not apply in Clojure.)
12:57tonylclojure.inspector/atom?
12:57clojurebot"[Clojure ...] feels like a general-purpose language beamed back from the near future."
12:59amalloyalpheus: there was a longish discussion of this yesterday
12:59amalloyclojurebot: logs?
12:59clojurebotlogs is http://clojure-log.n01se.net/
12:59tonylhttp://clojuredocs.org/clojure_core/clojure.inspector/atom_q
12:59alpheusSorry, I didn't see that. I'll review.
12:59tonylthe one in inspector just checks if it is not an atom
13:00amalloytonyl: heh, i guess that's one way to do it. personally i'd use (not (coll? x)) directly, but whatever
13:00tonyls/atom/coll/
13:00sexpbot<tonyl> the one in inspector just checks if it is not an coll
13:01tonylsexpbot: cool
13:01tonylamalloy: yeah, beats requiring a ns
13:02mabeswhen I call class on a double does it automatically get coerced into a Double?
13:02mabes,(class (double 1.0))
13:02clojurebotjava.lang.Double
13:02mabes(I'm using 1.2)
13:03mabesI'm dealing with some java interop and I need to pass in an array of doubles (not Doubles). I can't seem to do that though...
13:03mabes,(into-array (map double [1.0 2.0]))
13:03clojurebot#<Double[] [Ljava.lang.Double;@1280c85>
13:03mabesany ideas?
13:03amalloy&(make-array Double/TYPE 10)
13:03sexpbot⟹ #<double[] [D@f9de08>
13:04amalloy&(into (make-array Double/TYPE 10) (map double (range 10)))
13:04sexpbotjava.lang.ClassCastException: [D cannot be cast to clojure.lang.IPersistentCollection
13:04amalloyoh well :P
13:04mabesamalloy: thanks! I'll try to figure it out from here.
13:05mabesactually..
13:05mabes,(into-array Double/TYPE [1.0 2.0])
13:05clojurebot#<double[] [D@1283826>
13:05amalloyyeah, i just found that too
13:05mabescool, yeah, I didn't know about the Double/TYPE thing until you showed me
13:06amalloy&String/TYPE
13:06sexpbotjava.lang.Exception: Unable to find static field: TYPE in class java.lang.String
13:06amalloyonly primitives have this sugar to get at their class
13:07alpheustonyl: clojure.inspector/atom? is kind of like the Lisp or Scheme version. I was thinking more about clojure.lang.Atom. Then I remembered that class tells me that.
13:09amalloyalpheus: you can generalize with (instance? clojure.lang.IDeref (class foo))
13:09amalloyif you want to just check whether @foo is legal
13:09alpheusoh, nice
13:13alpheusShouldn't that be: (instance? clojure.lang.IDeref foo)
13:16amalloyoh
13:16amalloyyeah i guess
13:18bhenryis there something that (this-thing "string") will make clojure think it's dealing with a file?
13:19amalloybhenry: java has StringReader - probably some clj analogue
13:19LOPPif I have a bunch of calculations that I'd like to start each in its own thread how would I do it?
13:20amalloyLOPP: pmap or manage futures yourself
13:20LOPP,(doc pmap)
13:20clojurebot"([f coll] [f coll & colls]); Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless requir...
13:21kriyative@bhenry: do you mean something like: with-in-str?
13:21bhenry,(doc with-in-str)
13:21clojurebot"([s & body]); Evaluates body in a context in which *in* is bound to a fresh StringReader initialized with the string s."
13:23alpheus,(doc with-out-str)
13:23clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
13:23bhenrykriyative: i'm not sure. i'm using line-seq on a file and want to know if i can use a string and pretend it's a file in my tests
13:24amalloybhenry: you should be able to
13:24kriyative@bhenry: yes, you can use (with-in-str "some string" (line-seq *in*))
13:24bhenryah cool.
13:25kriyative@bhenry: also look at with-open, if you don't want *in* to get rebound
13:32LOPPwhat's that string replace function again
13:32LOPPre-something I think
13:32chouserclojure.string/replace
13:41LLLLOI tried (ns myproj.wiki
13:42LLLLO(:require (clojure.string replace)))
13:42LLLLOdoesn't work :(
13:43LLLLOalso when I say "lein swank" in project folder, it doesn't actually load anything into repl instance, why's that
13:48nishant,1
13:48clojurebot1
13:51fliebelIs there a clojure-contrib for use with clojure 1.3?
13:53cemerickalpha contribs have been released in conjunction with clojure alphas
13:55fliebelcemerick: Never mind, cake is completely flipping when I use it. I just wanted to see if it ran and if it ran faster.
13:56LLLLOI'm officially completely confused about build tools and namespaces
13:56LLLLOthis stuff never works like it should
13:56amalloyLLLLO: namespaces can be confusing
13:57cemerickLLLLO: build tools and namespaces have nothing to do with each other?
13:57amalloyrequire only loads the functions, it doesn't create shortcuts for getting at them
13:57LLLLOI have a leinigen project. I go to project folder, I run "lein swank". I run emacs, then I run slime-connect in it
13:57amalloyso after (:require (clojure.string replace)), you could (clojure.string/replace ...)
13:57LLLLOI go to one of my project namespaces and the symbols aren't there
13:58amalloyLLLLO: lein swank doesn't load any clj files. it just starts a server for emacs to load stuff into. C-c C-k will compile a file and load it into the running swank server
13:58LLLLOalso stuff like (:require (clojure.string replace)) doesn't even work for me
13:58LLLLOso basically I have to manually open and compile all my stuff in emacs?
13:58cemerickLLLLO: your environment is borked somehow
13:59amalloyLLLLO: yes it does, you're just using it wrong. instead of "it doesn't work", provide a snipped of something you think should work and doesn't
13:59technomancyLLLLO: if you want a namespace to be loaded when your repl or slime starts, set :repl-init-script in project.clj
13:59technomancyI think you need the latest swank snapshot for that
14:00LLLLO(ns ircbot.watch.wiki
14:00LLLLO (:require (clojure.string replace)))
14:00LLLLO
14:00LLLLOthis for instance
14:00lrenn(use 'ircbot.watch.wiki) right?
14:00cemerickreplace is a function, not a namespace
14:00LLLLOok
14:00cemerick(:require clojure.string)
14:01cemerickand then code can use (clojure.string/replace …)
14:01LLLLOwhat if I have multiple
14:01LLLLOrequires
14:01cemerick(:require clojure.string clojure.set clojure.contrib.graph), whatever
14:01amalloyor i seem to recall (:require (clojure core string set)) works
14:02LLLLOthanks it works now
14:02cemerickLLLLO: read (doc require)
14:02LLLLOwhen do I need to use quotation when naming namespaces?
14:02cemerickonly outside of an ns form
14:02cemericke.g. at the REPL
14:02LLLLOoh ok
14:03amalloycemerick: honestly the documentation on namespaces is really confusing. i've read (doc require) a lot of times, and i still have to look up the syntax every time; plus it doesn't mention the difference between [] and () in (:use) forms
14:03noidiis there a difference?
14:04cemerickamalloy: http://clojure.org/libs *shrug*
14:04noidiand if not, which form is preferred?
14:04noidiI've used vectors so far, as in (:use [clojure.string :only [replace]])
14:04cemericknoidi: parens define a prefix, brackets are an explicit libspec, allowing you to use :as, :only, :rename, etc
14:04LLLLOok
14:05LLLLOhere's a brain teaser
14:05noidicemerick, ok, thanks.
14:05amalloycemerick: okay, lovely. this page is much better than (doc require)
14:06LLLLOI have a string that's all lowercase. Instead of spaces I have _. It can also have ' or -. I'd like to have first letter of each word capitalized. Stuff after - or _ is a new word but not after '.
14:06noidiI used to hate the ns macro until I learned the most common invocations. before that I had to copy & paste snippets from other codebases and modify them :P
14:07LLLLOa_snake's_mumbo-jumbo -> A_Snake's_Mumbo-Jumbo
14:07noidithe error messages could be a lot better
14:07LLLLOlooking for an elegant way to do this
14:08fliebelHow can I concatenate multiple byte[] into one byte[]? Preferably avoiding boxing of all the bytes.
14:08cemerickfliebel: make-array and System/arraycopy
14:09fliebelcemerick: Thanks
14:10tonylLLLL0: what do you have so far?
14:10cemerickfliebel: j.io.SequenceInputStream is also handy if you need to concatenate some InputStreams(backed by byte[] if necessary), just FYI
14:10LLLLOnothing tbh. I'll probably write a java function that does this
14:10LLLLOa for loop and some if sentences
14:11amalloyLLLLO: you'll spend way too much time on it in either java or clojure. just use built-in tools like regexes
14:11amalloy&(string/replace "a-bc" #"([-_]\w)" #(.toUpperCase (first %)))
14:11sexpbotjava.lang.Exception: No such namespace: string
14:11amalloy&(clojure.string/replace "a-bc" #"([-_]\w)" #(.toUpperCase (first %)))
14:11sexpbot⟹ "a-Bc"
14:11LLLLOI see
14:13amalloyif you want to capitalize the beginning of the string too:
14:13amalloy&(clojure.string/replace "na-bc" #"(($|[-_])\w)" #(.toUpperCase (first %)))
14:13sexpbot⟹ "na-Bc"
14:13LLLLOI wasn't aware I can use replace like that
14:13amalloy&(clojure.string/replace "na-bc" #"((^|[-_])\w)" #(.toUpperCase (first %)))
14:13sexpbot⟹ "Na-Bc"
14:13amalloyString.replace takes regexes, and the clojure wrapper around that allows functions as replacements
14:14LLLLOso basically you get a vector into that function
14:14LLLLOof the match
14:14LLLLOand you can return what you want, which gets replaced for the match
14:14amalloyyeah. first element is the match, further elements are the capturing groups, if any
14:15LLLLOand what you return replaces whole match? or is there an option of specifying replacement for each group
14:15amalloy&(re-seq #"((^|[-_])\w)" "na-bc")
14:15sexpbot⟹ (["n" "n" ""] ["-b" "-b" "-"])
14:15LLLLObtw you can make non-capturing groups
14:15amalloyyou get passed that vector, and can do anything you want to it to create a string to replace into
14:15amalloyyeah i know
14:15LLLLO(?: )
14:17amalloybut when i don't care what's in any of the groups, marking them as non-capturing just clutters everything up
14:17LLLLOI hear it works faster
14:17amalloyyep
14:18amalloysexpbot: let me know if you're getting tired, i'll go easy
14:18LLLLOyou can probably remove the outermost parenthesis here without any consequence
14:18cemerickregexes seem like a tough way to handle this...
14:18amalloyyeah, i can
14:18amalloyi forgot it returns the whole match as well as the capturing groups
14:18LLLLOawesome stuff anyway
14:18amalloycemerick: you have something easier?
14:19LLLLOcemerick: do you have a good idea?
14:20cemerickwell, regexes will *work*, but you're drifting into read-only territory
14:20cemerickone sec
14:21amalloyit's true that it's easy to abuse regexes. i'm guilty of that myself
14:21LLLLOwhat do you mean about drifting into read-only territory
14:22amalloyLLLLO: regexes are a lot easier to write than read
14:22LLLLOoh yes
14:22LLLLOI have a regex in my irc bot that recognizes questions
14:22LLLLOmessy stuff
14:23amalloyhm, speaking of which, is there a way to set modifiers in #"" forms, as in m/myregex/x?
14:25cemerickLLLLO: https://gist.github.com/0af84c12661344c75114
14:25cemerickprobably more verbose than necessary
14:25LLLLOaha
14:27cemerickupdated, better
14:27LLLLOthis partition-by use on strings is a neat trick
14:27LLLLOand using set as a function
14:27LLLLOvery nice
14:27LLLLOI never come up with stuff like that :D
14:27amalloyLLLLO: using set as a function is idiomatic
14:28amalloyyou get used to it
14:28LLLLOI know it's idiomatic
14:28LLLLObut I would probably make an anonymous fn that returns true or false if a delimiter
14:28LLLLOI usually think only of functions
14:29LLLLOsomehow using a datastructure as an active participant doesn't ever occur to me :)
14:30cemerickupdated again -- didn't need the second delim check because uppercasing both - and _ is a no-op :-)
14:30amalloy&(filter (comp #{"bar"} :foo) [{:foo 10} {:bleh "bar"} {:foo "bar"}])
14:30sexpbot⟹ ({:foo "bar"})
14:30amalloyLLLLO: you can compose them just like functions too
14:31amalloyget all maps whose :foo key maps to "bar"
14:31LLLLOI know :) but there is a difference between knowing and routinely thinking in these terms and incorporating something in your own designs
14:31amalloyyeah for sure
14:31amalloyexposure helps
14:31cemerickthere, that's probably as good as it's going to get: https://gist.github.com/0af84c12661344c75114
14:32LLLLOthese ->> macros also throw me a curveball :)
14:33amalloycemerick: (fn [[x & more]]) instead of #((first %)...(rest %))?
14:33hsuhdoing (apply + [1 2 3]) is the same than (+ 1 2 3); now what if i wanted + to receive 1 argument, [1 2 3] ?
14:33hsuh*that
14:33amalloyhsuh: (+ [1 2 3])...
14:33cemerickamalloy: sure, same thing; destructuring does come with a cost though, so I usually avoid it if I'm not actually using the let-bindings more than once.
14:33hsuhand the function isn't know at compile time..
14:34LLLLOyeah
14:34LLLLOyou can also ask yourself what's faster
14:34amalloy&(let [f rest] (f [1 2 3]))
14:34sexpbot⟹ (2 3)
14:34amalloyhsuh: ^^?
14:34LLLLOregex or splitting a string into a bunch of sublists then modifying non-mutable strings then recombining them
14:35amalloyLLLLO: probably the latter. regexes do the same work, they just hide it
14:35LLLLOit's a nice piece of code nevertheless
14:35LLLLOthey probably have fewer allocations
14:35amalloybut who cares which is faster, most of the time
14:36tonyl,(map + [1 2 3])
14:36clojurebot(1 2 3)
14:36amalloyheh
14:36amalloy&(map + [1 2 3] [4 5 6])
14:36sexpbot⟹ (5 7 9)
14:36LLLLOclojure really cranks it up with the memory alocation and garbage collection....your usual code creates 1000s of lists, sublist and fragments then recombines them by adding a single element each iteration resulting in boatloads of allocations more
14:36hsuhamalloy: hm, yeah i think that works :)
14:37amalloyLLLLO: it's true, but GC is optimized around the idea of lots of short-lived objects and a few long-lived ones
14:37amalloyand clojure's functional data structures can do a lot of pointer sharing, which limits the problem
14:38LLLLO:)
14:38LLLLOunrelated question
14:38LLLLOis it normal that in emacs pressing TAB does autocomplete just in REPL buffer but not in file buffer
14:39amalloyyes
14:39amalloyC-c TAB if you want it in the file buffer
14:39amalloyTAB alone is for indenting
14:40LLLLOthanks
14:43amalloyi'll rebind mine to C-TAB if i ever look up how to specify non-letter keys :P
14:48cemerickLLLLO, amalloy: FWIW, a version based on a regex is faster in some bad microbenchmarking, but not by a ton (35% diff here) *shrug* https://gist.github.com/0af84c12661344c75114
14:49cemerickThe biggest part of the overhead is the word split, uppercasing, and concat, not the original partition or re-seq
14:49cemerickanyway, back to work
14:50amalloycemerick: i'd use replace, not re-seq, but i agree the benchmark doesn't really matter
14:50amalloyclojurebot: dotimes?
14:50clojurebotExcuse me?
14:50amalloyclojurebot: benchmark?
14:50clojurebotExcuse me?
14:50amalloybah
14:50amalloyi'm sure he has something in there about how dotimes is not a benchmarking toolkit
14:52VinzentHello. What library for GAE (primarily for accessing it's datastore) you can recommend? There is so much similar libs so I am a little bit confused
14:57rata_amalloy: [(control tab)] IIRC
14:57LLLLOcemerick you could probably improve on uppercasing by typehinting
14:58cemerickLLLLO: that call is already hinted
14:58LLLLOhow?
14:58clojurebotwith style and grace
14:58cemerickThe ^Character hint?
14:58LLLLOdidn't see it in your first version
14:58fliebelHmmm, is there something like reductions for iterate?
14:59cemerickLLLLO: oh, well go to the latest version :-)
15:02fliebelOh well, I'll just use reduction. But… can I do a for loop with 2 seqs in parallel?
15:03mfexfliebel: can you give an example of what you want with reductions for iterate?
15:04LauJensenChousuke: Your suggesting is in the compiler now, sugared (where (either (= {:a 5}) (<= {:b 10}))) = "WHERE ((a = 5) OR (b <= 10))"
15:04LauJensensuggestion
15:04fliebelmfex: nvm
15:05fliebelmfex: (reductions #(+ %1 (count %2)) 0 seqs)
15:07fliebelBut what I need now is (doseq [x [1 2 3] y [4 5 6]]) to do 1,4; 2,5; 3,6
15:08mfexfliebel: (doseq [[a b] (map vector [1 2 3] [4 5 6])] (... a ... b...))
15:09chouserfliebel: currently, map is _the_way_ to walks seqs in step. map or loop/recur
15:09fliebelchouser: I think loop/recur might be less hacky in this case.
15:12amalloyfliebel: disagree
15:12Vinzenthttp://github.com/smartrevolution/clj-gae-datastore/ looks fine, but isn't it a bit outdated?
15:12rata_LLLLO, amalloy: also, if you use autocomplete, you can autocomplete in file buffers with tab
15:12fliebelamalloy: On second thought I disagree with myself as well.
15:13amalloyrata_: i started trying to install autocomplete a while ago, but got confused/frustrated and set it aside
15:16puredangerRich's hammock talk from the conj in "pencast": http://www.livescribe.com/cgi-bin/WebObjects/LDApp.woa/wa/MLSOverviewPage?sid=R4XrwCpdzj5m
15:16puredanger(not mine, just reposting)
15:16rata_amalloy: I download it from here http://cx4a.org/software/auto-complete/
15:17rata_and put this in .emacs: https://gist.github.com/661549
15:17tonylpuredanger: thanks!
15:18mfexfliebel: how about (reductions + (map count seqs)) instead of (reductions #(+ %1 (count %2)) 0 seqs)
15:19fliebelmefx: yea, good one :)
15:21amalloyrata_: nice, thanks. looks like it Just Works
15:21amalloythough i haven't figured out how to use it properly yet
15:38itistodaywhat's the difference between 'seq' and 'sequence'?
15:39MayDaniel,((juxt sequence seq) ())
15:39clojurebot[() nil]
15:39chouserseq never returns an empty collection. It returns an ISeq or nil.
15:40chouser...possibly forcing a step of a lazy seq in order to determine if it's empty or not
15:40itistodaychouser: thanks!
15:42rata_amalloy: welcome =)
15:57fliebelYay, an awesome array concatenation function: https://github.com/pepijndevos/Clomian/blob/master/src/clomian.clj#L101
15:58itistodaywhy can't i create a record called 'test'? it seems to conflict with clojure.core/test ... but what if the record is created in its own namespace?
15:59fliebelitistoday: core is always there I think. But I also think having a fn named test in your core is a bad move.
15:59chouseritistoday: that's fine, but you have to exclude test from being refered into your namespace
16:00itistodaychouser: ah, i see... using the 'ns' macro probably, thanks
16:00itistodayfliebel: this isn't going into any production code :-p
16:02fliebelitistoday: I was referring to Clojure. I make functions called test all the time, because it saves thinking about a function name. So this is accidental hacking complexity :(
16:02raekitistoday: (ns foo.bar (:refer-clojure :exclude (test)))
16:02raekfliebel: any luck with the gzipped streams?
16:03fliebelraek: yes and no. Reading just the files was quick, so I figured the lib was to blame but...
16:03itistodayfliebel: ah gotcha :-)
16:04itistodayraek: thanks!
16:04fliebelI made a function for concatenating java arrays to save memory, and then it seemed to run faster, so it might have been the casting and boxing that was causing trouble.
16:04raekI guess you code would benefit from the new goodies in 1.3
16:05fliebelraek: Now the bottleneck moved up to the freqs function.
16:06fliebelraek: cake flipped completely when I tried to get that. Can you give me the correct version number for core and contrib?
16:07fliebelI did 1.3.0-SNAPSHOT for core, and the same but with 1.2 for contrib, but I guess that was wrong :(
16:07raekthere is 1.3.0-alpha2
16:07raeksee http://build.clojure.org/releases/
16:08raekcontrib is now split into multiple jars
16:08raekbut there is a version containing everything
16:08raekfliebel: I made this once: https://gist.github.com/661631
16:09raekit is probably not as performant as you would like
16:09raeksince it uses lazy seqs
16:10fliebelraek: But what do I enter for contrib now?
16:10fliebeloh well, I'm not even using anything from contrib at the moment.
16:11defnhttp://tinyurl.com/38agqgm <--- a "Pencast" of Rich's talk "Step Away from the Computer"
16:11chouserdefn: I looked at that. Seems like a fun device.
16:12nickikdoes anybody know when the videos are releaved
16:12raekhrm, was it "complete" or "standalone"...
16:13fliebelraek: cake still goes crazy as soon as I start it.
16:13fliebelraek: standalone
16:13fliebelhttp://build.clojure.org/releases/org/clojure/contrib/standalone/
16:13defnyeah, it's interesting. i think they're marketing is off, though. they need to be focusing more on geeks, hacker conferences, etc.
16:14defn@chouser^
16:14defnthey're => their
16:15raekfliebel: I don't use cake, but maybe you have to restart its jvm
16:16fliebelraek: It seems there have been a few 1.3 fixes on github. I'm getting that now.
16:16raekdoes cake have separate jvm processes for cake stuff and user stuff, à la lein?
16:16itistodayis there a contrib thing for creating records with default values?
16:16fliebelraek: What will I gain from Clojure 1.3?
16:16raekitistoday: you usually make a factory function for that
16:17itistodayraek: ah ok
16:17itistodayjust wondering...
16:17itistodaythere's this interesting post: http://cemerick.com/2010/08/02/defrecord-slot-defaults/
16:17raekfliebel: the ability to use unboxed promitives across function boundaries
16:17nickik@itistoday look at defrecord2 on github
16:18nickikthey are like super records
16:18raekfliebel: http://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support
16:18itistodaynickik: thanks, i take it you're referring to: https://github.com/david-mcneil/defrecord2 ?
16:19raekI'll be away for a moment. bbl.
16:19fliebelraek: Looks like exactly the thing I need.
16:19nickikyes, but they do not support default values
16:22amalloyraek: yes, cake has two jvms
16:23amalloy(and they're used for cake-stuff vs user-stuff)
16:25raekfliebel: http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly
16:26raekthe article contains measurements of various methods for doing io in java
16:27raekthe gisted code uses "BufferedInputStream, 8k buffer, varying array read size" (as long as you pass it a BufferedInputStream)
16:28raekfliebel: hrm... do you know if the stream is buffered? if not, you should definitely try to wrap in one... (java.io.BufferedInputStream. the-stream)
16:31fliebelraek: I don't know. They're using some weird input streams over there.
16:35fliebelwtf, cake is giving ssl errors...
16:35raekif adding it has a large effect, they probably don't
16:36fliebelraek: I can't test untill I have cake running again :(
16:36tcepsaAre there any known issues with lein compile in Windows? I have a project that compiles fine in Linux, but throws a "Don't know how to create ISeq from: Clojure.lang.Symbol (with_ns.clj:1)" at the Windows command line
16:39tcepsaThough now that I look more closely, I see that I am using version 1.3.1 on Linux and--apparently--1.1.0 on Windows. I'll see whether upgrading helps.
16:41fliebelCan any cake expert tell me why I'm getting SSl errors for a build tool? Is cake trying to get something from Github, and failing because of their move to https?
16:41crowbar7Doesn't clojurebot do something with pastebin?
16:42crowbar7.pastebin
16:42hiredmanhttp://www.delicious.com/clojurebot/pastbin
16:43crowbar7thanks
16:44crowbar7So he saves links it looks like
16:44tcepsafliebel: I am no cake expert, but that seems reasonable; I'm having similar problems attempting to pull down the latest version of Leiningen with lein self-install
16:44arkhis it possible to build a string and pass it to #"" ?
16:45LLLLOdon't think so
16:45crowbar7not that's a cool feature
16:45LLLLOyou need to construct it using re-mather
16:45crowbar7s/not/now/
16:45sexpbot<crowbar7> now that's a cool feature
16:45LLLLOre-matcher
16:45fliebelarkh: … what LLLLO said
16:45chouserarkh: no, but you can use re-pattern
16:45crowbar7now that's really a cool feature
16:46arkhah - re-pattern; that's what I want
16:46fliebelarkh: ony with the function chouser said
16:46fliebelI'm to slow :(
16:49amalloyarkh: also (java.util.regex.Pattern. "some regex str"), which is what re-pattern does
16:50amalloy~source re-pattern
16:50tcepsaUpgrading to Leiningen 1.3.1 solved the issues I was having (which would not surprise me in the least if they were related to my using a more up-to-date format of project.clj...)
16:51amalloyor i guess it's Pattern.compile, not new Pattern
16:51fliebeltcepsa: I'm doing a git checkout of cake, so I think that would work without downloading stuff.
16:52amalloyfliebel: i don't see why. the git repo doesn't have the lib dependencies afaik
16:53tcepsafliebel: Don't git checkouts download things? Or does that only happen when you clone?
16:53fliebelamalloy: okay, so what now?
16:54arkhamalloy: thanks - I was looking at that, too : )
16:55amalloyfliebel: can you post a gist of the error message? a fresh checkout of cake works fine for me
16:56amalloyalso maybe ping ninjudd, lancepantz, and Raynes, who are the most likely to be able to help if you find a real problem
16:58fliebelamalloy: http://pastebin.com/eFrTtMZA
17:02fliebelHuh, I'm using lein now for a while but it seems my src dir isn't even on the cp...
17:04amalloyfliebel: sorry, ruby and cake aren't really my dept; i just fake my way through it
17:05lancepantzfliebel: yeah, github has been causing us some headaches
17:05lancepantzfliebel: we'll have a fix recently
17:05lancepantzs/recently/shortly/
17:05sexpbot<lancepantz> fliebel: we'll have a fix shortly
17:06amalloybut it looks like the "cake" script downloads the latest copy of cake.jar from https://github/blah if you don't already have it
17:06fliebellancepantz: I'll get back to using the gem and Clojure 1.2 :(
17:06ninjuddfliebel: we had to change the uri to https today because github added a redirect from http to https, but i tested and it seems to work even on a machine where i have nothing in ~/.ssh
17:07fliebelninjudd: Which means my ssh is seriously messed up?
17:08ninjuddfliebel: not sure. i'm going to create a brand new ssh key now on that machine and see if that causes it
17:08amalloyninjudd: actually, i'm having some trouble getting cake.jar too, now
17:09amalloyit gets maybe 85% through downloading it, hangs for a while, and gives up on "session expired"
17:09ninjuddif you are running from git, you need to pull
17:09amalloyi did
17:09ninjuddhmm
17:09amalloyright before i started testing fliebel's problem
17:09amalloyand it worked then
17:09ninjuddamalloy: would you classify your connection as fast or slow?
17:10amalloyninjudd: slowish broadband
17:10ninjuddi need a slow connection at work to test on ;)
17:11ninjuddamalloy: Raynes has had a similar problem, but he is on dialup. he was working on a way to mirror the file on his VPS, but i'm not sure how far he got
17:12fliebelraek: Whoa! Adding the buffered speeds it up quite a lot :)
17:12amalloyninjudd: i get ~300KB/s as a microbenchmark
17:13ninjuddamalloy: should be plenty fast. it the stop at 85% repeatable?
17:13amalloywell, it's happened twice so far. i'll give it another shot
17:13fliebelninjudd: Anything I can do to test my problem?
17:14amalloyninjudd: yes, it's still happening
17:14ninjuddfliebel: does 'wget https://github.com/ninjudd/cake-standalone/raw/master/jars/cake-0.5.4.jar' work for you?
17:14amalloygit show says i'm at commit 95e1a8ebfcf23514afa4adcee39ae652f8aab866, which is from nov 4
17:14fliebelninjudd: wget: command not found :D Should I try curl?
17:15amalloyninjudd: wget fails for me immediately, actually
17:15fliebelninjudd: curl works :)
17:15amalloyERROR: certificate common name `*.github.com' doesn't match requested host name `github.com'.
17:15ninjuddfliebel: yeah. curl -O
17:15fliebel-O??
17:15clojurebotClojure ranked #21 on 8/14/2009
17:16ninjuddfliebel: isn't that the option to save to a file?
17:16fliebelninjudd: I just watched weird chars pass by :)
17:16ninjuddshould i more cake-standalone to gitorious? ;)
17:16ninjuddfliebel: got it
17:17amalloyninjudd: if i tell wget to ignore bad certs, it gets to 84% and stops
17:17fliebelninjudd: Problem solved: Use system ruby instead of macports :D
17:17fliebelninjudd: But now I still don't have the 1.3 fixes, do I?
17:18amalloycurl downloads the whole thing successfully
17:19LauJensenFor those interested in ClojureQL I blogged a little about the recent changes: http://bestinclass.dk/index.clj/2010/11/clojureql--revolutions.html
17:20ninjuddhmm, gitorious says they will throttle you if you exceed 500MB per month
17:20amalloyninjudd: ouch, worse than the iphone/att data cap :)
17:21fliebelninjudd: How do I use cake with clojure 1.3? I have the git version, but that still downloads the standalone.
17:21amalloyfliebel: just list 1.3 as a dependency in project.clj?
17:21ninjuddfliebel: add [clojure "1.3.0-alpha2-SNAPSHOT"] to your :dependencies in project.clj
17:22fliebelamalloy: Hell breaks loose if I do that.
17:22amalloyfliebel: don't do that, then :)
17:22ninjuddfliebel: what kind of hell? that should work with master, it is broken with the current gem version though
17:23fliebelI'll try… but the master still downloads the standalone, so how is that different from the gem?
17:23ninjuddfliebel: your project can use a different version of clojure.
17:24ninjuddfliebel: the standalone is only used for deps, the cake code is still loaded from your git checkout
17:25fliebelyay, works so far :) At least no infinit stacktrace loop :)
17:27fliebelThanks all, I'm going to sleep now. UGT is having daylight saving time.
17:28fliebelThis is what my script is currently doing:
17:29fliebel"Elapsed time: 8608.225 msecs" reading files
17:29fliebel"Elapsed time: 132289.221 msecs" freqs <<< slow!
17:29fliebel"Elapsed time: 236.694 msecs" plotting
17:29fliebel"Elapsed time: 141319.784 msecs" total
17:29ninjuddfliebel, amalloy: i'm switching the uri back to http because that seems to work for me, and i think using https is causing more problems that http was
17:30fliebelninjudd: cool
17:33amalloyninjudd: hm. problem sorta solved
17:33ninjuddcool. sorta
17:35amalloyokay, all the way fixed. it wasn't fetching the latest copy of standalone after git pull
17:38vibrantis there an easy way to run some function after for example 60 seconds in clojure?
17:39amalloyvibrant: Thread/sleep
17:39tomswI'm trying to use clojure to interact with a server over a custom (and horrible) SOAP interface. Starting a session and logging in takes a long time, so ideally I'd like to keep the connection in one thread and send it requests from other threads. Is there a clojure-ish way of doing this?
17:39LauJensenvibrant: just type the function in the repl, wait 60 seconds, then hit enter
17:39amalloy&@(future (Thread/sleep 5000) 1)
17:39sexpbot⟹ 1
17:39clojurebotPardon?
17:39vibrantamalloy; what if i run it 100 times?
17:39vibrantit's not gonna pop up 100 threads?
17:39amalloyuse a threadpool
17:41amalloy&@(future (Thread/sleep 5000) 1)
17:42sexpbot⟹ 1
17:42amalloyclojurebot: who were you talking to a minute ago?
17:42clojurebotCool story bro.
17:42vibrantwell i guess it's better to make a priority queue and a thread checking it every second or so.
17:42vibrantany ready priority queue struct?
17:42vibrantdata type i mean
17:43amalloyvibrant: java has all these things - see java.util.concurrent.*
17:43vibrantk
17:58duncanmis it a known bug that i can't inspect-in-frame in slime?
17:59micahmartinI could use help understanding how var are bound to their namespace
17:59micahmartinhere's an example
17:59micahmartinuser=> (def my-ns (create-ns 'mine))
17:59micahmartin#'user/my-ns
17:59micahmartinuser=> (binding [*ns* my-ns] (def my-var 1))
18:00micahmartinYet if I use load-string ....
18:00micahmartinuser=> (binding [*ns* my-ns] (load-string "(def my-var 1)"))
18:00micahmartin#'mine/my-var
18:00amalloyduncanm: yeah, swank-clojure doesn't yet have all the features slime does
18:00micahmartinWhy without load-string, does the var get bound to the user ns?
18:03micahmartinrhickey: any idea?
18:06raekLauJensen: reading you blog post... so much DSL beauty!
18:06LauJensenraek: you like? :)
18:06raekLauJensen: but, should it really be "(take users 1)
18:06raek"?
18:07raekI was stunned when I looked at cgrand's slides from the conj
18:07LauJensenNot necessarily, got better ideas?
18:08raekwell, the argument order is the opposite of clojure.core/take
18:10LauJensenraek: Thats a minor detail, all my consumers should take the table as the first arg. I think I'll want to work take into select somehow though, giving it a representation in the data
18:11raekalso, does take and sort deref the table?
18:12LauJensenyea, they should return a resultset
18:12raekok, so (resolve 'take) does not yeld #'clojure.core/take...
18:13rickmodeLauJensen: with clojureql, the tables are are actually atoms/refs right? you're just overloading @ / deref for this similar persistent meaning?
18:13rickmodes/are are/are not
18:13LauJensenno, Im currently overriding a few functions, conj! disj! < > <= >= =
18:13raekI really like the idea of representing tables with a IDeref thing
18:13LauJensenrickmode: wrong, Im just overloading
18:14LauJensenNo need to add Clojures concurrency overhead to something which is already safe
18:14raekdisj! and conj! does not take the table as an argument?
18:14LauJensenraek: Sure they do, its their first arg, like I said, uniform interface
18:15rickmodeLauJensen: right. interesting. any thought about in-memory cache?
18:15raekLauJensen: in the first disj! and conj! examples, the table argument is missing
18:15LauJensenrickmode: Not yet
18:15LauJensenraek: good catch, thanks
18:16raekbtw, I agree that the "haystack" arg should be the first one
18:16amalloyso if you have a -> chain, with just one command where you need to thread at the end instead of the second position, it's pretty easy: (-> thing form1 (->> form2) ...formN)
18:16raek(perhaps with an exception of sequence functions)
18:16LauJensenfixed
18:17amalloybut i don't see a convenient way to do a ->> chain with one -> link
18:17rickmodeLauJenson: what if you want to chain operations within a single transaction?
18:17LauJensenamalloy: the trick is, typically -> is for things with lists and ->> for collections
18:17kotarakamalloy: you have to start with ->. (-> x (->> ....) the-->-link (->> more-->>-stuff ...))
18:17LauJensenrickmode: Next step is making the connections nest and adding a dbsync which covers several actions
18:18raek(->> thing form1 (#(-> % form2)) ...formN) ; a bit hackish
18:18kotarakamalloy: which is a sign, you shouldn't do that.
18:18LauJensenAnyway, Can't touch this, its Hammock Time
18:18LauJensenGood night all
18:18kotarakN8t
18:18rickmodeLauJensen: ya - both with one table and spanning tables.
18:21amalloykotarak: yeah, i haven't actually had a reason to do that yet
18:23neotykgood evening
18:24neotykRich Hickey @ Clojure-Conj [Audio] http://sustainablecode.tumblr.com/post/1472289527/rich-hickey-clojure-conj-audio
18:24neotykis it just me or there is no audio?
18:27raekI hear some audio
18:27raekfolloed the link to here http://www.livescribe.com/cgi-bin/WebObjects/LDApp.woa/wa/MLSOverviewPage?sid=R4XrwCpdzj5m
18:28raekis this the legendary "Hammock Time" talk? :)
18:28neotykit is supposed to be this one
18:29neotykstop hammock time
18:35jjido=
18:43duncanmis it a bad idea for the arithmatic operators to be generic functions?
18:43pppaulwould someone be able to help me with a simple classpath problem? (trying to get contrib to work, i followed a tutorial and it did work for a second, but now is broken)
18:45pppaulanyone?
18:45clojurebotPlease do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
18:45amalloylol, good work clojurebot
18:46amalloyseriously though pppaul, paste an error message or something. don't make people say "sure i'll help" to find out what your problem is
18:47pppauluser=> (System/getProperty "java.class.path")
18:47pppaul"/home/paul/.clojure/clojure.jar:/home/paul/.clojure/clojure-contrib.jar"
18:47pppauluser=> (clojure.contrib.math/round 1000/3)
18:47pppauljava.lang.ClassNotFoundException: clojure.contrib.math (NO_SOURCE_FILE:0)
18:47amalloy(require 'clojure.contrib.math)?
18:47pppauli did use that (based on the info on the math API site)
18:48pppauluser=> (require 'clojure.contrib.math)
18:48pppaulnil
18:48pppauluser=> (abs 4)
18:48pppauljava.lang.Exception: Unable to resolve symbol: abs in this context (NO_SOURCE_FILE:3)
18:48pppaulok, i think i understand what my problem is
18:48amalloypppaul: require doesn't provide "shortcut" banes
18:49amalloyuse (use) instead if you want to refer to them without a namespace
18:49pppauldo i always have to switch the (ns) for shortcuts?
18:49amalloy(use 'clojure.contrib.math)
18:49pppaulthank you
18:50amalloygetting absolute values now?
18:50pppaulyes
18:50amalloyclojurebot: another satisfied customer
18:50clojurebotIt's greek to me.
18:51raekpppaul: all the ns clauses do is to call the corresponding functions
18:51arohnerok, stupid question. What is the proper lein declaration to get the newest clojure contrib 1.3?
18:52pppaulthanks. i'll look up the NS functions.
18:52arohnerI have [org.clojure.contrib/clojure-contrib "1.3.0-SNAPSHOT"] , which downloads a few poms, and then I get the 'unable to resolve artifact', missing org.clojure.contrib:clojure-contrib:jar:1.3.0-SNAPSHOT
18:52raekit has been split into multiple modules (a big jar of all the modules is available though)
18:52arohnerraek: I'm aware it's been split up. My understanding was depending on what I have above would pull in all the little jars as dependencies. Is that incorrect?
18:53arohnerand I see that pom in build.clojure.org, but no jar with the same name
18:53raekwell, I think [org.clojure.contrib/complete "1.3.0-SNAPSHOT"] does what you describes
18:53raekbut I haven't used the new system very much
18:54arohnerraek: aha. thanks. d/ling complete now, we'll see what it has
18:55raekI think 'complete' depends on all the others, so you end up with all the module jars
18:56raekI don't remember if there is something like 'complete' but with just one jar
18:59arohnerraek: looks like complete is empty, just depends on the others, lein pulled down a bunch of jars. thanks.
19:49clizzinIs there any way to easily do a case-insensitive match for keyword keys in a map? Due to some annoying data inconsistencies, I have keywords in one map that are all lowercase and keywords in another map with some uppercase letters in them.
19:53raekclizzin: you can preprocess the map with (defn lowercase-keys [m] (zipmap (map #(-> % name .toLowerCase keyword) (keys m)) (vals m)))
19:55clizzinraek: Let's say the keys in question are actually within a nested map, i.e. {:blah {:case "foo"}} and {:blah {:cAsE "bar"}}. Is there an easy way to apply the lowercase-keys? Some of the values in the outer maps may not be maps.
19:57raeki guess you could do something like (zipmap (keys outer) (for [v (vals outer)] (if (map? v) (lowercase-keys v) v)))
19:57raekbut why not add the lowercase code to the thing that generates the keywords in the first place?
19:58bhenry^^ that's what i'd do
19:58clizzinwe'll do that on the next run of the data, but it's a very big job and we want to do some analysis before we kick off another run
19:58clizzinotherwise, yeah, that would be nice. =/
21:08tufflaxHow does lazy-seq work to prevent stack overflows when dealing with recursively defined sequences? It's all a little magical to me. Is is somehow related to closures? I mean, the function used to generate the next element when one needs it, is that a kind of closure?
21:09tufflaxIs it*
21:10amalloytufflax: yes, it is
21:11amalloyeach element in a lazy seq is a pair: value, function-to-generate-next-pair
21:12amalloy(probably not exactly true, but close enough to be useful conceptually)
21:15tufflaxAnd when the function-to-generate-next-pair is executed, what is put on the stack? The call to that function, with references to data that is not on the stack? And the next function-to-generate-next-pair is stored together with the seq that's not on the stack? Or something...? :P
21:16amalloy&(macroexpand '(fn f [x] (lazy-seq (cons x (f (inc x))))))
21:16sexpbot⟹ (fn* f ([x] (new clojure.lang.LazySeq (fn* [] (cons x (f (inc x)))))))
21:17amalloyso really f just returns a LazySeq object, without recurring
21:18tufflaxYeah ok, thank you. I think I'm starting to understand.
21:18amalloywhen you walk a lazy seq, clojure calls the function. that function returns immediately; then it gets the value out and calls the next function
21:19tufflaxI see.
21:20amalloyso it doesn't build up the stack at all
21:23tufflaxWhen I was looking for answers to my questions, I came across this http://codemeself.blogspot.com/2010/06/clojurecorelazy-seq-makes-sense.html He uses lazy-seq twice in his function (look at the end of the post) but that is unnecessary, right?
21:26amalloyi don't think so, because my example was recursive, and his isn't
21:27amalloyie, i have an infinite number of calls to lazy-seq; he only has two
21:28amalloy&(lazy-seq [])
21:28sexpbot⟹ ()
21:28amalloy&(lazy-seq (lazy-seq []))
21:28sexpbot⟹ ()
21:28amalloybut i don't actually know; i don't build raw lazy-seqs very often
21:29tufflaxYeah I tried his code, it didn't work without both calls.
21:29amalloy&(cons 1 (lazy-seq ()))
21:29sexpbot⟹ (1)
21:35amalloyanyway, it's definitely good to know how lazy-seq works under the hood, but knowing exactly how to use it is probably unnecessary for quite a while. just combine the built-in lazy functions and let them do the work for you
21:36tufflaxOk :)
21:36TheBusbyer, what's the easy way to sort a map by it's values?
21:36tufflaxThanks again
21:39amalloyTheBusby: don't do that :)
21:39TheBusbyuh oh, is there a better way to find the most frequent elements among multiple sets then?
21:40amalloyso you have N sets like #{1 3} #{1 5}, and want to find out that 1 is more common than 5?
21:41TheBusbycorrect, I want to find most common elements
21:41TheBusbyhopefully end up with something like [[ 2] [3 1] [5 1]]
21:42TheBusbysorry, that should have read [[1 2] [3 1] [5 1]]
21:43amalloy&(frequencies (concat #{1 3} #{1 5}))
21:43sexpbot⟹ {1 2, 3 1, 5 1}
21:43amalloyand you want that sorted by value?
21:43TheBusbycorrect
21:44TheBusbyI'll likely be dealing with 10,000+ maps, each containing 2000-5000 values...
21:44amalloy&(sort (comp < val) (frequencies (concat #{1 3} #{1 5})))
21:44sexpbotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$val
21:46amalloy&(sort (fn [[k1 v1] [k2 v2]] (< v1 v2)) (frequencies (concat #{1 3} #{1 5})))
21:46sexpbot⟹ ([3 1] [5 1] [1 2])
21:46amalloy&(sort (fn [[k1 v1] [k2 v2]] (> v1 v2)) (frequencies (concat #{1 3} #{1 5})))
21:46sexpbot⟹ ([1 2] [3 1] [5 1])
21:46bhenryis there a way to sort on keys?
21:47amalloy&(doc sorted-map-by)
21:47sexpbot⟹ "([comparator & keyvals]); keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator."
21:47kzarHow do you know which different versions of packages there are when writing your project.clj?
21:48tufflaxHm, I briefly tried to learn common lisp before clojure, and in CL they have :key directives (or whatever they call them) to functions like max, sort, map, etc. Why doesn't clojure have that? I noticed clojure have sort-by for example, but no map-by. :P
21:49amalloy&(doc sort)
21:49sexpbot⟹ "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
21:49amalloytufflax: just pass in a comparator
21:49tufflaxits much easier with a key function
21:49tufflax&(doc sort-by)
21:49sexpbot⟹ "([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
21:50amalloytufflax: sort-by does something different
21:50amalloyit applies some function to each element of the seq and then compares the result
21:51tufflaxHm, not that different, or what do you mean?
21:51tufflaxYes, thats exactly what its for
21:51tufflaxInstead of (sort #(compare (val %1) (val %2)) coll) it becomes (sort-by val coll)
21:51tufflaxSo, "just pass in a comparator" is not as elegant
21:51amalloyoh, yes. i see what you mean
21:51amalloythat's much nicer
21:52tufflaxCL has that for everything
21:52tufflaxI think...
21:52tufflaxeven map
21:52TheBusbyahh, that's exactly what I was looking for
21:52tufflax:)
21:53TheBusby tufflax, amalloy; thank you both.
21:54amalloytufflax: clojure *has* keyword arguments, but stylistically they're not as prevalent as in CL
21:55tufflaxYeah I know it has keyword arguments, it's just that it would be nice with a :key argument for sort, max, car, filter, etc.
21:55tufflaxWhy not have :key for sort, instead of sort-by?
21:55amalloy*shrug*
21:55tufflaxmap, not car*
21:58amalloywhy have a function with ten modes instead of ten functions?
21:58tufflaxBecause you one have to remember one function name :P
21:59amalloyand ten keyword arguments
21:59tufflaxbut the keyword arguments are the same for all functions
21:59amalloyat least the compiler can help you with autocompletion of function names - it's a lot harder for it to tell you what keyword arguments it will accept
22:01tufflaxYeah, I guess, but it just feels nice to know that :key is always there for you should you need it
22:01tufflaxThere doesn't seem to be a map-by for example
22:01tufflaxI guess one could make his own
22:02amalloytufflax: i only have a little experience with CL. what would you want map-by to do?
22:03tufflaxjust apply (key element) to every element before the regular map function
22:03hiredmanerm
22:03amalloyuse comp
22:03tufflaxhm?
22:03amalloy&(map (comp inc :foo) [{:foo 10, :bar 1} {:foo 1}])
22:03sexpbot⟹ (11 2)
22:04tufflaxah oh yes
22:04tufflaxThat's true
22:04powr-tocHey... Is there any reason why (fn? :foo) ; => false ?
22:04qbg,(ifn? :foo)
22:04clojurebottrue
22:05amalloy&(ifn? :foo)
22:05sexpbot⟹ true
22:05powr-tocahh cool
22:05powr-tocwhy have the distinction?
22:05amalloythings that are callable, vs things that were defined with (fn)
22:05qbg:foo can be used as a function, but isn't actually a function
22:05powr-tocI mean why is it useful to know, whether fn created it?
22:05amalloyi dunno why, but why not
22:06tufflaxwhat qbg said, you can just call :foo like (:foo)
22:06tufflaxor, maybe that doesn't make sense
22:06tufflaxforget what i said
22:06tufflax:)
22:07powr-tochmm... ok, I suppose it allows you to nest vectors, keywords and maps, whilst using a predicate function to find function values within them (that aren't the containers themselves)
22:07powr-tockinda elegant in that case
22:09powr-toctufflax: :keywords are functions that will look themselves up in maps e.g. (:foo {:foo "bar"})
22:09tufflaxyeah i know, i dunno what i was talking about
22:09powr-toclikewise maps are functions of their values, and vectors are functions of their indicies
22:14hiredmanifn? was split from fn? when trampoline was added
22:15powr-tocdoes that make it easier to spot the thunk?
22:15thunkno
22:15powr-toclol
22:15powr-tocthe irony, I didn't spot 'the thunk'
22:16thunkthe arity!
22:18powr-tocI'm hoping the thunks got nil puns left
22:18thunkWho da thunk?
22:19qbgpowr-toc: I think the thunk is just delaying the next one
22:20powr-tocqbg: well for heavens sake don't force him
22:20thunkHey guys, no arguments.
22:21amalloyoh my god. i'm dying. this is terrible
22:21qbgWell, that is not promise
22:21qbg*no
22:30arohneris anyone using slime with clojure-1.3 successfully?
22:30arohnerI'm not getting the stacktrace window when I compile and encounter a stacktrace
22:45pppaulzzz
22:45amalloypppaul: boring is better than the pun attack we were having earlier
22:46pppauljust testing out my IRC colors.... didn't know what to type :P i think my client is a bit poor, can't tell what i'm changing with respect to the colors
22:46pppaulcan't see my own text anymore
22:48tufflaxthe pun attack was awesome :P
22:49amalloypppaul: you could do it in #test or something
22:50amalloynot that i especially care, but there are channels for just that purpose
22:52pppaulso, did someone post the pun attack somewhere?
22:52amalloypppaul: it'll be on n01se if it's not already
22:53amalloyyeh, http://clojure-log.n01se.net/date/2010-11-03.html
22:55pppauli found it
22:55pppaulseems noisy
22:55amalloy*eyeroll*
23:01pppaulwhat do you guys think of the clojure euler puzzles?
23:41hiredmanas long as it's quiet in hear, I'm going to restart clojurebot with some features that are rather loud the first time they run
23:41hiredmanhere
23:48itistoday how can i get this sequence to not end in nil? just have the last object be the last object? http://paste.pocoo.org/show/285831/
23:49itistodayand is there a function to check if a value exists in a sequence (and return true immediately if it does)?
23:52amalloy&(some #{4} (range 1))
23:52sexpbot⟹ nil
23:52amalloy&(some #{4} (range 10))
23:52sexpbot⟹ 4
23:53amalloyitistoday: see (iterate) and (take-while) - they should be a cleaner way to do what you want
23:54amalloy&(let [x {:p {:p {:p nil}}}] (take-while identity (iterate :p x)))
23:54sexpbot⟹ ({:p {:p {:p nil}}} {:p {:p nil}} {:p nil})
23:55itistodayamalloy: that's really elegant, thanks!
23:56amalloyitistoday: that gets you what you wanted, right?
23:57itistodayamalloy: yup, that seems to be exactly what i want, and it's much shorter and way more elegant
23:58itistodayi'm a n00b to clojure though so i'm not familiar yet with all of its functions... which is why i was toying with the primitive lazy-seq
23:58amalloysure