#clojure logs

2011-02-23

00:00SgeoErm, (recur)
00:00amalloySgeo: yes, given your substitution there :P
00:01amalloybut uhm, wouldn't it be easier to just try it? ##(#(if (zero? %) "done!" (recur (dec %)))) 5)
00:01sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: sandbox6385$eval8665$fn
00:01amalloyfeh. matching parens in irc is apparently too hard for me
00:02amalloy(#(if (zero? %) "done!" (recur (dec %))) 5)
00:10SgeoHow often is partial used with -> ?
00:18Sgeo"If a pure function mutates some local data in order to produce an immutable return value, is that ok?
00:18Sgeo"
00:18SgeoSounds ST monadish
00:18SgeoAlthough maybe this is different
00:29tibbeWas there ever a discussion about the pros/cons of providing O(1) size() for maps? i.e. it costs a little bit of performance to do so.
00:32amalloytibbe: i'm not even sure that's the case, since maps have to track their size in order to decide when to repartition the hash bucket
00:32amalloy(for persistent hashes this is probably still true, though quite possibly the details are different)
00:33tibbeI was thinking of PersistentHashMap in particular
00:33amalloytibbe: link me to the source?
00:33tibbeamalloy: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java
00:34tibbeamalloy: the PHM stores the count next to the root node
00:34tibbeamalloy: functions that might modify the size return an indicator up the call chain to indicate if they have done so (so the count can be updated)
00:35amalloyfair enough
00:36amalloyi wouldn't be surprised if O(1) size was provided to mirror java's Map interface, which is often used with the assumption that size is O(1)
00:36tibbeamalloy: right
00:37amalloyand it doesn't seem to cost much performance
00:37amalloyi guess i'm just speculating, and it sounds like you've done all the interesting speculation already :)
00:38tibbeamalloy: The reason I'm asking is that I tried to add it to my Haskell implementation and it costs about 3% for lookups and 6% for inserts/deletes
00:38tibbeamalloy: and I'm trying to figure out if it's worth it
00:39tibbealso adds a bit of code complexity
00:39amalloytibbe: have you looked at chouser's finger trees? an interesting example of a tree structure that needs to track size in order to be useful
00:40tibbeamalloy: no, but we do have finger trees in Haskell that does that
00:40amalloyyes, i suppose we did rather steal the idea
00:40tibbeamalloy: size balanced trees use it too
00:40tibbeso in those cases you get O(1) size for free
00:41tibbeamalloy: we call it borrowing among friends :)
00:41amalloyeither way i don't plan to give it back
00:42tibbeamalloy: heh
00:44SgeoIn order to make a thread, do I have to deal with Java?
00:57amalloy&@(future (Thread/sleep 3000) (println "no"))
00:57sexpbot⟹ nil
00:57amalloy&@(future (Thread/sleep 2000) "no")
00:57sexpbot⟹ "no"
00:57Sgeo__What's the &@?
00:58amalloy & gets sexpbot involved
00:58amalloy@ derefs the future object
00:58Sgeo__&(#(if (zero? %) "done!" (recur (dec %))) 5)
00:58sexpbot⟹ "done!"
00:58Sgeo__What's with that thing at the beginning?
00:58amalloythe arrow?
00:59Sgeo__It doesn't show up for me :(
01:00amalloyuse a font with unicode support :P
01:00amalloyor in your unicode-supporting repl, try (char 0x27e9)
01:11Sgeo__I suppose there's nothing in Clojure that's quite like .NET's event framework? Does the JVM have an equivalent?
01:14amalloyer, there's swing/awt
01:16Sgeo__How does one hook into a Swing/AWT event, and can I do a similar thing for custom events in my own application?
01:19amalloyi think you *can* do something similar, but (a) it's afaik rare and i haven't done it in a long time, and (b) in a functional language like clojure it's pretty easy to roll your own, or find a clojure library that does this already
01:27amalloyif .net excites you, you can see how clojureclr is coming along
01:35Sgeo__Just thinking about it loosely, not too carefully, but I think the trickiest part is automatically wrapping what needs to be wrapped while still allowing it to be TCO'd... I ... hm
01:52polypusanybody know how to override a static method with gen-class?
02:00sattvikpolypus: It's impossible. Static methods belong to a class and cannot be inherited.
02:08Sgeo__http://groups.google.com/group/clojure/msg/2ad59d1c4bb165ff are Clojure's agents basically actors?
02:13polypussattvik: ty
02:17Sgeo__IIRC, Scala has some weird issue where private static methods can't be called by instances of the class, iirc
02:17Sgeo__Can I assume Clojure doesn't have that issue? (It wouldn't make sense for it to, I guess)
02:39Sgeo__All these random tools for Clojure due to it being JVM. Ant and a Java IDE etc. etc.
02:39Sgeo__It's a lot considering that I just want a language to toy around with
02:53scottjyou don't have to use any of that if you don't want to
02:58SgeoAren't null values generally considered nasty in functional languages?
02:59raekSgeo: I don't think you can generate non-public methods from clojure. (after all, gen-class is intended to be used when you need to make clojure callable from java, so it's not something you use very often)
02:59raek(there are simpler ways of doing interop too)
03:00scottjSgeo: probably but it's part of java
03:16stirfooSgeo: there is a video where Hickey (the author of clojure) explains the coping mechinism he employed trying to implement common lisp's t and nil, and scheme's #t and #f and how this mapped to Java.
03:17stirfooIt's an interesting discussion, but I can't remember the exact video.
03:54__name__good morning
04:07fliebel__name__: morning
05:25fliebelHm, if ClojureCLR would work on Mono, one could run it one MonoTouch, I imagine.
06:18clgvfliebel: doesn't it work on Mono? I guess there is a decent probability that it will
06:25fliebelclgv: I tried… It has a weird dependency, and doesn;t compile.
06:25clgvfliebel: can you AOT compile a clojure project on MS .NET? then you could take the binary and execute it on mono
06:26clgvthat might work even if you dont get the development environment running under Mono
06:26clgvprovided you ship all needed .Net assemblies
06:26fliebelclgv: Do you happen to have one laying around? I don;t feel like dusting of some windows box right now.
06:27clgvnot here. but at home
06:27clgvbut I didnt try ClojureCLR at all, yet
06:28fliebelWho maintains ClojureCLR?
06:28clgvit's one entry on my list "Nice to try in future" ;)
06:29fliebeloh, ther is a binary distribution!
06:29clgvthat could work ;)
06:30clgvthe question is what language features are used. if it is only .NET 2.0 or 3.0, I guess Mono can handle it
06:30fliebelonce MacPorts has finished doing its thing, I'll install Mono, and give it a try.
06:31fliebelThere's a 4.0 and a 3.5 distribution
06:34fliebelHow do I def a dynamic var?
06:34clgvin C#?
06:35fliebelno, Clojure
06:35fliebel1.3
06:35clgvno idea, I am still in the past 1.2 ;)
06:35Chousukewasn't it (def ^:dynamic foo)?
06:35fliebelcould well be :)
06:36ChousukeI guess that should be *foo* :P
06:53zoldarwhat is the way to stop aleph server without restarting the whole repl?
06:54fliebelWhat is a good way to make a bunch of functions that can use another variable function? Should I pass the function around? (verbose) Do some binding trick? (hacky) Something else?
06:54fliebelzoldar: I think Aleph returns a function when you start it, calling that stops it again.
06:54zoldarfliebel, thanks!
06:56fliebelHm, binding doesn't even work… Any ideas how to do this in a clean way?
06:57zoldarfliebel, what do you mean by a variable function ?
06:57fliebelwell, it can be a different function sometimes.
06:57fliebelso I have funcion x calling, y, but sometimes i want it to use z instead.
06:59Chousukepassing it around would probably be the most "functional" solution but you can use an atom too.
07:00fliebelChousuke: Why an atom? I was hoping that binding a var would work, but it doesn't.
07:00Chousukehm
07:01Chousukebinding should work, as long as the var is dynamic.
07:01Chousukeyou have several options, each having different properties :)
07:01fliebelI'm doing (binding [y z] (x)) and it happily goes on to use y.
07:02Chousukeis y a dynamic var?
07:02fliebelyea
07:02Chousukethen I dunno, maybe x needs to be one too :/
07:02ChousukeI'm not quite up to date on 1.3
07:05fliebelI think it's because x is defined outside of binding.
07:05raekhave you tried recompiling x after you made y dynamic?
07:06raekI think the call is compiled in a different way if the var is dynamic
07:07fliebelraek: What do you mean 'recompiling'?
07:07fliebelexample: https://gist.github.com/840338
07:07raekrevaluating the defn form
07:09raekfliebel: https://gist.github.com/840340
07:09fliebelraek: this is really creapy… https://gist.github.com/840338
07:10raekhrm
07:11raekyes, a function call seems to compile to different byte code when the var is dynamic
07:13fliebel… I don't get it. The definitions of c where the same.
07:13fliebel*x
07:13fliebelOnly difference is htat one was defined before the binding call
07:13raekfliebel: did you evaluate this exactly in the order of the gist?
07:14fliebelI think so, but I'll try again.
07:14Chousukefliebel: can you reproduce that with a clean repl?
07:14Chousukefliebel: it could always be a bug. :)
07:17fliebelCan't reproduce...
07:18raekI think you did something like (defn y ...) (defn x ...) (defn ^{:dynamic true} y ...)
07:18fliebelyea..
07:18raekat least that would explain it. otherwise, this is a creepy bug.
07:19fliebelNo, I did define it non-dynamic first.
07:19fliebel1But then dynamic, and *then* did a binding
07:19Chousukeyeah, you need to define all functions using y after you've defined y dynamic
07:20fliebel1right
07:20Chousukeotherwise you'll get weird behaviour
07:20raekhrm. maybe this means that (declare *foo*) (defn bar ... (*foo* ...) ...) (defn *foo* ...) won't work either
07:21fliebel1this is reproducable: https://gist.github.com/840338
07:22fliebel1raek: Can't you make dynamic declarations?
07:22raekhrm. maybe (declare ^:dynamic *foo*) would work...
07:24fliebel1But still, this is not what I'm doing in my real code, and it exhibits the same behavior.
07:26Chousukefliebel1: that test case is expected behaviour I think
07:26fliebel1I do (def ^:dynamic *full-adder-o* (addfn 2)), and then define a few functions using that.
07:27Cozey,({12 :foo} (Short/parseShort "12"))
07:27clojurebotnil
07:27CozeyIs this expected? I just spent an hour stalking this behaviour
07:27fliebel1Cozey: That would work in 1.4, but not 1.2
07:27fliebel11.3
07:27Cozeyis 1.3 stable?
07:28fliebel1no
07:28Cozeymhm
07:28fliebel1well, not by name. It runs stable for me :)
07:29CozeyI wonder if I should just do conversions to Integer, or switch to 1.3, since there might be more surprises like this
07:29fliebel1raek, Chousuke: My real code manages to keep using the old value even with #'*full-adder-o*
07:30raekfliebel1: and you have reevaluated all defns that use the dynamic var?
07:30raek,({12 :foo} (int (Short/parseShort "12")))
07:30clojurebot:foo
07:30fliebel1raek: I have never defined them using a static var ;)
07:30raekok, then that's strange
07:31zoldarI'm trying to setup a simple websocket echo server using aleph. First "registration" goes fine, but server doesn't broadcast any messages that go after it (checked with wireshark). What am I doing wrong? http://paste.lisp.org/display/119913
07:31fliebel1or.. maybe cake kept them around secretly...
07:31fliebel1no :(
07:32Chousukehow about laziness?
07:32Chousukeyou're not binding around a map call or anything?
07:33fliebel1Chousuke: No… but… let me see :s
07:34fliebel1yea, laziness. I hadn't even realized (logo.minikanren/)run was lazy
07:45tscheiblhi there
07:46AWizzArd_Hallo tscheibl.
07:47octehow do those with-transaction or with-connection macros/function work?
07:50ejacksonacto: they call (.close x) in a finally block
07:50octei mean, how do they keep a connection in some kind of context that all the function calls inside have access to?
07:54rata_octe: a binding block?
07:57octehmm
07:57octei guess i should look at the code :)
07:58ejacksonocte: yeah I always figured it was a dynamic var
07:59octeit creates a *db* binding it seems
08:00octewhich is thread-local, right?
08:00ejacksonyp
08:02octehmm, i want to transform a list with this structure: [{:name "foo" :value "bar" :group "grp1"} {:name "foo" :value "bar2" :group "grp2"} {:name "baz" :value "boo" :group "grp1"}] into something like -> {:grp1 {:foo "bar" :baz "boo"} :grp2 {:foo "bar2"}}
08:03octeany pointers?
08:03raeksounds like a job for reduce
08:04raek(reduce function-explained-later {} the-list)
08:05raek(defn function-explained-later [acc {:keys [name value group]}] (update-in acc [group] (assoc name value)))
08:06octeah, yes
08:06octethanks
08:06raek,(reduce (fn [acc {:keys [name value group]}] (update-in acc [group] assoc name value)) {} [{:name "foo" :value "bar" :group "grp1"} {:name "foo" :value "bar2" :group "grp2"} {:name "baz" :value "boo" :group "grp1"}])
08:06clojurebot{"grp2" {"foo" "bar2"}, "grp1" {"baz" "boo", "foo" "bar"}}
08:07raekocte: the parens around assoc in my first example should be removed
08:07raekyou can call (keyword name) on the name too
08:08tscheibl,
08:08clojurebotEOF while reading
08:08tscheibl,(doseq [x [[:js :text/javascript] [:css :text/css] [:xhtml :application/xhtml+xml]]] (intern *ns* (symbol (as-str "wrap-" (x 0))) (fn [handler] (wrap-content-type handler (x 1)))))
08:08clojurebotDENIED
08:08tscheiblis this bad?.. i mean .. it works
08:09Chousukelooks like you should use a macro instead.
08:09tscheiblit autogenerates the functions wrap-js wrap-css and wrap-xhtml
08:10Chousukeyeah. macros are generally better for that
08:10rata_tscheibl: yes, a macro seems better suited for that, as all the information you need is available at compile time
08:10tscheiblhmm ok.. i will try
08:10raek(defmacro defmime [name type] `(defn ~(symbol (str "wrap-" name)) [handler#] (wrap-content-type handler# ~type)))
08:11tscheiblok...
08:11raekand then (defmime js :text/javascript) (defmime css :text/css) (defmime xhtml :application/xhtml+xml)
08:12raektscheibl: istead of x, (x 0) and (x 1) in the code, you can write [name type], name and type
08:13tscheiblyeah.. looks more concise
08:14tscheiblthx
08:17xkbhi
08:18xkbI'm working on a tank game, based on the ants simulation. I'd like to know if there is a way to start an agent from within another agent?
08:18xkbI'd like to model the bullets the tank fires as an agent
08:20Chousukesounds like you'd end up with lots of agents :/
08:21xkbtrue
08:21ChousukeHow about a global "bullets" data structure (in a ref) instead and just have the tank agent add to it, then periodically run a function to update the bullet positions.
08:22xkbso the tank agent would encapsulate "the grid" + a list of bullets?
08:22Chousukenah, the tank agent can be separate from the bullet ref
08:23Chousukeafter all, the tank has nothing to do with the bullet after it's been fired
08:23xkbah because the list of bullets is global
08:23xkba tank now is (agent [x y])
08:23xkband [x y] may contain a tankrecord
08:23xkbwith direction, barrel direction etc
08:23CozeyWhat's a better idea: use keywords or strings for session keys in Compojure?
08:24Chousukeof course the bullet may need to know the tank it came from, for scoring
08:24Chousukebut that's about it
08:24xkbChousuke: interesting idea
08:24tscheibl@raek and what about this, to get rid of the redundant defmimewrapper call?
08:24xkbI was trying to spawn an agent with each "fire", but that doesnt work somehow
08:24tscheibl,(doseq [x [['js :text/javascript] ['css :text/css] ['xhtml :application/xhtml+xml]]] (defmimewrapper (x 0) (x 1)))
08:24clojurebotjava.lang.Exception: Unable to resolve symbol: defmimewrapper in this context
08:24Chousukeif you have all the bullets in the same data structure, it'll be a lot easier to update them all in sync
08:25xkbindeed
08:25Chousukeand to run collision detection
08:25xkbthat should be quite easy actually: the world is a grid, and each gridcell only has one occupant
08:25xkbso either wall, tank or bullet
08:26Chousukeof course, you *might* get performance issues due to low granularity but you won't know that until you code and test it :P
08:26xkbhehe
08:26Chousukeand if it turns out to be too slow then you can make it more complicated
08:27xkbso if I add the bullet to a central list, how would I dispatch a function to it?
08:27Chousukea function?
08:27xkbjust thinking out loud
08:27xkbyes
08:27Chousukeyou mean (dosync (alter bullet-ref update-bullet-positions) ...)?
08:28xkbnormally I'd do something like this: (dorun (map #(send % move) bulletlist))
08:28xkbbut the bulletlist changes
08:28rata_tscheibl: again, use the [name type] destructuring instead of (x 0) and (x 1)
08:28xkbwhere bulletlist contains bullet agents
08:29rata_tscheibl: (doseq [[name type] [['js :text/javascript] ['css :text/css] ['xhtml :application/xhtml+xml]]] (defmimewrapper name type))
08:29Chousukexkb: that's the nice thing about having just one mutable thing. you'll get the entire bullet list as an immutable thing, and calculate a new bullet list from that
08:29Chousukexkb: no need to worry about the head of the list changing before the tail :)
08:29rata_tscheibl: so seems cleaner to me
08:29raektscheibl: you'd need to put the doseq in a macro too: (defmacro defmimewrappers [m] (cons 'do (for [[name type] m] `(defmimewrapper name type))))
08:30xkbhmm
08:30Chousukeraek: missing a couple unquotes.
08:30raekeh. very true.
08:30xkbI think I'm just gonna try it :)
08:30xkbusually works best when learning
08:31raek(defmacro defmimewrappers [m] (cons 'do (for [[name type] m] `(defmimewrapper ~name ~type))))
08:31Chousukexkb: the rule of thumb is that the fewer mutable things you have in your program, the easier it is for you
08:31xkbChousuke: yeah, that's why I started with just the cell on the grid a tank was on, or was about to move to.
08:33Thumper_ /wc
08:40tscheibl@raek: thx very much... I see I'm just at the beginning of getting a grip on the mechanics of Clojure :)
08:43clgv"the mechanics of clojure" sounds like a book title ;)
08:44Fossiand like one i'd buy ;)
08:47tscheibland "the inner mechanics of clojure" :) as the logical sequel
09:05Scriptortscheibl: I would get that in a heartbeat
09:39rata_what's the function that transforms "regex" into #"regex"?
09:42cemerickrata_: re-pattern
09:42rata_thanks cemerick =)
09:59TimMc,'#"foo"
09:59clojurebot#"foo"
09:59TimMchrm
10:00Fossifoo is foo is foo
10:00TimMcI was hoping I could get the expansion.
10:00TimMc,'~foo
10:00clojurebot(clojure.core/unquote foo)
10:00TimMclike that
10:01ejacksonfoo is foo is foo, but in France we call it LeFoo.
10:01pdkdoes gaston come with it
10:02clgv,#'"foo"
10:02clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol
10:02clgv;)
10:03clgvwhat expansion should a string have?
10:07rata_clgv: #"foo" is not a string
10:08clgvoh right ;)
10:08clgv,#"foo"
10:09clojurebot#"foo"
10:09clgv,(type #"foo")
10:09clojurebotjava.util.regex.Pattern
10:10clgvI guess clojure simply prints out every pattern like this. so you dont see anything else
10:11TimMcHow do I collapse truthy and falsey values to true and false?
10:11TimMc$findfn nil false
10:11sexpbot[clojure.core/keyword? clojure.core/chunked-seq? clojure.core/sequential? clojure.core/fn? clojure.core/not= clojure.core/string? clojure.core/sorted? clojure.core/false? clojure.core/true? clojure.core/symbol? clojure.core/number? clojure.core/integer? clojure.core/... http://gist.github.com/840520
10:11TimMcsexpbot: You're back!
10:12clgvhe was gone?
10:12RaynesHe left?
10:12clgv$seen sexpbot
10:12sexpbotsexpbot was last seen joining on :#jiraph 12 hours and 26 minutes ago.
10:12RaynesMy logs tell me that amalloy restarted him last night for some reason, but I'm not certain why or how long he was gone.
10:12clgvlol thats where he was ;)
10:13TimMc,(boolean nil)
10:13clojurebotfalse
10:13TimMc,(boolean 5)
10:13clojurebottrue
10:13TimMc\o/
10:16TimMcQuestion: I'm making an undo/redo manager, called History. (I'm abstracting it from my existing program.) It has undo? and redo? accessors, but...
10:16TimMc...should undo and redo, when called on a fresh History, throw an exception or return the unchanged object?
10:17clgvare you working immutable?
10:17TimMcIt is a defrecord, so yeah.
10:18clgvfresh history = empty history?
10:18TimMcyeah
10:18TimMcEmpty undo and redo buffers.
10:19clgvI need an organization chart: the history does contain the state of the whole program?
10:19TimMcEach is just a list acting as a stack. There's also the current state.
10:19TimMcIt's just the state of the user's data.
10:19TimMcNot the current tool selection, mode, view state, etc.
10:19clgvah kk. if nothing is in there simply return it unchanged
10:20clgvwhat use would you have from an exception? except that someone would have to catch it somewhere ;)
10:20TimMcOr it would help the client (me!) debug bad event handling and state.
10:21clgvbut is it bad in this case?
10:22clgvyou could also return nil as a third option ;)
10:22TimMcBleh, nil propagation.
10:22clgvbut that would only cause a deferred NullPointerException somewhere sooner or later ;)
10:23TimMcYeah, which is evil and bad.
10:23jolyIf you want to do more in this situation than a no-op, you'll need to signal it somehow (exception, nil, etc.). I generally see undo ignored if there's nothing left to undo.
10:25clgvyeah I think it is not bad behaviour to just ignore it there. if it's really wrong you'll notice with non-empty history ;)
10:25TimMcIt *should* be harmless to ignore it.
10:25TimMcI suppose that if the client really cares, they can check using identical?.
10:25Fossiemacs at least displays a "nothing to undo in this buffer"
10:25clgvare you doing automatic testing?
10:25Fossiso somebody might like to do that as well
10:28TimMcclgv: Not yet for that feature, but good point.
10:28TimMcI suppose I'll just make sure to document the behavior in that case and make sure it is detectable.
10:41Dranikwhat is the best tool for TDD in clojure?
10:41nfmai've been using lazytest and i am very happy with it :)
10:42semperosI doubt there's a "the best", but clojure.test, lazytest and midje are worth exploring
10:42semperosmidje has some extra emacs goodness the author includes in the source
10:45Draniknfma, semperos thanks!
10:49nfmai'm having some problem type hinting my code, so I've created an empty project with only clojure 1.2 and clojure contrib 1.2 using lein new, i start the repl and set the *warn-on-reflection* var to true, copy paste a bit of code http://pastebin.com/UemhjifF from the clojure.org website where they give examples of type hinting and the still the type hints are not applied... has anyone had this problem before?
10:51semperosjust tried it myself, not seeing what you're seeing
10:51dmiles_afkwhat is the benefit of ClojureCLR over runing Clojure in IKVM?
10:52dmiles_afk(if it can be ran in IKVM that is)
10:52clgvcan it?
10:52dmiles_afki am sure it almost can
10:52dmiles_afksince most anyhting runs in IKVM now
10:53clgvI'd answer you get immediate direct connection to .NET ;)
10:53nfmasemperos, are you using lein 1.3.1?
10:54clgvnfma: I dont get the warning with clojure 1.2.0
10:55nfmai have to figure out what's different...
10:55clgvmaybe the jars ;)
10:55nfmamy jars were downloaded automatically with leiningen
10:56nfmaalso i have the same problem with clojure 1.3 alpha 4
10:57clgvhm ok. I installed my jars manually to my project ;)
10:57jcromartieis doto still useful?
10:57nfmabut did you get them from clojars?
10:58clgvnope. from clojure.org
10:58nfmai'll try that, thanks
10:59semperosnfma: I'm using Leiningen 1.4.1, Java 1.6.0_23 client vm
11:00clgvLeiningen 1.4.2 on Java 1.6.0_24 ;)
11:01jolyjcromartie: I think doto is still useful if you're doing a bunch of operations with side effects on an object. Usually more for Java interop, I'd imagine
11:01nfmaya, no luck for me... i'll upgrade leiningen then
11:01nfmathanks
11:02semperosnp
11:03semperosnfma: to make it simple, you might try just using the clojure jar by itself (no leiningen, just download and stick on classpath) and see if you see the same behavior
11:07nfmaupgrading leiningen did the trick, but ya if it hadn't that's what i would have done. thanks samperos and clgv
11:13jcromartiewow StringTemplate is awesome
11:14jcromartienot a fan of the clj-stringtemplate that's out there on bitbucket though
11:32fliebeldnolen: hi :)
11:45dnolenfliebel: how's it going?
11:46sritchie_hey all, one quick question about lazy sequences --
11:46sritchie_I'm working on a cascalog app, that requires me to serialize float arrays between hadoop jobs
11:47sritchie_hadoop supports java.io.serializable objects, so I'm finding that I'm able to store lazy sequences in a hadoop sequencefile,f or later retrieval
11:47sritchie_my question is -- is this safe? what does a lazy sequence serialize with it?
12:10fliebeldnolen: meh, I quit after I removed the decimal logic.
12:14dnolenfliebel: seems like you're starting to have a good understanding of how miniKanren programs work :)
12:15fliebeldnolen: meh, I haven't thoroughly read and understood the last chapters, so unification is still kind of magic.
12:16scottjis it unidiomatic/confusing/bad to name variables that are the return value of predicates with a "?"? like (let [task? (task-exists? id)]...
12:17fliebeldnolen: But as a good (or at least non-moronic) functional programmer, I just threat it as a black box that does the same thing every time.
12:18AWizzArd_scottj: that is perfectly fine
12:18ejacksonscottj: seems fine, or maybe is-task.
12:19dnolenfliebel: Unification is not so tricky, that chapter is good and clear. The monadic interleaving goal code is much trickier to understand, I thought.
12:20fliebeldnolen: huh, monads? :D I definitely need to learn those as well.
12:22dnolenfliebel: the code is monadic but I think learning monads to understand that code is overkill.
12:23pheephi, is there any good example of a _bigger_ swing application?
12:24pheepI have a hard time managing state through several components, all tutorials on swing that I can find are just for very simple programs where all state can be hold in one map or so easily.
12:30pheepsay, in oop terms I would have one class main window which holds an instance of a user control class and both components can change their own state. Know in clojure I would hold the state of the components in maps and this map in an atom or so, so that the map itself is immutable. But when I add the atom of the user control to the map of the main window it's not really immutable anymore.
12:31pheephow can I solve this?
12:32Despite1Are you concerned about doing nested atoms?
12:33semperosusing atoms (and other concurrency structures) is about controlling change, not making things immutable; Clojure' data structures are already immutable
12:34pheepDespitel, yes, kind of.
12:35pheepsemperos, I know that maps are immutable, however - I would not say they are logically immutable if they contain an atom, so I would prefere (atom {:a 2, :b 3}) over {:a (atom 2), :b (atom 3)} or would you suggest otherwise?
12:37Despite1I think using atoms as values is fine. *your* copy of the root map won't change, just like any other immutable structure
12:37Despite1I could be completely wrong about that, but that's how I've been thinking of it
12:41semperosif holding atoms in a map is just a convenience (so you're not passing as many parameters between functions), having a map of atoms makes some sense
12:41semperosbut consideration should be given to how you're needing to update the state
12:42Licensergreetinga
12:44Despite1Actually, since these are interconnected UI elements, wouldn't you want updates to them to be synchronized? In which case, you'd need a collection of refs.
12:44Despite1Which is more effort.
12:50scottjhow would you guys write this differently, use exceptions/state/monads? (if-not (valid1? a) :invalid1 (let [b (foo a)] (if-not (valid2? b) :invalid2 (if-not (valid3? b) :invalid3 ... (do (something with a) :ok)))))
12:53pheepfor single components that do not nest I actually handled it this way: if some event occurs, for example if a button is clicked, I read the required control-propertys(for example the text of a textbox) and pass them together with the state-map to some function. For example if I have a (let [state (atom {:name ""})] .. I would do then (add-action-listener some-btn (fn [e] (swap! state set-name (.getText name-txt))) where (defn set-name
12:53Licenserclj-swing alows cuppeling refs/atoms with ui elements
12:55amalloyDespite1: you are in fact completely wrong about using atoms as values :)
12:56rata_scottj: at least this is less nested: (if-not (valid1? a) :invalid1 (let [b (foo a)] (cond (not (valid2? b)) :invalid2 (not (valid3? b)) :invalid3 ... :else (do-something-with a))))
12:56pheepLicenser, is clj-swing generically usable with arbritary swing components? I never really looked at it but it seemed to me to be just for some specific swing components?
12:56amalloy"your" copy of the root map won't change: it will still point to the same atoms, but those atoms will have changing values
12:58Licenserpheep: yes and no :) it wrapps special ones but it can interact with every swing component, since clj-swing adds no special wrappers/data structures arond thing
12:58Licensers
12:59Despite1Hmm, I could see how that might be trouble
12:59pheepLicenser, are there any examples or introductory documents?
13:00Licenserthere is an example in the github repo: https://github.com/Licenser/clj-swing/blob/master/src/clj_swing/example.clj
13:01LicenserI know it's not much :(
13:02LicenserAnother question to annoy you all :) I was trying to work with Sharepoint and clojure/Java, now I have found an example for java and usually translating code works pretty well - sadly I fail to translate this into any kind of clojure -.-
13:02pheepis there also an example of the state thing in it?
13:03Licensergrid-bag example has states
13:04LicenserThis line: ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userName);
13:04Licenseris a particular problem since I can't figure out how to do the typecast in clojure and sadly it really is needed
13:04Licenserhttp://davidsit.wordpress.com/2010/02/10/reading-a-sharepoint-list-with-java-tutorial/ <- entire example
13:05LicenserI kind of hoped that clojures reflections would solve the tyecasting but since port in this example is some kind of odd proxy class it fails horriblie
13:09amalloyLicenser: agreed that it shouldn't be necessary, but ##(doc cast)
13:09sexpbot⟹ "([c x]); Throws a ClassCastException if x is not a c, else returns x."
13:09amalloyhm. that's not useful
13:09LicenserI googled like a crazy man but I did not find any way to force a cast in clojure
13:09Licensernot even by typehinting stuff
13:14Chousukehm, I thought typehinting should work in cases like those?
13:14LicenserDidn't for me, it called me out bla.bla.bla$Proxy doe not support function getRequestContext
13:22LicenserI wonder if I've found something clojure has not covered yet -.-
13:23sy`Licenser: The nature of god!
13:26LicenserThe nature of god is to find things not covered yet?
13:27sy`Licenser: Yes, for only the language of Lisp can discover it.
13:27sy`lol
13:27Licenserheh
13:28pheepwhat does this cast in java anyway? I can't find the documentation of the library.
13:30LicenserYes it is horribly documented
13:31pheepbecause in my understanding of java it needs to be some down-cast and that should make no problems but maybe I'm wrong about the javapart. However - are you sure that you do get the right object, have you tried this example in java before?
13:31Licenserpheep: the service.getListsSoap() call returns some kind of proxy object
13:31LicensergetRequestContext is a function of the BindingProvider interface
13:32Licensernow that proxy class for some reason refuses to allow me to call getRequestContext on it
13:33Licenserit is part of the whole java-ws thing I think
13:33pheephow would a proxy object be casted to another object, I thought there were no custom casts in java?
13:33Licenserpheep: I don't know
13:34amalloyLicenser: http://download.oracle.com/javase/1.3/docs/guide/reflection/proxy.html#methods maybe?
13:35amalloyi've never seen anyone actually expose a proxy class to the public; i get the feeling it's a bad idea
13:36Licenserhttp://download.oracle.com/javase/6/docs/api/javax/xml/ws/Service.html#getPort(javax.xml.namespace.QName,%20java.lang.Class,%20javax.xml.ws.WebServiceFeature...)
13:36Licenserthat is the function creating it
13:39Licenserproxies are evil but yes amalloy that is the rough point where to look
13:40Licenseralso the methods for the proxy don't seem to let you call a function -.-
13:56pppaulhey peoples!
13:58pppauli want to do side effects on a seq, using sh... i'm doing it with map and dorun (dorun (map (special effects...))) but it gives me back a list, i would rather not get anything back, what should i use inplace of map?
13:59patrkris,(doc doall)
13:59clojurebot"([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 co...
14:00patrkrisnevermind
14:00spewn,(dorun (map #(* 2 %) (range 10)))
14:00clojurebotnil
14:00spewn,(doall (map #(* 2 %) (range 10)))
14:00clojurebot(0 2 4 6 8 10 12 14 16 18)
14:00spewnpppaul: dorun shouldn't be giving back anything...
14:00pppaulum
14:01pppaulit's giving me back (nil nil...)
14:01pppauli'm mapping something to a map of dorun
14:01pppaul(map ( dorun (map
14:01amalloypppaul: it's not giving you anything back
14:01amalloyit may be printing several nils or something, but it's certainly not returning them
14:02pppaulyeah... ok, i guess that's good
14:02pppaul:D
14:02tscheibli had the same thought
14:03tscheibl,(dorun (map #(println "haha" %) (range 10)))
14:03clojurebothaha 0
14:03clojurebothaha 1
14:03clojurebothaha 2
14:03clojurebothaha 3
14:03clojurebothaha 4
14:03clojurebothaha 5
14:03clojurebothaha 6
14:03clojurebothaha 7
14:03clojurebothaha 8
14:03clojurebothaha 9
14:03tscheibloops... I'm evil
14:03Licenseryes
14:03amalloy&(dorun (map #(println "haha" %) (range 3)))
14:03sexpbot⟹ haha 0 haha 1 haha 2 nil
14:03rmarianskigood thing that was a 10 and not 100 :)
14:03tscheibl:)
14:03amalloytscheibl: nah, clojurebot is evil :)
14:03pppaulshould try 100
14:04tscheibl10000000000000000
14:04tscheiblnah.. better 9999999999999999999
14:04rmarianskiperhaps iterate inc?
14:04pppaul,(dorun (map #(println "haha" %) (iterate inc)))
14:04clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$iterate
14:05amalloyyou're looking for (range) :P
14:05pdkyou have to pass an initial value after the fn to iterate
14:05pppaul,(dorun (map #(println "haha" %) (infinity)))
14:05clojurebotjava.lang.Exception: Unable to resolve symbol: infinity in this context
14:06pdkdude
14:06pppaul,(iterate inc 0)
14:06clojurebot(0 1 2 3 4 5 6 7 8 9 ...)
14:06pppaulwoo
14:06pdk,(dorun (map #(println "haha
14:06clojurebotEOF while reading string
14:06pdk,(dorun (map #(println "haha" %) (range))
14:06clojurebotEOF while reading
14:06pdk,(dorun (map #(println "haha" %) (range)))
14:06pppaul,(range)
14:06clojurebotExecution Timed Out
14:07clojurebotExecution Timed Out
14:07pppaulhmm
14:07pppaul,(dorun (map #(println "haha" %) (iterate inc 0)))
14:07clojurebotExecution Timed Out
14:07pppaulguess it wont work
14:08pppaul,(make pizza)
14:08clojurebotjava.lang.Exception: Unable to resolve symbol: make in this context
14:09tscheibl(loop [] (recur)) ...
14:10tscheibldon't try that at home
14:11tscheibldon't you people have repls at home? :)
14:12TimMcheh
14:12pppauli don't want my repl to be full of the shit i put in this chat
14:13pppaulwhat if someone saw?
14:13amalloytscheibl: my repl is always too busy computing (->> (range) (filter even?) (filter odd?) (first))
14:13mefestodo the bots watch out for loops like that?
14:14mefestoor loops in general not allowed by them?
14:14pppaul,(#(%)#(%))
14:14clojurebotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: sandbox$eval2053$fn
14:14amalloymefesto: they timeout
14:14amalloy&(->> (range) (filter even?) (filter odd?) (first))
14:15sexpbotExecution Timed Out!
14:15pppaulhmmm
14:15pppaulthe race is on!
14:15mefestonice
14:15pppaul&(->> (range) (filter even?) (filter odd?) (first))
14:15pdkit tries to actually generate that infinite sequence before doing anything with it
14:15pppaul,(->> (range) (filter even?) (filter odd?) (first))
14:15sexpbotExecution Timed Out!
14:15clojurebotExecution Timed Out
14:15pdktoss a take in there and you'd be fine
14:15amalloypdk: what?
14:16pppaulon your marks, get set, go!
14:16pppaul,(->> (range) (filter even?) (filter odd?) (first))
14:16pppaul&(->> (range) (filter even?) (filter odd?) (first))
14:16sexpbotExecution Timed Out!
14:16clojurebotExecution Timed Out
14:16pppaulwinner!
14:16tscheiblbotrace?
14:16pdkwell rather
14:16pdkthe filters just keep on chugging on the seq until it runs out of time
14:17amalloypdk: there's a (first) at the end. that's equivalent to (take 1)
14:17amalloy(for purposes of this discussion)
14:17pdk,(filter even? (range))
14:17clojurebotExecution Timed Out
14:18pdkthe first gets called after it's been run through two filters
14:18pdkand filters are the rub
14:18pdkthe filters
14:18amalloyyes. so? those two filters are intentionally constructed to never return any elements
14:18amalloythat's the joke
14:19amalloy"find me the first even number that is also odd"
14:20pppaulactually, it reads find all even numbers, such that all odd numbers from those even numbers, give me the first one
14:20pppauli didn't know how to end that right
14:26tscheiblamalloy: your problem is solvable at infinity
14:26amalloytscheibl: that's why i haven't killed my repl yet. i'm waiting for it to finish
14:27tscheiblamalloy: yeah that's science :)
14:28pppaulif someone runs that on their machine, will it seg fault or run forever?
14:28tscheiblit will segfault forever... lol
14:28pppaulis filter holding onto the head?
14:29pppaulor range?
14:29pppaulamalloy, you should try it
14:29tscheiblheak
14:29tscheiblheap
14:31amalloypppaul: of course not. if filter and range hung onto the heads of their seqs laziness would be impossible like ever
14:33pppaulwell, who's being lazy? the person who made filter or ranage, or the person who uses them?
14:37amalloyhm. i want a function that's not quite like distinct: constrain a list so that each element appears at most N times. i can roll my own with reduce, but that seems like overkill; does one exist?
14:45amalloyif anyone is interested, i just wrote that at https://gist.github.com/ac577998a404164266aa
15:01tscheiblnice one
15:02amalloytscheibl: now, go write a lazy version
15:10markskilbeckIs there a way to force clojure to output a complete number, not its scientific representation.
15:12amalloymarkskilbeck: like a floating-point decimal number? don't use floating point if you want perfect accuracy
15:12tscheiblamalloy: nah... I'm far too lazy :)
15:12markskilbeck,(* 5.63 (expt 10 7)
15:12clojurebotEOF while reading
15:12markskilbeck)
15:12markskilbeck,(* 5.63 (expt 10 7))
15:12clojurebotjava.lang.Exception: Unable to resolve symbol: expt in this context
15:13markskilbeckWell, I'd like the complete number output. Possible, or not?
15:13raekmarkskilbeck: like this ##(double 1/3)
15:13sexpbot⟹ 0.3333333333333333
15:13raekmarkskilbeck: or like this ##(format "%f" 1e9)
15:13sexpbot⟹ "1000000000.000000"
15:13markskilbeckraek: ah. Thanks.
15:14amalloy&(format "%f" 1e30)
15:14sexpbot⟹ "1000000000000000000000000000000.000000"
15:14amalloyneat
15:14raek&1e30
15:14sexpbot⟹ 1.0E30
15:15amalloy&(format "%f" (+ 1e30 1e-30))
15:15sexpbot⟹ "1000000000000000000000000000000.000000"
15:15amalloyyou of course still can't get "complete" output
15:15pppaulanyone use lein and uberjar?
15:17amalloywow, i just realized the amazing potential for bad code that comes from stuff like (let [inc (fnil inc 0)] ...)
15:17pppauli'm getting errors when compiling my uberjar
15:18pppaullet inc????
15:18pppaulinc is defined already
15:18amalloypppaul: yep, so?
15:18raekpppaul: what kind of errors?
15:18amalloy&(let [inc dec] (inc 10))
15:18sexpbot⟹ 9
15:18pppaulcan't find my main
15:19pppaulin project: :main mkdirs.core)
15:19pppauland in that file: (defn -main [& args]...)
15:19pppauli tested it in my repl, and it works... when i build the jar it can't find my main
15:19amalloyit just happened i wanted to call inc on several things, and treat nils as if they were zero: (let [inc (fnil inc 0)]) solves my problem quite nicely, but it made me realize how horrible it could be if i redefined built-ins to things that are less clear
15:19raekpppaul: you have a namespace like (ns my-proj.main (:gen-class)) (defn -main [...] ...) and :main my-proj.main, :aot [my-proj.main] in the project.clj?
15:20amalloyraek: :main implies :aot for the main namespace, doesn't it?
15:20pppauloh crap, i put my main too high in the file
15:21raekamalloy: hrm. it probaly does...
15:22tscheiblhow can I check if a symbol exists without using exceptions?
15:22amalloytscheibl: every symbol exists. you mean var?
15:22amalloy&(resolve 'clojure.core 'test)
15:22sexpbotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
15:22amalloy,(resolve 'clojure.core 'test)
15:22clojurebotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$resolve
15:22raektscheibl: if there exists a var with that name in the curret namespace? 'resolve'
15:22raekamalloy: you beat me to it... :)
15:23raek,(resolve 'clojure.core/test)
15:23clojurebot#'clojure.core/test
15:23amalloyraek: except i'm no good at it, apparently :P
15:23raekthat returns nil if there is no such var
15:23raek,(resolve 'conj)
15:23clojurebot#'clojure.core/conj
15:23tscheiblah coll.. works, thx
15:23tscheiblcool
15:23raek,(resolve 'does-not-exist)
15:23clojurebotnil
15:32mattmitchellanyone know of a library that can parse a query string into a hash-map/vector?
15:33mattmitchelli'm building a redirect string in a ring app
15:33amalloymattmitchell: ring has a wrap-params middleware or something like that
15:34mattmitchelland in my tests.. i don't want to use regular expressions for every param
15:34mattmitchellamalloy: i saw that but not sure how i could use that for my test
15:35TimMc,(#(%1 %1) #(%1 %1))
15:35clojurebotjava.lang.StackOverflowError
15:35TimMcThat was *fast*.
15:35TimMc&(#(%1 %1) #(%1 %1))
15:35sexpbotjava.lang.StackOverflowError
15:36TimMcOK, my new #1 beef with Clojure is this error: "nth not supported on this type: Double"
15:36TimMc...Double being Point2D$Double. >_<
15:36amalloyTimMc: so stop trying to destructure Doubles
15:36TimMc:-P
15:36amalloythey're not clojure persistent objects
15:37TimMcOh! No, what I mean is, I thought it was referring to j.l.Double
15:37pppaulanyone deal with shell-out?
15:37TimMcespecially given that I can't import Double directly out of Point2D.
15:38amalloyTimMc: i believe there's something called import-static in contrib
15:40pppauli'm using clojure.contrib.shell-out, works fine via swank, but when i make an uberjar it doesn't work anymore. only command i'm using is mkdir
15:43pppauloh
15:43pppaulthat would break things bad
15:43jweisswell, it certainly breaks when i attempt to call map or meta in said function
15:43raekpppaul: sounds strange. also, there's clojure.java.shell since 1.2
15:44pppauli looked at java.shell... i had problems with it.... i'll see about getting it working in my code
15:44Licenseranyone dealed with a Proxy yet?
15:48pppaulswitched to clojure.java.shell... same problem
15:48pppauli tried doing (println (sh "mkdir" %))... and it prints nothing
15:49puredangergiven a seq of maps, someone MUST have written a function that can sort the seq by a combination of fields in the maps. (sort-by :field maps) works great for one field and I will write the next step if I must but I will gladly re-use an existing one if I've missed it
15:49jcromartieLauJensen: does cql allow operations inside a transaction
15:49pppaulno dirs are made :(
15:49pppaulit's like it's not even being called
15:50amalloypuredanger: ummmm, depending on what you mean by "sort by a combination of fields", you can (sort-by (juxt :field1 :field2) maps)
15:50puredangeramalloy: ah.... I was thinking comp and that it wouldn't work. got my brain on sideways
15:51amalloypuredanger: well, juxt won't put them in any meaningful order, i suspect, because (< [:a :b] [4 10]) won't sort well
15:51amalloybut it's a start
15:52puredangeramalloy: yeah...
15:52raekpppaul: is the % a string?
15:52pppaulyes
15:52pppaulmy code works 100% in the repl
15:52pppauljust not with lein run, or uberjar
15:53raekcould it be a problem with laziness?
15:53pppaul... how so?
15:53pppaulit runs in the repl
15:53raek,(do (map println ["one" "two" "three"]) :foo)
15:53clojurebot:foo
15:54raekthe printlns are never evaluated
15:54pppaul (->> dir-strs
15:54pppaul (map #(sh "mkdir" %))
15:54pppaul dorun))
15:54pppaulthat's my code for making dirs
15:55raekand if you replace dorun with pr, what is printed?
15:55LauJensenjcromartie: technically it should work with contrib.sql/transaction, but Ive had some issues with it, so hang on until I announce dbsync on twitter
15:55pppaulnothing
15:56raekit should print something... at least "()"
15:56jcromartieLauJensen: I ask because we have many constraints in our existing DB, and it's hard to manage some inserts without transactions
15:56jcromartiealthough it should be possible as long as they are in the right order
15:56amalloypppaul: (apply sh "mkdir" dir-strs) seems like an easier way to do it
15:56raekpppaul: I suspect the problem lies at some point outside the ->> form
15:56LauJensenjcromartie: I understand. Take a look at contribs transaction, rewrite it for CQL and send me a patch and I'll be happy to merge it as soon as I get the time
15:56jcromartie:P
15:57LauJensenjcromartie: make sure that you add some tests and run 'cake test --integration=true' before you submit
15:57pppauli just changed my code to use clojure.java.shell... i don't know if that is breaking things
16:01pppaulthe java.shell isn't working like contrib.shell-out
16:01pppaul:....(
16:06pppaulgot it working in the repl again
16:08simardhow can I do this, but correctly ? (binding [*out* (System/out)] (prn "test"))
16:08simardie.. java.io.PrintStream cannot be cast to java.io.Writer
16:09zztrsimard: bind prn instead?
16:09mefesto(binding [*out* System/out] ...)
16:09brehautsimard: with-out-str, with-out-append-writer, with-out-writer perhaps ?
16:09mefestosimard: you are trying to execute System/out as a function
16:10mefestough, also needs to be a writer, not a PrintStream?
16:11brehautperhaps have a look at clojure.java.io ?
16:13mefesto(binding [*out* (io/writer System/out)] (prn "test"))
16:13mefestowhere io is clojure.java.io
16:13mefestoalso, *out* points to System/out by default, doesn't it?
16:14raekyou might need to wrap the the writer in a PrintWriter: (PrintWriter. (io/writer System/out :encoding "UTF-8"))
16:14simardmefesto: thanks, but no, not when "lein swank"
16:14octei'm transforming some ugly nested json to a string and i got this code: http://paste.lisp.org/display/119936
16:14octebut it looks pretty ugly
16:14octemaybe there's a better way?
16:15mefestosimard: when i use that in slime-repl with the binding it prints to console where i launched lein swank
16:15raekhrm. (alter-var-root #'*out* (fn [out] (def the-root-out out) out))
16:16simardmefesto: yes, it's working now with the binding
16:16simardthanks
16:16mefestosimard: without the binding it prints within slime-repl
16:17simardI have a slime-repl right now
16:18simardI M-x slime-connect and all I have is a *slime-events* buffer
16:18simard(and I see the result of evaluations in the minibuffer)
16:19simard"I have a slime-repl right now" should have been, I don't have a slime repl
16:19mefestohmm, when i slime-connect i get a *slime-repl clojure* buffer
16:19simardhmm<
16:20mefestoI'm using clojure 1.2 and swank-clojure 1.3.0-SNAPSHOT
16:21simardmefesto: me too, maybe it's my slime version
16:21simardI'll try to update it first
16:24pppaulusing java.shell fixed my problem, thanks
16:25pppaulamalloy, i'm using (apply (partial sh "mkdir") dir-strs) thanks for the suggestion
16:25simardmefesto: you don't use inferior-lisp-program do you, it's really a slime-connect to lein swank ?
16:27pppaulso, when i run my uberjar, the program doesn't finish executing. is there something like (exit) that i need to use?
16:27simardmefesto: updating my slime did the trick
16:27pppauli tried ending my main function with 0, but that did nothing
16:28puredangerpppaul: no, do a thread-dump and see what's left (ctrl-break on win, ctrl-\ on *nix)
16:28pppaulthanks
16:28puredangerpppaul: if you're using agents, the thread-pools are non-daemon threads and prevent exit, you'll need a call to (shutdown-agents)
16:29pppauli'm not using agents
16:29pppaulnot doing anything fancy in this program
16:30pppauljust some string manip, and calls to shell
16:30pppauli don't really understand the output of the threaddump
16:32mefestopppaul: if you want to force exit you can use (System/exit retcode)
16:32pppaulok, i'll do that
16:32pppaulthanks
16:33mefestopppaul: maybe that shell lib leaves a thread or process running?
16:34pppaulhmmm
16:34pppaulmaybe
16:34pppaulsystem/exit isn't working
16:34mefesto(System/exit 0) hangs?
16:34pppaulyup
16:35pppaulunless lein isn't running my new code that i saved
16:35pppauloops
16:36pppaulforgot to remake the jar
16:36pppaulworks! :D
16:36pppaulthanks a lot
16:36mefestosweet :)
16:36mefestopppaul: what shell lib are you using?
16:37pppaulclojure.java.shell
16:37mefestoc.c.shell ?
16:37mefestooh ok
16:37pppaulit's more sophisticated than clojure.contrib.shell-out... but i don't use it's features
16:59mattmitchellhello?
19:27kclexit
19:50Derandermy fingers are cold
19:51amalloyDerander: write some php. all the typing should warm you up
19:51TimMcamalloy: Pssh, PHP? Java is the ticket.
19:51TimMcJust don't use autocompletion.
19:52amalloyjava is verbose, but it's not full of completely unnecessary $ and -> tokens
19:53DeranderJustLotsOfGoofyTypeNamesThatAreReallyLongAbstractFactoriesConstructorMachines
19:56brehautDerander: i've never seen java code that looks like that. Its always <OvrlySpfcNs:ApproximationOfALongClassname withSomeVerbose="attributes"><pojo:Param name="blah blah"><…
19:56Deranderoh right, of course.
19:56Deranderheh. microsoft hungarian is fun too
20:26tscheibl (cljs (on-ready
20:26tscheibl (-> (js* ($ "body"))
20:26tscheibl (#(js* (.append (clj %) (.text ($ "<div>") "HUHU") )))
20:26tscheibl (#(js* (.append (clj %) (.text ($ "<div>") "HAHA") ))))))))
20:27tscheiblhmm... that's not really more readable than pure javascript+jQuery...
20:27tscheiblit's scriptjure. btw
20:30tscheiblI'll go to bed now... it's 2:30 AM, bye
22:22Sgeo_I asked yesterday, but I don't think I got a response. How's Clojure-on-Clojure going?
22:27Sgeo_Clojure has no continuations? That's no fun
22:28spewnSgeo_: I haven't taken the time to read this yet, but http://dosync.posterous.com/continuation-passing-style-in-clojure
22:28Sgeo_What happened to Try Clojure?
22:43Sgeo_Is it reasonable to like Clojure for everything except the Javaness, and despite that part?
22:43Sgeo_And certain ... consequences of that
22:44pdkentirely
22:44pdkyou're trying to have a full fledged lisp coexist with a language that well
22:44pdkyknow
22:44pdkbrought us primitive boxing
22:45Sgeo_I once asked in #scala if learning Scala was reasonable given lack of interest in JVM compatibility. They said no, due to the compromises that Scala had to make
22:45Sgeo_Or well, one person said no
22:46pdkscala's type system is probably more advanced than java's at any rate
22:47Sgeo_A criticism I've seen of Scala is that it's like a modern C++... just a lot of bolted on features
22:47Sgeo_They made the same criticism of Falcon, I think, except stronger
22:47Sgeo_They pretty much actively made fun of Falcon
22:48pdkfalcon doesnt ring a bell
22:48Sgeo_http://falconpl.org/
22:48Sgeo_I am not responsible for any brain-damage
22:55tomojit's hard to take the language seriously with a website like that
22:58Scriptorthe language isn't *too* bad
22:58Scriptorer
22:58Scriptorthe *website
22:59Scriptorfor one thing, it actually provides example code ;)
22:59tomojreading some of the examples is enough to make me want to keep reading even though the website is terrible
23:01tomojright, it's not too bad
23:02tomojthe curve of actual design quality vs. take-serious-ability is steep
23:04Scriptorbest to go with minimalism, for langs
23:04tomojI can't even come close to pulling off minimalism :(
23:04Scriptorjust follow io's site :)
23:05Sgeo_I'm kind of excited about Seph
23:06tomojeven they have a FOUC
23:07tomojthough.. github is currently totally unstyled and unusable in my browser
23:10Sgeo_:(:(
23:11Sgeo_(-> somecol (partial filter sometest) (partial map sometransform))
23:12Sgeo_Those partials are somewhat ugly
23:12amalloySgeo_: and also not doing what you want
23:12Sgeo_And yeah, sure, it could be written (map sometransform (filter sometest somecol))
23:12Sgeo_amalloy, hmm?
23:12amalloytry it
23:13amalloy&(macroexpand-all '(-> somecol (partial filter sometest) (partial map sometransform)))
23:13sexpbot⟹ (partial (partial somecol filter sometest) map sometransform)
23:14amalloyyou *could* do it with -> and partial if you wanted, but that's crazy. instead you want ##(macroexpand-all '(->> somecol (filter sometest) (map sometransform)))
23:14sexpbot⟹ (map sometransform (filter sometest somecol))
23:15amalloyc'est bon?
23:16bartjIf I have a (def blah ["x" "y"])
23:17bartjand I refer blah through out the code
23:17bartjnow, I require blah to be called as a function
23:17bartjis this possible to do in Clojure ?
23:18amalloybartj: huh? you just write (blah 0), which results in "x"
23:20Sgeo_amalloy, I'm confused
23:21Sgeo_Oh, "second item" vs "last item"
23:21amalloyindeed. and you probably want to understand why your partial-based solution doesn't work
23:22Sgeo_Because it makes (map somecol sometransform) and (filter thatmap sometest) instead of what I want?
23:23amalloyno, that's what would happen if you used -> without any partials
23:23bartjamalloy, wrong question
23:24amalloy(-> foo (partial bar baz)) turns into (partial foo bar baz), *not* an invocation of (partial bar baz) with argument foo
23:24Sgeo_Oh, I don't need (or want) partial at all????
23:24Sgeo_So forms, not functions
23:24amalloyindeed
23:24Sgeo_That's rather convenient
23:25amalloythat's the idea :)
23:25Sgeo_And if I wanted to use a named function, nothing wrong with () around it I guess
23:25amalloySgeo_: you don't have to at all
23:25amalloy&(-> 1 inc inc inc)
23:25sexpbot⟹ 4
23:26Sgeo_What if I want to include forms some of which should have their second position filled in, some of which their last?
23:27amalloy&(macroexpand-all '(-> foo (bar 1) (->> (baz 10))))
23:27sexpbot⟹ (baz 10 (bar foo 1))
23:27Sgeo_I missed anyhing after Sgeo_> Or what if I want to fill in the third position?
23:28Sgeo_amalloy, hah
23:28Sgeo_What about the inverse? Or again, what about third position
23:28amalloyum, i don't understand what you mean by inverse, and you really don't want to put things into the third position :P
23:29amalloyuse (let) for your temporary bindings to make that kind of stuff more explicit
23:29Sgeo_Most of the things needing stuff inserted last, but something in the middle needing it inserted second
23:29Sgeo_I see how ->> inside -> works, but the other way around shouldn't
23:29Sgeo_afaict
23:30amalloyit won't
23:31amalloyyou can either use one -> and a lot of ->>s, or use let, or if you don't mind some pain, (->> foo (map baz) (filter bar) (#(swap! % inc)))
23:32Sgeo_Ok, I think I'll stay away from the painful alternative
23:33Sgeo_Given that I don't understand it
23:33Sgeo_(fn [x] swap! x inc)
23:33Sgeo_OH
23:33Sgeo_I get it
23:33Sgeo_Since that () form contains the function, and it's.. I get it
23:34Sgeo_Although maybe some function other than swap! would have been nice >.>
23:52sritchiedoes anyone have experience with crane, or pallet, for managing hadoop clusters/
23:52sritchie?
23:54hugod_sritchie: pallet doesn't have a working crate for hadoop yet - I would be willing to help get one going though - it's been on the todo list for a long time
23:55sritchiehugod_: that's definitely something I'd be interested in helping with
23:56sritchiehugod_: I've got a cascading app that I need to get running on EC2 this week -- I'll start looking around pallet
23:57hugod_sritchie: the crate I started is here https://github.com/pallet/pallet-apache-crates
23:57clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.Exception: 503>
23:58bartj.quit
23:58sritchiehugod_: great, forked
23:58sritchiehugod_: hope I can be helpful, here!