#clojure logs

2014-01-04

00:10eggheadis there anything like hiccup for om dom fns
00:10noonianhttps://github.com/r0man/sablono maybe
00:12eggheadah, thanks
00:12nooniannp
00:13eggheadall the om/el #js stuff feels very boilerplate :3
00:13eggheadhttps://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/item.cljs#L66-L83
00:40t3soroIs there some lock object like a multi-semaphore that can signal all waiting threads?
00:41marcopolo`t3soro: what are you trying to do?
00:42t3sorosynchronize an object and block all ops on it until it's ready
00:43t3soroI have a state machine and i dont want to allow ops during a busy state.. never mind i see how its not necessary
00:43hiredmanthere are lots of those infact
00:43t3sorohow much do i have to pay you?
00:44t3sorolol
00:44hiredmanevery jvm object has wait/notify
00:44hiredmannot that those are great, but they are there
00:46t3soroHmm these are interesting but i got it figured out.. just requires an atomic boolean busy state
00:50indigobitemyapp: http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java :D
01:39alewis reduce lazy?
01:40TEttinger3alew: you can reduce over lazyseqs. I believe even then it evaluates them though. to the docstring! ##(doc reduce)
01:41lazybot⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well... https://www.refheap.com/22458
01:41alewI guess it doesn't really make sense for reduce to be lazy
01:41TEttinger3so no, not lazy
01:42TEttinger3but you can do something like...
01:42TEttinger3,(reduce (fn [_ __] (reduced)) 0 (repeat 1))
01:42clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/reduced>
01:43TEttinger3,(reduce (fn [_ __] (reduced "whee")) 0 (repeat 1))
01:43clojurebot"whee"
01:43TEttinger3(repeat 1) is an infinite sequence
01:45alewright
02:30john2xhow do I try out my leiningen template locally?
02:33TEttinger3john2x, maybe lein install? I've never used anything but the default template though
02:41noonianyeah, lein install
02:42noonianthen add it to your plugins in .lein/profiles.clj i think
02:42noonianin mine its in the form of [<template-name>/lein-template "0.1.0-SNAPSHOT"]
03:09Clome_Is there a macro, form, or fn that allowes you to apply a single argument to multiple function (do (fn1 a) (fn2 a) (fn3 a) (fn4 a) (fn5 a)) => (something a fn1 fn2 ...)
03:16eggheadClome_: ((juxt fn1 fn2 fn3 fn4) a)
03:17egghead,((juxt < >) 1 0)
03:17clojurebot[false true]
03:18`cbp(doto a f1 f2 f3 f4)
03:36pyrtsaOuch, the semantics of (reduce f xs) could be better than: "If coll has only 1 item, it is returned and f is not called. (...) If coll contains no items, returns val and f is not called."
03:37pyrtsa^ That works fine for (+) and (*), but not so much for monoids like sets where the type of the first argument of f is different from the element type of xs.
03:38pyrtsaFortunately (reduce f init xs) works. :)
03:39pyrtsa(IMO, a better option would've been to define (reduce f xs) as an error if xs is empty, regardless of f.)
03:45arcatanmy favorite would be to define f like (defn f ([] unit-value) ([x y] (operation x y))) and then (reduce f xs) = (reduce f (f) xs)
03:45arcatan(not actually a good idea, but hey)
05:52abaranoskyanyone there?
06:13ddimaprobably ;)
06:25john2xhmm i'm getting "No such var: clojure.core.cache/through" when trying to start the repl of a project created by my fork of luminus-template. what does it mean?
06:34anildigitalwhat's wrong with this code? https://gist.github.com/anildigital/c3f47416b8986bd6b59b
06:34mrcheeksjohn2x: do you depend on it?
06:35mrcheeksjohn2x:depend as lein dependency
06:36john2xmrcheeks: no, but probably one of the dependencies that's added by luminus.. strange thing is that the changes I introduced don't remove/add any dependencies.. I just switched some template files around.
06:38ddimaanildigital: how do you call functions in clojure?
06:38mrcheeksanildigital: looks like you're writing code the java way and mixing it up, I'm also still learning though... (1) vs 1 (* 1 1 ) vs (1 * 1)
06:38ddimaanildigital: you multiply n with a function instead of calling it
06:39john2xhere's the stacktrace https://www.refheap.com/22463
06:39ddimaand you also call an int
06:39anildigitalddima: corrected that but still get same error
06:39anildigitalhttps://gist.github.com/anildigital/c3f47416b8986bd6b59b
06:39ddimabasically its completely wrong unfortunately, see https://gist.github.com/anildigital/c3f47416b8986bd6b59b
06:39ddimaerr
06:39ddimahttp://stackoverflow.com/questions/1662336/clojure-simple-factorial-causes-stack-overflow
06:40ddimawrong link
06:40john2xand as a sidenote, since I `lein install`ed my fork of luminus-template, how do I go back to the official version?
06:40ddimaanildigital: the recursive call is not a proper call still
06:41ddimaanildigital: what helps if you absolutely dont see your error, try every line on its own in the repl
06:41mrcheeksddima: indeed, but the syntax is all wrong
06:41ddimawith imaginary values
06:41ddimamrcheeks: yeah, as mentioned
06:43ddimaanildigital: its actually pretty easy to understand, whatever is in the first position of a 'list' () is viewed as a call to this function and the rest are arguments. so if the thing at position one is not a function it wont work. usially X cannot be cast to clojure.lang.IFN
06:43ddimathis would also happen for (1)
06:43ddima,(1)
06:43mrcheeksanildigital: Check again function calls in lisp and that should do it (prefix notation)
06:43clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
06:47ddimaanildigital: fixed? ;)
06:49ddimathere's one more thing you need to understand for your example: whatever statement was evaluated last will be returned by your function - thus 1 or the result of the recursive call, but you dont need to wrap any value in braces
06:49ddima,(do (defn footest [] 1 2 3) (footest))
06:49clojurebot3
06:54john2xfound the culprit that's depending on clojure.core/memoize. it's https://github.com/ngrunwald/ring-middleware-format/blob/master/project.clj. But I've added clojure.core.cache to my project.clj already, and it's still throwing the exception
06:54pyrtsaarcatan: That's incidentally what clojure.core.reducers asks you to do. :) (Re: "semantics of (reduce f xs)")
06:54john2xdoes it need to be added in core.memoize's dependencies?
06:55john2xor in ring-middleware-format's dependencies?
07:07Clome_why this (map #(do {% (inc %)}) a) does work but this does not (map #({% (inc %)}) a)? You are allowed to define a fn that just returns a map.
07:12amalloy#(x) is (fn [] (x)), not (fn [] x), Clome_. if you substitute {% (inc %)} for x there, you'll see that it expands not to the (fn [x] {x (inc x)}) that you want, but instead to (fn [x] ({x (inc x)}))
07:13Clome_thanks
07:14ddimaClome_: sometimes macroexpand-1 is your friend ;)
07:15amalloybut not in this case, ddima :P
07:15amalloyit's really just quote
07:15amalloy,'#({% (inc %)})
07:15clojurebot(fn* [p1__25#] ({p1__25# (inc p1__25#)}))
07:15ddimaoh, true, the expand does nothing ;)
07:15ddimatil
07:19ddimaamalloy: do you know how thats implemented btw?
07:21amalloyhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L624
07:21ddimathx
07:23ddimahaven't peeked into the code very much yet, so wasnt able to quickly find it. initially thought it might still be something different than just hardcoded shorthand
07:26Clome_I have a vector and I would like to apply a fn to each ele, this ele, when applied to this fn would return a vector. I would like at the end to have a map whos keys are ele of the original vector and values being vectors returned by the function applied on this ele.
07:26Clome_example (map #(do {% [% % %]}) [1 2 3 4 5]), now I get a seq of maps, and I would like to merge them all in one map
07:26Clome_Is this even the best way to do this?
07:30amalloy&(into {} (for [x (range 1 6)] [x (repeat 3 x)]))
07:30lazybot⇒ {1 (1 1 1), 2 (2 2 2), 3 (3 3 3), 4 (4 4 4), 5 (5 5 5)}
07:30ddimayou coult either do a (into {} (map ...) or you could do a (apply merge (map ...))
07:30ddimacould
07:30ddimasry
07:30ddimaand probably any other number of interesting ways ;)
07:31hyPiRion,(let [f #(repeat 3 %)] (reduce #(assoc %1 %2 (f %2)) {} (range 1 6)))
07:31clojurebot{5 (5 5 5), 4 (4 4 4), 3 (3 3 3), 2 (2 2 2), 1 (1 1 1)}
07:32ddimaamalloy: btw, why does the indentation suck so much in the jvm code? ;)
07:32amalloyrich is some kind of lunatic, ddima
07:32amalloyhe purports to like it that way
07:32ddimais that so? ;)
07:32ddimahehe
07:33ddimaat first i suspected those parts were generated or something, but nah
07:51anildigitalddima: nope not yet. . here is updated gist https://gist.github.com/anildigital/c3f47416b8986bd6b59b
07:55pyrtsaanildigital: (n - 1) -> (- n 1). There are no infix operators in Clojure.
07:55anildigitalddima: got it right https://gist.github.com/anildigital/c3f47416b8986bd6b59b
07:55anildigitalpyrtsa: thanks
07:56anildigitalif you use emacs.. what emacs plugins would help me to do clojure development.. I am already using cider, clojure-mode clojure-test-mode
08:06gunsAnyone have any tips for performance regression testing? I'm hoping there's already a test wrapper around criterium or something like that…
08:10TEttingerguns, I actually don't know what that is, but it sounds like something I could use... if I used unit tests <.<
08:11TEttingeranildigital, there's lots of ways to write a factorial in clojure. a fun one is:
08:11TEttinger,(reduce * (range 1 10))
08:11clojurebot362880
08:12TEttingererr needs to be incremented, the 10
08:12gunsyes, tests that scold you when you make things slower are a good way to keep things fast
08:12TEttingerthat's actually factorial 9, because range excludes the end
08:13anildigitalyep
08:13anildigital(defn factorialm
08:13anildigital [n]
08:13anildigital (reduce *' (range 1 n)))
08:13TEttingerdon't paste multi-lones in the channel please
08:13TEttinger*lines
08:13anildigitalbtw.. just for my knowledge... since when reduce is there in clojure?
08:13anildigitalI heard reducers were introduced couple years back
08:14TEttingeryou can define them in privmsg to clojurebot
08:14TEttingerwell
08:14TEttingerreduce is different from reducers
08:15pyrtsareduce has been there from the start.
08:15TEttingerreduce is a function that takes a collection and a function of two args, like + or *, and goes through and collects them into one value. it's been around since before 1.0
08:15anildigitalTEttinger: I sent it to clojurebot in privmsg .. does it respond back with pastie
08:15TEttingerreduced is a function that can short-circuit eval
08:15TEttingernot multiline uuhhhhh
08:16TEttingerhang on
08:16TEttinger,(defn factorial-m [n] (reduce *' (range 1 n)))
08:16clojurebot#'sandbox/factorial-m
08:16TEttingerlike that
08:16TEttingerIRC handles things on a line-by-line basis
08:16TEttinger,(factorial-m 9)
08:16clojurebot40320
08:16pyrtsaKrhm. ,(defn factorial-m [n] (reduce *' (range 1 (inc n))))
08:17TEttingeryeah, just copying his
08:17pyrtsaHeh, yeah.
08:17TEttinger,(defn factorial-m [n] (reduce *' (range 1 (inc n))))
08:17clojurebot#'sandbox/factorial-m
08:17TEttinger,(factorial-m 9)
08:17clojurebot362880
08:17TEttingerheyyy
08:17TEttinger,(factorial-m 90)
08:17clojurebot1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000N
08:17TEttingersnappy
08:18TEttingercapital N is for Big Integer
08:18TEttingercapital M is for Big Decimal
08:19TEttinger,(factorial-m 90.0M)
08:19clojurebot1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000N
08:19TEttinger,(factorial-m 90.5M)
08:19clojurebot135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000N
08:19TEttingeroh that's interesting
08:21TEttingerthe range makes reduce behave differently than (I think) the recursive solution on decimal inputs
08:21anildigitalfactorial of 9 was wrong above
08:21TEttingerfirst one yeah?
08:21anildigitalit is supposed to be 40320
08:21TEttinger,(* 1 2 3 4 5 6 7 8 9)
08:21clojurebot362880
08:21anildigital,(factorial-m 9)
08:21clojurebot362880
08:21anildigitalthat's wrong
08:21TEttingerI redefined it
08:21TEttingerwait
08:22TEttingerso factorial doesn't multiply by the number as an arg?
08:22anildigital,(defn factorialm [n] (reduce *' (range 1 n)))
08:22clojurebot#'sandbox/factorialm
08:22anildigital,(factorialm 9)
08:22clojurebot40320
08:22anildigitalthat's true
08:22TEttinger,(* 1 2 3 4 5 6 7 8 9)
08:22clojurebot362880
08:22TEttingerthat's what a factorial boils down to right?
08:22anildigitalTEttinger: that's factorial of 10
08:22anildigital,(factorialm 10)
08:22clojurebot362880
08:23pyrtsa,(factorialm 3)
08:23clojurebot2
08:23anildigitalwhat is best way to learn clojure syntax .. I am long time ruby programmer..
08:23pyrtsaYeah right.
08:24anildigitallet me know most interesting and fun book to learn clojure .. clojure programming feels like covering eveything.. but not that applicable
08:24TEttingeranildigital, you just get used to the parentheses after a while. editors with optional rainbow parentheses help match braces easier
08:24anildigitalTEttinger: I am long time user of emacs.. so paretheis is okay for me
08:25TEttingerok, then the syntax is just prefix
08:25TEttingerfunction first, then args
08:25insamniacI'm reading the Joy of Clojure right now, which I find pretty good for someone with no FP experience.
08:25shock_oneThere is a *file* var to get the current file's path. But how would I get its directory?
08:27anildigitalso Joy of Clojure is it?
08:27shock_oneanildigital: it's called RPN. Also, there is structural editing mode in Emacs for Clojure, I would recommend you to take a look at ti.
08:27insamniacI like it.. I also got Programming Clojure, but I left that one at work and haven't looked at it as much.
08:27TEttingerparentheses mean try to call the first item in this list. if it fails, (like if the first item is a number), it errors, but quote stops it from trying to call anything inside. that's why lists in clojure are '(1 2 3) instead of (1 2 3)
08:28anildigitalthere was Poignant's Guide To Ruby.. that was fun read..
08:28TEttingershock_one, minus the R in RPN
08:28anildigitalhope similar exists in Clojure world too
08:28anildigitalbtw how many Ruby devs are here?
08:28insamniacthere's also 4clojure.com which I like
08:28TEttingera lot of former rubyists actually
08:28TEttingerclojuredocs.org (is that right?) is ruby on rails internally
08:31pyrtsaHeh, I haven't seen anything similar to _why's Poignant Guide for Clojure. The closest I know of is for Haskell (known as LYAH).
08:36shock_oneanildigital: I know ruby.
08:37shock_oneAnd I don't consider Poignant's Guide To Ruby a very good material for studying. Funny, yes, but not helpful.
08:38shock_oneSo, how to get *file*'s directory. Nobody knows?
08:38anildigitalclojuredocs.org is so old now
08:38anildigitalsomebody needs to update it
08:41lnostdalTEttinger / TEttinger2 : yes, it was a circular symlink .... x)
08:41TEttingershock_one: *file* gets a File right?
08:42TEttingerhttp://docs.oracle.com/javase/7/docs/api/java/io/File.html#getParent()
08:42TEttinger,(.getParent *file*)
08:42clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getParent for class java.lang.String>
08:43TEttinger,(.getParent (File. *file*))
08:43clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: File, compiling:(NO_SOURCE_PATH:0:0)>
08:43anildigitalanything there like docco in clojure
08:43anildigitalbasically I want to setup up a clojure code snippet examples page
08:44TEttingeranildigital, what is docco?
08:44anildigitalhttp://fogus.github.io/marginalia/ ..
08:44anildigitaldocco like the one for backbone.js and underscore.js documentation
09:33anildigitalcan namespace be like (ns Hello Wolrd)
09:33anildigitalor (ns "Hello World")
09:34anildigitallooks like no
09:44rovar(ns (md5 "hello world"))
09:51anildigitalhttps://gist.github.com/anildigital/0fbdd70a2075db8dc17e what handler i need to provide in ring project.clj if my code is this
10:04anildigitalis getting this error.. ? any obvious error there? https://gist.github.com/anildigital/e34826a48143af3aa4a4
10:10anildigitalanyone has example code to show how to serve static html files using ring and compojure
10:15kzarI'm messing around trying to implement an example in the book I'm reading myself and the recursion is going wrong somehow. It's running out of heap space but weirdly when I chuck a println in the function I only get a printed output once.
10:16kzar(I would have expected the println to be called lots of times, because the recursive function is being called lots of times and therefore printed out tonnes of crap.)
10:17zerokarmaleftkzar: paste the code to refheap or something
10:17kzarI'd rather not it's pretty awful
10:18kzarI'm more asking how do you debug recursion gone-awry? I thought chucking in a println would elucidate but apparently not
10:18llasramkzar: It should
10:19kzarOK I'll paste but don't judge me heh
10:19kzarzerokarmaleft: llasram: https://gist.github.com/kzar/07067986085d63f274b9
10:24rovarwhere can one find more information about pods? It seems there was a big todo in late 2011 and 2012, and I haven't heard anything about them until Fogus' talk from Clojure Conj
10:25zerokarmaleftrovar: rhickey's keynote from conj '2012 talks about the idea briefly
10:25llasramkzar: I need to go eat, but I'll take a look when I get back if no one else has commented
10:25zerokarmaleftI'm not sure if there's an implementation that's fully baked
10:26john2xhow do I fix "Could not find artifact org.clojure:clojure.core.cache:jar:0.6.3 in central (http://repo1.maven.org/maven2/)&quot; when I try `lein deps :tree`
10:26john2x?
10:26john2xMy connection is fine.. and I can find it in .m2/repository
10:33zerokarmaleftkzar: I think you need to examine your base cases again
10:34kzarzerokarmaleft: Yes I see a few problems
10:34kzarI think it roughly worked I just underestimated how inefficient it was
10:34kzar(Which was the point they were making in the book)
10:34kzarI'm guessing
10:36zerokarmaleftkzar: map is lazy, which is why (println amount) doesn't output anything...it doesn't get a chance to because the recursion blows up before the first value can resolve
10:37kzarYea
10:37kzarzerokarmaleft: Updated with slightly better version
10:37justin_smithI'm gonna make a single serve page: whydoesn'tyourclojureprogramdoanything.com
10:37justin_smiththe only content will be "because map is lazy"
10:38kzarI'm not sure that's a valid URL
10:38justin_smithno, I'll have to refactor that runon
10:40kzarThis the best way to remove nil's from a sequence? (filter #(not (nil? %)) [nil nil 1 2])
10:40zerokarmaleftjustin_smith: y-u-no-eager.com
10:40justin_smithheh
10:40justin_smithkzar: keep
10:40justin_smith,(keep [0 1 nil 2 4 nil 5])
10:40clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/keep>
10:40justin_smitherr
10:40justin_smith,(keep identity [0 1 nil 2 4 nil 5])
10:40clojurebot(0 1 2 4 5)
10:40kzarjustin_smith: Why not
10:41kzar,(filter identity [nil 1 2])
10:41clojurebot(1 2)
10:41justin_smithone sec - I know I was going for something better than that here
10:42justin_smith((juxt (partial filter identity) (partial keep identity)) [0 1 nil false true 2 nil false]) ; kzar
10:42justin_smith,((juxt (partial filter identity) (partial keep identity)) [0 1 nil false true 2 nil false]) ; kzar
10:42clojurebot[(0 1 true 2) (0 1 false true 2 ...)]
10:42justin_smithoops
10:42justin_smithnotice keep lets false through
10:43justin_smithand it's a shorter word too!
10:46kzarHmm my version in the gist works OK for smaller things now except it creates a crazy nested sequence unnecessarily
10:47kzarOh because of the map I think
10:48llasramkzar: Do you want `mapcat` instead of `map`?
10:49kzarHmm well I want a sequence of sequences
10:50kzarSo the first time around I guess I want to use map and the other times I want mapcat... can't help but feel I'm doing this a dumb way though
10:50llasramIt's an expensive algorithm, but there's nothing fundamentally flawed about your approach to implementing it
10:52kzarGood to know, thanks
10:53llasramkzar: mapcat only concatenates the immediate results of the applied function. So if your base case returns a sequence of results (where each result is a sequence), then using `mapcat` will give you the concatenated sequence of all results (where each result is still a sequence)
10:54kzarllasram: Ah right of course, well again this looks ugly to me but it works OK now https://gist.github.com/kzar/07067986085d63f274b9
10:55anildigitalI need to serve static files in a directory. any solution in clojure with ring or compojure?
10:57llasramkzar: I don't believe you need the `(filter identity ...)`, and the formatting is slightly unusual, but what else bother you about it?
10:58llasramanildigital: http://ring-clojure.github.io/ring/ring.middleware.file.html
10:58justin_smithanildigital: yeah, there is a static file middleware for ring
10:58kzarllasram: Oh does the mapcat do away with the need for filtering away nil values?
10:59llasram,(mapcat (constantly nil) (range 10))
10:59clojurebot()
10:59mullranildigital: https://github.com/ring-clojure/ring/wiki/Static-Resources perhaps?
10:59llasramkzar: As long as none of your `options` are `nil`
11:00kzarllasram: Is it idiomatic to wrap options in a vector like I ahve there?
11:00justin_smithanildigital: I use ring.middleware.resource/wrap-resource
11:00anildigitalhttps://gist.github.com/anildigital/8325ea2381c0edf60939 wrote something like this .. but it's returning 'Hello Another World always"
11:00justin_smithwhich can also serve static assets out of a jar
11:00llasramkzar: To make the base case of a recursive algo be a 1-element sequence? Totally
11:01kzarllasram: OK I've sorted out the indentation - pasting from repl sort of ballsed it - does it look OK apart from the fact the thing I'm actually doing is dumb?
11:01anildigitaljustin_smith: how to use it in the snippet I shared
11:03llasramkzar: Oh, I missed the `lazy-seq` somehow -- you don't need that either :-)
11:03justin_smith(wrap-resource root) would work where you have (wrap-file root) - the only difference is that wrap-resource works for things inside a packed jar
11:03kzarllasram: I do in case I do (take 10 (change-ways 100 ....
11:04anildigitaljustin_smith: nope.. I have physical directory
11:04justin_smithanildigital: wait, the other difference would be not checking "user.dir" and just giving a path relative to the top level of your app
11:04anildigitaljustin I want to point to that directory .. which has html files
11:05justin_smithanildigital: I am saying it works for both
11:05justin_smithbut your wrap-file should work
11:05llasramkzar: `mapcat` already returns a lazy sequence. Unless I'm missing something, I don't believe it helps
11:05kzarWell I can't explain exactly why but I've tried with and without and it seems to make a difference
11:06llasramkzar: You're right -- it does matter! You learn something every day...
11:06kzar(Why does it matter?)
11:06anildigitalhttps://gist.github.com/anildigital/2de18198a0f203135174 justin_smith this is updated gist as suggested by you .. but it always prints 'Hello Another World'
11:06kzarOh I see maybe mapcat doesn't return a lazyseq
11:06kzar(Why not?)
11:07llasramNo, it does
11:08llasramOh, chunking, of course
11:08kzar?
11:08anildigitaljustin_smith: do you see any changes that needs to be done in gist so that it doesn't return 'Hello Another World' and starts serving files
11:09llasramNo, maybe not
11:09zerokarmaleftllasram: heh
11:11kzarllasram: Maybe because it's applying functions to the list that realises the list?
11:11justin_smithanildigital: don't specify it in terms of user.dir
11:11kzarEither way I've got to go get some food myself, thanks for the help
11:11justin_smithtry with root as "output"
11:11llasramkzar: np.... Thank you for the mystery to solve :-)
11:11kzarhaha
11:12kzarllasram: (I think if you type (source mapcat) it's pretty clear what's going on.)
11:12justin_smithanildigital: scratch that: make sure "output" is in your resources path, and then you can just use "" as root (you can set resource path in project.clj)
11:13anildigitaljustin_smith: as per https://github.com/mmcgrana/ring/wiki/Static-Resources what is your-hundler there..
11:13anildigitalI don't get it..
11:13justin_smith(-> #'handler (wrap-resource "public")) is the same as (wrap-resource #'handler "public")
11:14anildigitaljustin_smith: but if you see my handler just returns a response map
11:14anildigitalso it will always return that map... how will it return the files then?
11:14justin_smithbecause you are not setting your resource root properly
11:14justin_smithlike I said, it needs to be relative to your resource path
11:14justin_smithnot to the filesystem root
11:15anildigitalHere is another snippet https://gist.github.com/anildigital/352cf0a463420ea167fb
11:16justin_smithwell, is "
11:16justin_smithsorry
11:16justin_smithis "." in your resource path?
11:16anildigitalit always prints Hello Another World
11:16justin_smithwhat is your resource path, the default is "resources" but you can add other directories
11:16anildigitaljustin_smith: even if I replace "." with "output" .. it returns "Hello Another World"
11:17justin_smithby default the top level directory is not in the resources path, so "." will not work there
11:17justin_smithdo you understand what I am saying about the resource path? I feel like you are ignoring it
11:17anildigitaljustin_smith: okay... but my question is that in my code.. defn handler will always return map.. how (wrap-resource "output" ) will ever get executed
11:18justin_smithbecause it short circuits
11:18justin_smithit doesn't always call the handler
11:18anildigitalhttps://gist.github.com/anildigital/81044bef044667283bb1
11:18anildigitalhere is latest snippet
11:19zerokarmaleft,(time (dotimes [_ 1e4] (take 10 (mapcat (fn [x] [(identity x)]) (range 1e6)))))
11:19clojurebot"Elapsed time: 114.322084 msecs"\n
11:19zerokarmaleft,(time (dotimes [_ 1e4] (take 10 (lazy-seq (mapcat (fn [x] [(identity x)]) (range 1e6))))))
11:19clojurebot"Elapsed time: 4.773144 msecs"\n
11:19justin_smithis "output" in your resources-path? how many fucking times do I need to say resources-path? it is a thing you need to modify here!
11:19anildigitaljustin_smith: yes
11:19zerokarmaleftwow
11:19justin_smithwhat is your resources-path?
11:19justin_smithshow me that part of your project.clj
11:20anildigitalhttps://gist.github.com/anildigital/bf5af4c882b8d97cacda
11:20lgs32azerokarmaleft: that is a known problem. mapcat is not really lazy
11:20lgs32azerokarmaleft: due to it's use of apply concat
11:21lgs32azerokarmaleft: http://clojurian.blogspot.de/2012/11/beware-of-mapcat.html <- also has a lazy impl.
11:21zerokarmaleftlgs32a: cool, thanks for the link
11:23justin_smithanildigital: the resources-path is something you need to specify in project.clj
11:23shock_oneHere's a function that take a file's path and returns its parent folder. Please help me make it more concise.
11:23shock_one(defn get-parent [file-path] (->> file-path reverse (drop-while #(not= \/ %)) reverse (apply str)))
11:23justin_smithit determines which directories will be available for finding resources
11:23anildigitaljustin_smith: here is the code https://github.com/anildigital/clojurebyexample
11:24justin_smithhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L247
11:24lgs32azerokarmaleft: http://dev.clojure.org/jira/browse/CLJ-1218 <-- they consider it minor. I think they should just replace it.
11:24lgs32azerokarmaleft: given that currently it's semi-lazy, which can hardly be intended.
11:24justin_smithanildigital: what you need to do is specify a root for wrap-resource that is relative to one of the resource-paths
11:25anildigitaljustin_smith: okay ..
11:25justin_smithso if you have :resource-paths ["output"]
11:25justin_smiththen the root can be ""
11:26justin_smithsee my github/technomancy/leiningen link above
11:26justin_smithit explains in more detail, and shows an example
11:27anildigitaljustin_smith: changed that.. as you can see in https://github.com/anildigital/clojurebyexample but it prints 'Hello Another World'
11:28justin_smiththe resources-path is not part of the :ring key
11:28justin_smithit goes one level above
11:28justin_smithso :plugins ... :resources-path ... :dependencies ...
11:29justin_smithand not "/" for the root, just "" I think
11:29justin_smiththough that may not even matter
11:29lgs32acould an implementation expert shed some light on why OPs solution here even outperforms a reducer based solution (reducer based solution not included in link)? http://stackoverflow.com/questions/20914683/in-clojure-can-i-optimize-scans
11:29lgs32a(it also outperforms a simple reduce-based solution, even when freed from destructoring)
11:31anildigitaljustin_smith: https://github.com/anildigital/clojurebyexample added as separate key and above .. but it still prints 'Hello Another World'
11:32anildigitaljustin_smith: I think you are not getting what I am saying.. the handler is returning hardcoded response.. how will it ever serve static files?
11:32justin_smithanildigital: try changing "/" to "" in the last line of core.clj
11:33justin_smithyou changed it back to wrap-file
11:33justin_smithwrap-file does not use the resource path
11:33justin_smithwrap-whatever has the option of returning something without ever calling the handler
11:34justin_smithif you configure the wrap-file or wrap-resource properly they will return a static file and the handler never gets called
11:34anildigitaljustin_smith: as you can see in updated git repo.. I changed to wrap-resource .. it still doesn't work..
11:34justin_smithso if you keep your :resource-paths configuration and change wrap-file to wrap-resources it should work
11:35justin_smithOK
11:35anildigitalalso there is no wrap-resources .. there is wrap-resource
11:35anildigitalit's not short circuiting as expected..
11:36anildigitalif you could clone that repo and try on your side..
11:36justin_smithanildigital: http://localhost:3000/toc.html
11:36justin_smithI cloned it, that url works
11:37justin_smithwith your current codebase
11:37justin_smithhttp://localhost:3000/Hello.html
11:37anildigitalah
11:37justin_smiththat one also, with your current codebase
11:37anildigitalthanks a lot
11:37anildigitalyeah..
11:38justin_smithit would be more usual to put static resources in resources/output/ and then have "resources" in :resource-paths and "output" as the root for wrap-resources
11:38justin_smithbtw
11:38justin_smithbut at least we have something that works now
11:39justin_smiththe names are not important, what is important is that by having "" or "/" as the resource-root someone could navigate to anything in the top level of any of your jars in classpath (which may not be a serious issue, but is at least weird)
11:47anildigitaljustin_smith: somehow I want to make toc.html as the default resource.. will try to add there
11:49anildigitaland that is done by putting "toc.html" instead of ""
11:49justin_smithanildigital: you could set a redirect of "" to "toc.html"
11:49justin_smithor even do a request rewrite on the server side
11:49anildigitaljustin_smith: possibly yes.. but having toc.html as starting point is ok
11:52justin_smithanildigital: this could be adapted to turn "" or "/" into "/toc.html" https://www.refheap.com/22471
11:54anildigitaljustin_smith: cool
11:54justin_smithanildigital: the definition of tweak-handling was missing before, I just updated
11:54anildigitalI need to run the app like 'lein run -m clojurebyexample.core/app 4000' so that I can have it in Procfile
11:54justin_smithin your case you likely won't care about the request method, and you don't need to check .endsWith, since you have a literal route to rewrite, not a class of routes
11:54anildigitalbut by default there is no jetty.clj or anything. not sure how can I run it that way
11:55justin_smithyou can create a main that starts up ring
11:56justin_smithhttps://github.com/caribou/caribou-development/blob/master/src/skel/core.clj#L99 like this
11:57justin_smithwhere "server/run-server" would be replaced by jetty/run-jetty I think
11:57justin_smithring.adapter.jetty/run-jetty
11:58justin_smithwhich is basically what lein ring is doing anyway
11:58justin_smithbut having a real main function is better
11:59justin_smithalso, for dev lein works, of course, but for deployment you should create an uberjar
11:59anildigitalah.. not aware of all these..
12:00justin_smithprocfile makes me think you are talking about deployment scenarios
12:00anildigitaljustin_smith: yes.. deploy the same on heroku
12:00anildigitalhttps://devcenter.heroku.com/articles/getting-started-with-clojure
12:00justin_smithoh, heroku expects you to use lein doesn't it
12:00justin_smiththat's dumb, but I can't fix that
12:01justin_smithoh, wait
12:01justin_smithit does let you specify a standalone, good
12:01justin_smithso don't mind the above
12:02justin_smithso yeah, you need a -main function which starts the server
12:02justin_smithI think lein ring uberjar creates main for you though
12:02justin_smithif you still want to use lein ring
12:02justin_smithbut what I described / linked to above shows how to create the jar
12:02justin_smith*create the main function
12:06anildigitaljava -cp target/clojurebyexample-0.1.0-SNAPSHOT-standalone.jar clojure.main -m clojurebyexample.core.app doesnt work
12:07justin_smithyou should not need to specify clojure.main
12:07justin_smithand app does not start a server
12:08justin_smithfirst off, try "lein ring uberjar"
12:08justin_smiththen try java -jar target/<some-uberjar>.jar
12:08anildigitalhttps://gist.github.com/anildigital/6c95684c9d4849b9a33c done.. but gives error
12:08anildigitaljustin_smith: yep.. same thing
12:09justin_smithfor uberjar, you should not specify a :main in project.clj
12:09anildigitaljava -jar target/clojurebyexample-0.1.0-SNAPSHOT-standalone.jar .. this worked
12:09justin_smithoh, ok
12:10anildigitalbut with that http://localhost:3000/toc.html it's printing 'Hello Another World' only..
12:10anildigitalshort circuit code is not working
12:10justin_smithhmm
12:10justin_smithwrap-resource should be able to find content inside jars, that is the point of wrap-resource after all
12:11anildigitaljustin_smith: :(
12:11justin_smithI have deployed many webapps that do this stuff
12:11justin_smithit's just a question of getting everything configured properly
12:12anildigitalit would be great if this can be run without jar
12:12anildigitalmeans dev mode is ok
12:12justin_smithtry changing resource-paths to "resources", and change the root in wrap-resources to "output" and move output/ to resources/output/
12:13justin_smiththat would be closer to the usual setup
12:17anildigitaljustin_smith: keeping output as it is 'works' in lein ring server mode
12:17anildigitaldidn't try with standalone yet
12:21anildigitalokay that worked.. but now I need redirect headers so that instead of 'Hello Another World' .. it redirect to /toc.html
12:24justin_smithright, you should be able to use some variation on the funcitons I posted above
12:34anildigitaljustin_smith: somehow heroku needs $PORT to be passed from outside..
12:34anildigitaljava -jar target/clojurebyexample-0.1.0-SNAPSHOT-standalone.jar starts on default port 3000
12:37anildigitaljustin_smith: wow http://boiling-oasis-5467.herokuapp.com/
12:37anildigitaljustin_smith: I am trying to build something similar to https://gobyexample.com .. do contribute if possible
12:37anildigitalthanks a lot
12:37justin_smithcongratulations
12:43anildigitalhttp://clojurebyexample.com/toc.html
12:43anildigital\m/
12:53makuAnyone here using Zepto.js with Clojurescript? I am interested in using it with Chris Granger's Library, jayq. The reason being that Zepto can be compiled with The Google Clojusure Compiler in advanced mode.
12:55danno1n00b Q: Is the the meta character ^, analogous to annotations?
12:56lsdafjklsdmaku: i've been getting by with google closure library and a dom management library (om)
12:57makudannol: it is, but we usually call it metadata http://clojure.org/metadata
12:58dnolenmaku: haven't heard of anyone using Zepto.js, but why do you need to use it with jayq? Isn't the whole idea behind Zepto.js that you don't need jQuery?
12:58makudnolen: jayq is just a wrapper (uses jquery) since zapto and jquery have the same API, I was hoping to use the same wrapper.
12:59danno1thanks maku
12:59dnolenmaku: I would just give it a shot then.
13:00makudnolen: thanks, will do
13:06bvvd\whois rhickey
13:08jtoysilly question, in my ns I import java.util.Local, then call it like Locale/ENGLISH, but I am getting Caused by: java.lang.ClassNotFoundException: java.util.Local errrors, is there anything else I need to do to use this class?
13:09Tolstoyjtoy: (import [java.util Locale]), note the space?
13:09ivanalso Local != Locale
13:09hyPiRionjtoy: I would guess appending an e would help
13:09jtoydoh, yes
13:10jtoyI hate when that kind of stuff happens
13:10jtoyis it just me?
13:10TolstoyAh, I thought that was just a typo here. ;)
13:10hyPiRionnah, I hate it as well
13:11Clome_Exists something like this (-> a (fn1 b) (fn b)) => (fn2 (fn a b) b), just that puts "a" as the last argument to fn instead of the first one?
13:12ivan->>
13:13Clome_>_>
13:13Clome_thanks
13:13Clome_i will try it
13:13jtoyTolstoy: interesting name
13:15shock_oneI have some time interval in milliseconds, say 134000. How to convert it to "2 minutes and 14 seconds"
13:18hyPiRionshock_one: have a look at clj-time
13:18shock_oneAlready. It can only convert intervals to DateTime.
13:18hyPiRionOr, if you want to actually do it manually, I guess you can do something like
13:19shock_oneNo, I want to find some library, but go ahead.
13:19hyPiRionah.
13:19hyPiRionWell, then I'm not sure =/ I thought clj-time would provide some of that functionality
13:21shock_oneSomething like this http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words
13:29Clome_a hack (let [sec (/ 134000 1000) min (int (/ sec 60)) rem(- sec (* min 60))] (str min " minutes and " rem "seconds"))
13:30Clome_,(let [sec (/ 134000 1000) min (int (/ sec 60)) rem(- sec (* min 60))] (str min " minutes and " rem " seconds"))
13:30clojurebot"2 minutes and 14 seconds"
13:31llasramIt's surely in the underlying JodaTime library
13:38arcatanyeah, maybe Joda-Time's PeriodFormatter would be helpful?
13:45jergasonin clojure, does your declared namespace need to match the directory structure of your project?
13:46Clome_as far as I know yes
13:46noonianyes, because java does, plus your file names need to use underscores instead of hyphens
13:47Clome_be careful about "-" in the namespace. foo-bla => foo_bla.clj
13:47seangroveAnyone with a clue able to tell what might be causing this all of the sudden? https://www.refheap.com/06b8f72dc72f0cda8f72545ef
13:49Clome_you are allocating too much memory
13:49Clome_check for memory leaks or allocate more heap for your jvm
13:50nooniando you have :main in project.clj?
13:50xeqiseangrove: did you recently change your project.clj file or lein plugins?
13:51shock_oneI'm pretty sure it's not about lein, try to start repl in another project's directory.
13:52seangrovexeqi: No, not at all actually
13:52seangroveI've even reverted to a known-good checkout
13:52seangroveAlthough the stack trace is different now..
13:53TolstoyWhat happens with "lein deps :tree"?
13:55seangroveTolstoy: that runs, shows the dependencies
13:55seangroveshock_one: Interesting, looks like it happens elsewhere as well. Maybe something changed with my JVM while I was asleep. I'll look into it
13:55Tolstoyseangrove: Ah, well. I was guessing there was some crazy circular thing going on with one of the dependencies (if that's even possible).
13:57seangroveMaybe all it needs is a good restart and a warm hug. Might as well give it a try.
13:57xeqiseangrove: is that the full stack trace? I'd expect to see where `apply` was being called from?
14:15devnshock_one: you could use cl-format as well
14:16hyPiRionoh yeah
14:16hyPiRion,(require 'clojure.pprint)
14:16clojurebotnil
14:17shock_onedevn: it's pretty cool.
14:17hyPiRionhmm,
14:19shock_oneTolstoy: are you from Russia?
14:19Tolstoyshock_one: Nope. Oregon. ;)
14:21devn,(require '[clojure.pprint :as p])
14:21clojurebotnil
14:23devn,(p/cl-format nil "~D minute~:P and ~D second~:P" 3 30)
14:23clojurebot"3 minutes and 30 seconds"
14:23devn,(p/cl-format nil "~D minute~:P and ~D second~:P" 1 1)
14:23clojurebot"1 minute and 1 second"
14:23devnshock_one: ^
14:25shock_oneYes, thank you, I got it from the description.
14:26devngotcha. just trying to help! :)
14:26hyPiRionHm, is cl format turing complete?
14:26devnuh oh
14:26devna new swearjure approaches
14:27devnhyPiRion: by my googling "full CL format is Turing-complete"
14:27devnI don't know how close clojure's port comes
14:28hyPiRionyeah, the cl one can call functions, not possible yet in the clojure.pprint one
14:28chchjesus\
14:28devnhyPiRion: btw, i still need to jump into that nasty format string for clojure's pprint-code bug with #()
14:28devnhyPiRion: pprint needs a rewrite
14:29devnit's a mess
14:29hyPiRionhaha
14:30devnhyPiRion: you laugh, but im not kidding, you've been in there and seen it
14:30hyPiRionI should send them an email re: my patch
14:30hyPiRiondevn: yeah =/
14:30devni was looking at the git blame
14:30devnand tom faulhaber is basically the only guy to ever have touched it
14:30devnand i think for good reason
14:31devnso... now that I've said that, it's time to put my money where my mouth is and start refactoring it into something that resembles clojure 1.5 code
14:31devnhyPiRion: did you ever submit a patch on that #() bug?
14:32hyPiRionno, because I am not sure what would be correct to do right there
14:32hyPiRionbut it's not too hard to implement it
14:32hyPiRionjust need some response
14:33devnah, ill bump it then
14:33devndo you have a link handy?
14:34hyPiRionuh, no
14:34devnlol ill find it
14:34hyPiRion(I'm making dinner, so I'm a bit busy)
14:35devnhyPiRion: make extra, im coming over
14:36devnhyPiRion: in common lisp i wonder what the behavior of this particular issue with fn* would be
14:36devnhttp://dev.clojure.org/jira/browse/CLJ-1181
14:36devnnot that it is exactly 1 to 1 equivalent with clojure
14:37devnbut surely there's a similar situation
14:42NeedMoreDesuIs there a way to add metadata to any object, like adding it to numbers and still use them as numbers?
14:45dnolenNeedMoreDesu: not possible in Clojure, you can do this in ClojureScript via specify.
14:55NeedMoreDesuHm, I guess I need to use WeakHashMap to store meta myself
15:07stuartsierra,(identical? (Long. 2) (Long. 2))
15:07clojurebotfalse
15:21gfredericksI was just asking the other day about the implications of using proxy to get a Number that has metadata
15:21gfredericksnobody responded I don't think :)
15:24gfredericks,(let [two (proxy [java.lang.Number] [] (longValue [] 2))] (+ two two))
15:24clojurebot4
15:25stuartsierra(identical? (.longValue 3) (.longValue 3))
15:26stuartsierra,(identical? (.longValue 3) (.longValue 3))
15:26clojurebotfalse
15:27gfredericks,(let [two-foo (proxy [java.lang.Number clojure.lang.IMeta] [] (longValue [] 2) (meta [] {:foo :foo}))] [(+ two-foo two-foo) (meta two-foo)])
15:27clojurebot[4 {:foo :foo}]
15:41carkhello
15:43gfrederickshello
15:43carkI'm not clear about some details of core.async on the jvm
15:44gfrederickswhich details are those.
15:44carkfor instance, if i make IO and it blocks for some time, is it correct to use a thread block instead of a go block ?
15:45carkthread macro instead of go macro i should maybe say
15:45devncark: thread is basically promises and futures under the covers
15:46carkright, but are they there for this kind of scenario, just like send-off and send for agents ?
15:47carkalso, if i use the go macro, and there are many "automatons" doing computationally intensive stuff, am i safe to assume that there will be cores+2 threads when using the go macro ?
15:48devncark: check out this https://www.youtube.com/watch?v=enwIIGzhahw
15:49devnit will give you what you're looking for
15:49carkok doing this right now, thanks !
16:01pandeirois it possible to chmod +x files via lein new templates?
16:01gfredericksI think C-u C-u C-x C-e should eval the form, expect a string returned, then insert the raw string into the buffer unescaped
16:01gfrederickswould be nice for doing formatted stuff
16:04noonianpandeiro: you can use clojure.java.shell
16:04pandeironoonian: within the render function?
16:05noonianyeah, your main templates fn, after you call ->files
16:05pandeironoonian: perfect, thanks
16:06technomancyyou don't need to shell out to do +x
16:06pandeirotechnomancy: use java file api?
16:06technomancyright
16:06pandeirok, i just wasn't clear at what point i could do it, thanks
16:07technomancythe main thing to remember about Leiningen plugins/templates: "It's Just A Function" =)
16:08gfredericks(TM)
16:08technomancyunless it's a map
16:08pandeiroah the fine print...
16:08pandeiro:)
16:08technomancyoffer not valid in all jurisdictions; consult a physician before use if you are pregnant or on medication
16:17gfredericksside-effects may include, creating a jarfile, erasing your classfiles, or delpoying to clojars.
16:20pandeiroso i was expecting the path (.setExecutable (io/file path) true) to be the same as specified in the ->files fn above it... but that method call is returning false
16:20pandeiroam i doing something wrong?
16:24pandeirothink i maybe have to include the project name in the path as it is relative to the parent directory
16:25pandeirovoila
16:32rukorwhat happened to webfui
16:34jonasenrukor: https://groups.google.com/d/msg/reactjs/e3bYersyd64/qODfcuBR9LwJ
16:40rukorjonasen: ah ok. i just stumbled upon a video on webfui on youtube, and it seemed to have a lot in common with reactjs/om. Thanks.
16:42dnolenrukor: Om is more a less a more "serious" version of the WebFUI concept.
16:43rukordnolen: indeed.
16:43tim__Bronsa: do the latest tools.analyzer snapshots work?
16:44tbaldridgeBronsa: I'm getting "could not locate clojure/tools/analyzer__init.class" from my repl.
16:45Bronsatbaldridge: they work, yes
16:45Bronsatbaldridge: weird, how are you getting that error?
16:46tbaldridgeI'm getting that error because I'm an idiot. I never saved my project.clj file
16:47kzarI did (source let) and it seems to be defined in terms of let* but I can't find let*
16:47tbaldridgeI think my vacation was too long this year.
16:47llasramkzar: It's part of the compiler itself, in Compiler.java
16:47llasramA "special form"
16:47kzarah right, so that's not written in Clojure
16:48llasramNot yet -- Bronsa is hard at work on Clojure-in-Clojure though :-)
16:48kzar(Just in the book I was reading it said how let could be implemented in terms of a lambda so I was curious if that was how Clojure did it.)
16:48kzarHmm I wonder how many non-clojure functions you could get it down to
16:48tbaldridgekzar: it can be done that way, that's not to say that it "should"
16:49kzarsurely
16:49tbaldridgekzar: implementing let via fn would most likely be slower than a custom let that just sets a local
16:49kzarYea and also it might be more limited, say how you can define vars in terms of themselves with Clojure's let
16:49kzarsorry I mean in terms of previous vars in the let
16:51hiredmantbaldridge: it would be more complicated you would compile to lambdas, then when compiling lambdas have some heuristics about turning them in to jvm locals, etc, which actually a lot of papers on optimizing scheme compilers do similar things
16:52hiredmanwhich is a lot of work when you can just make let a special form
16:53tbaldridgeagreed
16:54marcopolo`I remember hearing work being done on a browser repl using websockets, anyone know where I can find that?
17:03arcatankzar: using previous vars is not a problem as you can transform that to nested let expressions
17:03korethHi! I'm a Clojure n00b. I am slightly confused by the "commute" function. The documentation implies it doesn't do retries (and the book "Clojure Programming" says so outright), but when I play with it in the REPL it does seem to retry occasionally. Is that expected behavior?
17:03kzarYea I was just thinking that arcatan
17:04juanpabloClojure noob here. How do I get the first element from a list of the form (1 2 3). What function can I use? (get list 0) fails, same with (first list). Seems like a dumb question, but my googling has failed me.
17:04cark,(first '(1 2 3))
17:04clojurebot1
17:04carkyou probably didn't quote your list
17:05kzar,(first [1 2 3])
17:05clojurebot1
17:05cark(1 2 3) is applying 2 and 3 to the function 1, which does not exist
17:05technomancykoreth: ref operations can always retry; not sure where the implications otherwise are coming from
17:06juanpablowhat if my list is not known at compile time? Adding the quote just gets me a compile error
17:06juanpabloDon't know how to create ISeq from: clojure.lang.Symbol
17:07cark,(let [l '(1 2 3)] (first l))
17:07clojurebot1
17:07carkmaybe you should post your function in a gist
17:09juanpabloIt's pretty simple. I have a list of the form ((10 11) (5 2) (3 2)) and want to filter that list using the first element of each list member
17:09marcopolo`koreth: can you give an example?
17:09korethtechnomancy: Thanks. I think I just misinterpreted what I was reading -- the "you must accept last-one-in-wins behavior" in the docs on clojuredocs.org implied to me that conflicting writes would just be discarded.
17:09carkjuanpablo: you obliviously have a little mistake somewhere, showing your coe would help
17:09carkcode*
17:10technomancykoreth: oh dear
17:10technomancykoreth: fwiw clojuredocs.org are not official docs; that is a very misleading way of putting it
17:11technomancycommute just means the order can change; there's no implication that anything "loses" necessarily
17:11juanpabloI'll try to figure it out myself. Clojure is a fun language :). If I fail I'll post back
17:12hiredman~alter
17:12clojurebotalter is always correct
17:12korethAnd my confusion started in "Clojure Programming" which says, "A change made to a ref by using commute will *never* cause a conflict, and therefore never cause a transaction to retry." But apparently that just means the *entire* transaction won't retry, not that *nothing* in the transaction will retry. So yeah, my misinterpretation.
17:12rukordnolen: I have a question regarding Om. Lets say I have a table component. Now I want to create calendar component that uses the table c\
17:12rukoromponent. No client of the calendar component will ever need to directly provide the table parameters so the data for the underlying tab\
17:12rukorle would not be present in the root tree as it is local to the calendar component. Previously, I could knock up the data structure from \
17:12rukorwithin the calendar component and call om/build with it. Now that om/build requires a cursor, what is the best way to handle this sort o\
17:12rukorf situation?
17:13hiredmanuse alter and commute is an optimization you can take advantage of in the future if required/possible
17:13dnolenrukor: if it's local to the component then doesn't om/IInitState, om/set-state! om/get-state not work for you?
17:13korethhiredman: Totally. Just want to make sure I understand what it's doing so I can use it correctly when the time comes.
17:14dnolenrukor: or is the issue that you want to build and don't want to take a cursor? I was going to allow this today.
17:14dnolenrukor: via an option I think.
17:15technomancykoreth: yeah I thought that commute transactions would never have retries, but I realized that might not always be true
17:15rukordnolen: for things local to the component, yes those will suffice, but need to use this data as the model for another component
17:15korethtechnomancy: That "you must accept last-one-in-wins behavior" is actually in the official docs too.
17:16korethOr at least I assume http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/commute is official.
17:16technomancyhuh, that's unfortunate
17:16rukordnolen: to elaborate, it may just be bad design on my part. the table takes as opts, the column specs, and as data, the actual data
17:17rukordnolen: the calendar only takes as data date.
17:17dnolenrukor: hm, I think it's legitimate use case
17:17technomancythe whole point of commute is that it's safe to use when a conflict doesn't result in one attempt "winning" and one "losing" but both harmoniously succeeding
17:17rukordnolen: so the calendar must build both the cursor for the embeded table component
17:18rukordnolen: without depending on the tree above it
17:18dnolenrukor: just to be extra clear, you want to be able to pass raw data to build right?
17:18juanpabloOnly thing I'm missing is pattern matching to unpack data structures.
17:18rukoryes
17:18dnolenjuanpablo: core.match
17:20rukordnolen: or would detached trees be a possible solution? where the calendar component can create its own root cursor, which it can update when there is an update in the cursor of its own date data, so that the underlying table component would be agnostic of pure data vs cursor
17:21dnolenrukor: hrm, I don't want to overthink it, and the details might change in the future
17:21dnolenrukor: I think the best thing for now is to provide build-raw for this use case.
17:21rukordnolen: ok
17:21clojurebotNo entiendo
17:26sritchieany graph database users here?
17:26sritchieneo4j, etc?
17:29kzarIs SICP worth reading for someone without a maths background? People seem to praise it so I'm giving it a go but the first chapter so far seems to be more about maths than code
17:29sritchiekzar: I don't have a maths background and thought it was great -
17:30sritchiekzar: it's more that the examples are algorithmish
17:30kzarYea
17:30kzarHmm I'll stick with it for a bit longer I guess
17:31sritchiekzar: just trying to have fun and get your mind expanded about functional programming?
17:31sritchieI always recommend working through the little schemer,
17:32sritchiebut no one seems to get through the whole thing
17:32sritchie(I did, but I did it with pen and paper, didn't have a computer for a few weeks. I think that was the right way)
17:33kzarYea, thought it might help as I've done some Clojure before but never fully grokked it all. I figured perhaps reading it might help. Aim for this year is to get to the point where I'm half productive in Clojure, not sure the best way to go about it though
17:33kzarI'm a programmer by trade and I'm generally not bad but I find it hard to get anything done in Clojure if I'm honest which is a shame as I think it's pretty great
17:35akhudekkzar: many people seem to recommend http://clojurekoans.com/
17:36kzarakhudek: Thanks, well I'll give those a go sometime.
17:36sritchiekzar: what kinds of stuff are you building with clj?
17:36sritchiekzar: yeah, just for getting started in clj, sicp is too heavy
17:36kzarWell currently nothing
17:37kzar(I think taking on another project in it might be a good idea.)
17:39sritchiekzar: yeah, pick up compojure and try a tiny webapp
17:39kzarI've done some webapps a while back using noir and stuff although apparently that's not used anymore
17:40ordnungswidrigkzar: there's libnoir now, IMHO
17:40eredanyone tried liberator? tempted to give it a go next time i write a rest api
17:40sritchieered: yeah, I have
17:40sritchieyeah, it's nice
17:41eredi really like what i've read about it
17:41eredand that flowchart that tells you exactly what it does when looks really helpful oto
17:41eredtoo*
17:42technomancyliberator is great, but I'd recommend starting with more basic ring and pulling it in once your requirements grow
17:43technomancythe raw ring abstraction is really great and worth getting familiar with
17:44technomancyI guess if you've used noir that might count
17:44technomancybut it obscures the simplicity of ring
17:44ordnungswidrigthe simplicity of ring is great. unfortunately http is anything but simple.
17:45kzartechnomancy: Yea I remember a lot of people (you maybe!) said that at the time, I think using noir was probably a mistake
17:46technomancyordnungswidrig: real-world http, yes. learning-project http... maybe so, maybe no =)
17:46ordnungswidrigtechnomancy: that's a point!
17:48technomancyseeing the progression of a project from raw ring to using liberator could give you an interesting perspective and probably help you appreciate what you get
17:49ordnungswidrigMy presentation at the conj used this approach.
17:49technomancyyeah, I enjoyed that a lot
17:50dnolenrukor: added experimental build-raw to master - will think about this more later and see if I can't see a better solution.
17:51ordnungswidrigtechnomancy: this should be mandatory for any library talk :) Hopefully shows the motivation^h^h^h^hright for existence
17:55ordnungswidrig1re
17:55rukordnolen: thanks
18:02sritchiehmm, google searches are making a heavy case for datomic instead of neo4j for graph modeling
18:02sritchieinteresting
18:02tbaldridgeit's really good for that sort of thing
18:13sritchietbaldridge: looks like it. I'm looking at storing GPS coordinates
18:13sritchiesimilar to strava - essentially dumping in a bunch of points of sensor data,
18:14sritchieso i can graph the info, and try to extract "pieces" - if someone's doing mile time trials, for example
18:17kzar,#{#{true false} #{true false}}
18:17clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: #{true false}>
18:17sritchieyup, not in a literal
18:17kzar,#{#{(= "true") false} #{(symbol "true") 'false}}
18:17clojurebot#{#{true false} #{true false}}
18:17S11001001,(random)
18:17clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: random in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:17S11001001ii eee
18:17CaptainLexWhy does ring.middleware wrap-multipart-params turn keys into strings instead of keywords?
18:18kzar,(rand)
18:18clojurebot0.7820192852765594
18:23devnis reduce-kv just a performance thing?
18:23clojurebotGabh mo leithscéal?
18:31thirdyFunctions like my-addition are usually created first in the REPL , and then tested with various inputs. Once you’re satisfied that the function works, you copy the test cases into an appropriate test file. You also copy the function definition into an appropri- ate source file and run the tests.
18:31thirdyas in copy paste?
18:38noonianthirdy: I prefer to just write them in a namespaced file, and keey running (use 'my.namespace :reload) in the repl
18:40thirdy,(doc use)
18:40clojurebot"([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."
18:40turtilcould someone comment on clojure and how low level it is? im learning Clojure, but i havnt really seen much about its low level-ness... i understand it hinges itself off the jvm, and therefore java, but im not a java developer, never really developed anything in java
18:40turtilcomments, opinions?
18:41noonianit's very high level
18:42noonianyou can use type hints and transients and things to get closer to raw java but it isn't as idiomatic to do so usually
18:43thirdynoonian: coming from java-world, ain't F11 (debug in eclipse), faster than what you mentioned?
18:43andyfturtil: It is a high level language, and while you can do some medium-level things for performance, the best way to get closer to the machine details for performance is to write Java or C and call that from Clojure, if you need it.
18:45noonianthirdy: maybe, i'm not very familiar with eclipse but that works for me. i also use light tables instarepl but lein repl is simpler to get started with
18:45thirdyin Java, I even use an eclipse-plugin to automatically call the corresponding test class upon saving your source code.
18:45tbaldridgethirdy: I have that in emacs ALT-` runs all tests
18:45nooniani think there are a few eclipse plugins for Clojure
18:47turtilnoonian: andyf thanks for that, that confirms my thoughts
18:48akhudekvw
18:48akhudekoops
18:49andyfturtil: The Benchmarks Game web site has some sample short Clojure programs for the benchmarks that are often within a factor of 1 to 4 times the run time of Java programs for the same problems, but those Clojure programs are not like ones people typically write in Clojure. Then again, the programs on that site are not typically what anyone would write in any of the languages represented.
18:49andyfhttp://benchmarksgame.alioth.debian.org/
18:50devntbaldridge: just finished watching your deep macros and go macro internals videos
18:50devnnice work
18:50tbaldridgethanks!
18:51devntbaldridge: it's funny, i've used the multimethod dispatch thing to build little JRuby interop toys, but i never emitted an AST-like thing
18:51devnthat was an ah-ha moment
18:51devntbaldridge: also, the core.async talk at the conj was fantastic
18:52turtilandyf: yeah i have been looking at that, i wasnt so much concerned with Performance, more like doing things with network bytestreams, and playing with the GPIO on Pi, or Pi, similar boards etc
18:53devntbaldridge: there has been some discussion on the overtone mailing list about using core.async -- it made me wonder about broadcast and multiplex in the core.async lab namespace. any idea on whether those things will creep into core.async or not?
18:54tbaldridgethose have been replaced with mult/mix in the main namespace
18:54devntbaldridge: sam aaron asked about one->many pub/sub capabilities
18:55devntbaldridge: ah, that would be helpful to know as someone peeking at source. they have subtley different docstrings
18:55tbaldridgealso in the main namespace now
18:55devnsubtly*
18:56tbaldridgewhich ones have different docstrings?
18:57thirdylearning lisp or clojure is a lot harder than a thought. it's like learning programming all over again. even though I'm already using functors in Java
18:58thirdyfunctors in Java as in org.apache.commons.collections.Closure
19:00devntbaldridge: the lab namespace's broadcast and multiplex are subtly different than mult and mix
19:00devnthe broadcast docstring read, to me, more like what i was thinking of at the time
19:00tbaldridgeyeah, the lab versions are pretty old, they were created to see what something like that would look like. Rich wrote the stuff in then main ns later on
19:01devncould lab's versions be blown away to prevent future confusion along those lines>
19:01tbaldridgeyeah, they should be remove
19:01tbaldridge *removed
19:02thirdyany good online class for Clojure, like from Coursera?
19:02logic_prog_(1) sign up for the scala one
19:02logic_prog_(2) get motivated to study clojure
19:03devntbaldridge: in any event, one more compliment and then i'm off, but: i think you've done a really great job with conj talk about using core.async. it would be cool to see the way you explained it moved into a mini guide or something.
19:03devnlogic_prog_: ha!
19:04logic_prog_tbaldridge: along what devn said, I liked your youtube videos on core.async
19:04devntbaldridge: i should have been more clear, one more compliment/request/suggestion ;)
19:05devna lot of what i've seen with core.async was like: 'look how great this is! it's wildly opaque!' simply knowing that promise/future was underneath (thread) was extremely important to my ability to understand what was happening
19:07devndescribing it in terms of things i understand != "read CSP by Tony Hoare"
19:07thirdylogic_prog_: I did search for a free online class, but none so far
19:08devnthirdy: there has been talk in the past about a clojure coursera course
19:08thirdyyep, i saw that in the google group
19:08devnthirdy: do you strongly value the structure of a course?
19:08thirdyI did watch this last night: www.youtube.com/watch?v=CvRGJGK09tc
19:09thirdydevn: I think so
19:09devncourses are funny things, you know. there rarely exists a one size fits all version of the material that appeals to everyone
19:09devna lot of people with previous background come to clojure with very specific goals
19:09devnso you start explaining how lisp works and half the audience yawns
19:10devnyou start talking concurrency and half the audience already understands a bunch of that material
19:10devnetc
19:12thirdydevn: haha i agree. however, a good basics course should be there
19:13ordnungswidrig1just a quicky: how do I enumerate all paths in a deep datastructure, i.e. everthing I can access with get-in
19:13thirdythe video I watch last night explained all the syntax of clojure. however, right now, i'm having trouble with namespaces
19:14ordnungswidrig1e.g. {:a 1 :b [:x] :c {:y :z}} => [[:a] [:b] [:b 0] [:c] [:c :y]]
19:14shokythirdy: http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols
19:14thirdydevn: imho, apparently, the guy in the video was wrong to say that, "You're ready to write code". Apparently, theres a swarm of functions/macros/special forms to master
19:16thirdyI'm correct to say that Clojure syntax is the tip of the iceburg? mastering def, defn, let, ns is the bulk?
19:17ordnungswidrig1thirdy: it's actually a very thin tip. like most lisps the syntax is small in clojure
19:17ordnungswidrig1thirdy: but don't get afraid
19:17thirdyordnungswidrig1: i was gonna type tip of the tip of the iceburg
19:18thirdyshoky: thanks, that should be a good watch, as all the other infoq i've watched previously
19:18ordnungswidrig1thirdy: that would be too extreme. And keep in mind: it's a beautiful iceburg!
19:20thirdyordnungswidrig1: yeah thanks. I'm just frustrated to find out that I can't write the Swing-based tool I want as easy as I thought it would be
19:26hiredmanisn't swing just going to be gross regardless?
19:35noonianhow can i compare cursors for equality in om?
19:36dnolennoonian: should just work
19:37noonianhmm
19:37dnolennoonian: for maps and IIndexed anyway.
19:38dnolennoonian: what types are you trying to compare?
19:38noonianmaps
19:39sritchieanyone here using the hidden input for DELETE reqs in compojure?
19:39dnolennoonian: not for cursors equivalence includes state and path
19:39dnolens/not/note
19:40noonianhmm, i bet the path is different
19:41dnolennoonian: perhaps it make sense to love state and path out of it like when cursors were done via metadata
19:41dnolens/love/leave
19:42noonianyeah, i'm just trying to compare pieces of them for value equality
19:48dnolennoonian: -value is technically part of the public api
19:48dnolennoonian: so you can extract the underlying value and compare those
19:49nooniandnolen: thanks, that works great
22:08m0gI have a very basic script that loads a bunch of files and put them in a map. My function extract-content-map seems except for the fact that it only handles 8 items in the list of files it is given (that is around 1k files). Any idea why it doesn't process the whole list?
22:08m0ghttps://gist.github.com/m09/8263780
22:19gfredericksm0g: nope. but I do know you don't need to use transients
22:19rovar_is there a right way to inject variables into an environment when executing a function?
22:19rovar_I want to provide the function creator some "implicits" which change based on the context of when the function was executed..
22:20llasramgfredericks, m0g: Also, you are trying to bash transients in place, which leads to the results you are seeing
22:20llasramm0g: You still need to operate on them functionally -- they just may use mutation as an optimization, so they aren't fully persistent
22:20gfredericksllasram: oh? does a transient update function not always return the original object?
22:20llasramgfredericks: It does not
22:21gfredericksllasram: fascinating
22:21llasramSo e.g. (doseq ... (assoc! ...)) is always a mistake
22:21gfredericksI'm curious why it would be useful not to
22:23llasramgfredericks: I don't know, but my guess is that it's related to the interface guarantee that the `transient` function will operate in constant time
22:23gfrederickso_O
22:23gfredericksokay time to crack open the java files
22:25gfredericksbbloom: ha I just noticed the conj edge case is duplicated in the transient variants; as it must be of corse
22:27gfredericksllasram: oh I think there's no reason for that to happen except when upgrading from ArrayMap to HashMap
22:27gfredericksthus the magic number 8
22:27bbloomgfredericks: you mean the conj a seq from a map thing? yeah, annoying
22:27bbloomi think at this point, that's forever :-/
22:27llasramgfredericks: That makes sense, although I feel like I saw a case where it was happening with ! and transient vectors in someone's code too
22:27llasrams,!,conj!,
22:31gfredericksis the obsceletization of programmers synonymous with the singularity?
22:32llasramI personally sure hope so
22:33rovar_the language preferred by the AI would most certainly be a lisp
22:33gfredericksllasram: why the strong feelings?
22:34llasramgfredericks: Oh, a friend just recently had me read Vonnegut's /Player Piano/, and the it ended up mostly annoying me
22:35llasramThe premise essentially involves people automating themselves out of their jobs, and the subsequent social results
22:35llasramBut I think it's pretty much impossible to automate away the job of automating things w/o hitting the singularity
22:36gfredericksyay we are forever employed until such time as we cannot plan for anyhow
22:37gfredericksso it annoyed you because you expect that most people can stay employed as programmers?
22:37gfredericksrather than massive unemployment?
22:42llasramhaha. Kind of. It presented the vast majority of people with nothing to do and hence doing nothing, to a degree I found almost offensively dismissive of the ingenuity of the average person
22:43npatten.join #emacs
22:43npattenwhoops!
22:43gfredericksnpatten: what a weird password
22:43llasramJoining another channel!
22:43llasram~guards
22:43clojurebotSEIZE HIM!
22:44npattenat least emacs enables clojure =)
22:44gfredericksclojure: powered by emacs
22:45seangroveNot for much longer, LT is steamrolling in
22:45seangroveYou watch!
22:45seangroveJust give it another ~20-25 years.
22:45gfredericksin the singularity all the AIs use LT
22:46tbaldridgeif LT ever figures out what it wants to be
22:46npattengood things come to those who wait?
22:46llasrampfft. Emacs is clearly a better interface for machine intelligences
22:46llasramEspecially with their ability to select key combinations unhindered by the limitations of physical hands
22:46gfredericksI watched some of rhickey's harmonikit talk; he made a sex joke about emacs
22:47seangrovegfredericks: Is it online yet?
22:47gfredericksI guess that's what happens when you let him not keynote
22:47npatten m-x foreplay
22:47gfredericksseangrove: yeah it's on youtube somewhere
22:47tbaldridgeyoutube.com/clojuretv
22:47seangroveAh, see it now, thanks
23:02bellkevhas anyone noticed austin's browser-connected-repl being broken in newer versions of clojurescript?
23:02bellkevI noticed that it works in v1847 and not in v2138
23:03bellkevso far, I've tracked it down to an error being thrown in cljs.closure/get-compiled-cljs in the new version but not the old...
23:04gfredericksif a polymorphic dispatch is closed, should a case be faster than a protocol?
23:04gfredericks(case on the class, I mean)
23:04gfredericksor maybe a condp with instance?
23:04tbaldridgegfredericks: condp probably not, it has to run p for every value
23:04tbaldridgeprotocols have some tricks to make them fast in places where you're always dispatching on the interface
23:05gfredericksthe interface is irrelevant here
23:05gfredericksall via extend-protocol
23:05gfredericksshoulda said that initially
23:06tbaldridgein that case there is still some caching involved.
23:06gfredericksso stick with the protocols?
23:06tbaldridgeUse protocols unless you can reduce it to case
23:06gfrederickswhat would the case type be?
23:06gfredericksa string?
23:06gfredericks(comp str class)?
23:07tbaldridge(case x val1 expr val2 expr2 ...)
23:07tbaldridgeonly works for keywords, ints and something else....
23:07gfredericksso probably not applicable here, right?
23:07gfredericksjust making sure I'm not missing some trick
23:08tbaldridgeyeah it depends on your use case I guess.
23:08tbaldridgeProtocols are pretty darn fast
23:10gfredericks$findfn :foo/bar "foo/bar"
23:10lazybot[]
23:11Bronsa,(str (.sym :foo/bar))
23:11clojurebot"foo/bar"
23:11gfredericksooh, clever
23:13gfrederickshmm
23:13gfredericksthat involves a call to String#intern
23:13gfredericksoh I guess just once
23:16unionxhello?
23:16clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline unionx
23:16Bronsalol
23:17gfredericks(inc clojurebot)
23:17lazybot⇒ 32
23:17unionx(inc clojurebot)
23:17lazybot⇒ 33
23:17unionx(dec clojurebot)
23:17lazybot⇒ 32
23:17unionxlol
23:18gfrederickswell that was worthwhile
23:20Bronsatbaldridge: AFAIK case works with everything, ints & keywords should simply be faster
23:21tbaldridge, (case x (atom 42) true)
23:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:21tbaldridge, (case 4 (atom 42) true)
23:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: 4>
23:21gfredericksBronsa: not classes though, I wouldn't expect
23:21tbaldridge, (case (atom 42) (atom 42) true)
23:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: clojure.lang.Atom@a6b3cd>
23:21tbaldridgeyeah...so not refs...dumb example
23:21gfredericks,(case '(atom 42) (atom 42) true)
23:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: (atom 42)>
23:21Bronsatbaldridge: that's because the test don't get evaluated
23:22tbaldridgeyeah
23:22gfredericksBronsa: ^ still didn't work
23:22tbaldridge,(case '(atom 42) '(atom 42) true)
23:22clojurebottrue
23:22gfrederickswat
23:22Bronsagfredericks: that's because.. ##(case 1 (1 2) true)
23:22lazybot⇒ true
23:22tbaldridgecase is really really odd, I try to only use it when working with ints or keywords
23:22gfredericksoh geez
23:23gfredericks,(case '(atom 42) ((atom 42)) true)
23:23clojurebottrue
23:23Bronsaso you're not actually quoting it, you're matching on 'quote and '(1 2)
23:23gfredericks,(case 'quote '(atom 42) :hahaha)
23:23clojurebot:hahaha
23:23gfredericksthat's a neat trick :)
23:24Bronsagfredericks: it'd work on classes, if you can embed one there either via #=(Class/forname "..") or via a macro
23:25gfredericks,(binding [*print-dup* true] (print-str *ns*))
23:25clojurebot"#=(find-ns sandbox)"
23:25gfredericks,(binding [*print-dup* true] (print-str Number))
23:25clojurebot"#=java.lang.Number"
23:26Bronsai.e (eval `(case Integer ~Integer 1)) will work
23:26gfredericksthat would be an interesting benchmark
23:28jergasonwhat is the standard clojure http library that everyone uses?
23:28jergasonerr http request library
23:29gfredericksclj-http
23:29jergasonthanks friend
23:30gfredericks(inc me)
23:30lazybot⇒ 3
23:33TEttinger,(print (double-array [0.0 1.1 2.2]))
23:33clojurebot#<double[] [D@10ef4d>
23:33TEttinger,(binding [*print-dup* true] (print-str (double-array [0.0 1.1 2.2])))
23:33clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No method in multimethod 'print-dup' for dispatch value: class [D>
23:34TEttingeroh that's interesting
23:34TEttinger,(defmethod print-dup (Class/forName "[D") [a out] (.write ^java.io.FileWriter out (str "#=" `(double-array ~(vec a)))))
23:34clojurebot#<MultiFn clojure.lang.MultiFn@f02ba0>
23:34TEttingerit doesn't seem to defmethod in a sandbox
23:34TEttinger,(binding [*print-dup* true] (print-str (double-array [0.0 1.1 2.2])))
23:34clojurebot"#=(clojure.core/double-array [0.0 1.1 2.2])"
23:35TEttingeroh, i just did it in privmsg...
23:39bvvd,((fn [n] (cond (= n 0) 0 (= n 1) 1 :else (recur (+ (- n 1) (- n 2)))) 4)
23:40clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
23:41bvvd,((fn [n] (cond (= n 0) 0 (= n 1) 1 :else (recur (+ (- n 1) (- n 2))))) 4)
23:41clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
23:41gfrederickstimeout
23:41gfredericksoh or that
23:41gfrederickstimeout if you give it 4N :)
23:43TEttingerthe (recur (+ (- n 1) (- n 2))) thing is pretty silly
23:43TEttingersince for 4 that recurs with 5, not going lower
23:44gfredericksunless the extremely strong goldbach conjecture holds
23:46gfredericks,((fn [n] (case n (0 1) n (recur (+ (- n 1) (- n 2))))) 4N)
23:46clojurebotExecution Timed Out
23:49bvvdhmm... i realized i was adding the 2, w/ (recur (+ (- n 1) (- n 2))) once u pointed that out
23:53gfredericks,(.nextProbablePrime (java.lang.BigInteger. "77777777777777777777"))
23:53clojurebot#<CompilerException java.lang.ClassNotFoundException: java.lang.BigInteger, compiling:(NO_SOURCE_PATH:0:0)>
23:53gfredericks,(.nextProbablePrime (java.math.BigInteger. "77777777777777777777"))
23:53clojurebot77777777777777777789
23:57bvvd,((fn fib [n] (cond (= n 0) 0 (= n 1) 1 :else (+ (fib (- n 1)) (fib (- n 2))))) 6)
23:57clojurebot8
23:59bvvdspent over an hour trying to get that to work, TEttinger observation 'for 4 that recurs with 5', made it obvious thanks!