#clojure logs

2012-10-10

00:20AtKaaZlancepantz are you still here? having some trouble running the example in Usage from readme, Unable to resolve symbol: with-graph in this context
00:21arohnerok, so I want to write a macro that returns a macro...
00:22AtKaaZarohner, sounds impossible
00:22arohnerAtKaaZ: pretty sure it's not
00:23AtKaaZokay but I want to know if it's possible how
00:23ori-lis there a way to get leiningen to stop littering repl-port files everywhere?
00:23AtKaaZarohner, eval comes to mind
00:25AtKaaZ,(defmacro x [] `(eval (defmacro y [] (+ 1 1))) ) ;this works
00:26clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
00:26AtKaaZor something=)
00:27AtKaaZhow do I unmap a macro?
00:27lancepantzAtKaaZ: the example is probably a bit out of date honestly
00:27lancepantzbut it's pretty basic if you look at the source
00:27AtKaaZlancepantz it's possible, I had to include one more use clause, but consider that I am quite new to clojure
00:28AtKaaZlancepantz, not really sure what I need to include in 'use' to get with-graph, without it giving me already defined errors
00:29AtKaaZ,(ns-unmap defn)
00:29clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/defn, compiling:(NO_SOURCE_PATH:0)>
00:29amalloyuhoh, did lancepantz recommend jiraph? it's sorta in constant flux, and ninjudd's official position is "unless you're so dedicated you want to help maintain it, jiraph will probably make you sad"
00:29lancepantzamalloy: i did
00:29AtKaaZconstant flux?
00:29lancepantzAtKaaZ: listen to amalloy on this one :)
00:29amalloyAtKaaZ: we keep changing shit instead of documenting it
00:30lancepantzAtKaaZ: you coould do a blame on the readme and checkout that sha!
00:30AtKaaZamalloy, like changing stuff inside jiraph or inside our own projects which use it?
00:31amalloywell, i definitely don't make changes inside your projects
00:31AtKaaZ2 years old part:)
00:31AtKaaZamalloy, ah my bad, I read, we recommend changing... :))
00:31AtKaaZI can't believe I actually read it like that
00:34amalloyanyway, jiraph has a lot of cool concepts, but it's all an undocumented morass and probably will be for six months
00:34amalloyi mean, functions and protocols have docstrings, but there's no coherent description of how to use it
00:35AtKaaZamalloy, do you think I should try jiraph or try doing my graph on datomic? I mean I only need nodes and directed edges, no metadata for either
00:35amalloydatomic is the hot new thing. give it a shot and then teach me how to use it
00:35AtKaaZlol
00:36AtKaaZyeah I'm quite excited going that way instead
00:39ynniv,(ns-unmap *ns* 'defn)
00:39clojurebotnil
00:39ynniv,*ns*
00:39clojurebot#<Namespace sandbox>
00:39AtKaaZynniv, thank you!
00:39ynniv,(defn foo [x] 1)
00:39clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
00:40arohnerAtKaaZ: https://gist.github.com/3863185
00:42AtKaaZthis was my test: (ns-unmap *ns* 'y) (defmacro x [] `(eval (defmacro y [] `(+ 1 1))) ) (x)(y)
00:42arohnerright, but eval is icky
00:43amalloyarohner: why are you using (resolve (quote ~fn-name)) instead of (var ~fn-name)?
00:43AtKaaZyeah but, I don't know much :) I started reading about clojure to learn it a while ago then took some long break and I forgot pretty much everything that I learned (which wasn't much), I'll try understand the gist
00:43amalloyor, if you prefer, #'~fn-name
00:44arohneramalloy: that's a good point
00:44AtKaaZ/msg nickserv info atkaaz
00:44AtKaaZerr how did that happen?lol
00:44AtKaaZright, ctrl+enter :)
00:45amalloy/msg nickserv identify *******
00:45AtKaaZyou put those there?=)
00:45AtKaaZamalloy, totally reminded me of this: http://www.bash.org/?244321
00:46amalloythat was the idea
00:46AtKaaZ:)
00:46AtKaaZyou think I would've done it if I didn't have that prev. knowledge? lol
00:47wingydo you call clj a compiled lang or interpreted lang
00:48AtKaaZcompiles to java bytecode
00:48wingyso compiled
00:48AtKaaZwell I wouldn't, I can't really evaluate that
00:48wingyinterpreted then?
00:48friothat's actually a tricky question
00:48amalloyalso, arohner, a ^:dynamic def is a lot safer than with-redefs, and it seems like it would work
00:48frioit's technically compiled, i guess.
00:49arohneramalloy: I'm using this for stubbing out tests, and some of the things I want stubbed out happen in futures
00:49AtKaaZit's like asking if a string is a value, rich says it is if it's immutable, but I could not have answered that before
00:49arohnerstubbing out, *during* tests
00:49arohneramalloy: but yeah, I wouldn't with-redefs production code :-)
00:50wingyAtKaaZ: what are immutable values called then?
00:50ynnivit's definitely compiled. there may be some circumstances when code is interpreted, but it isn't the common case
00:50arohnerynniv: no. clojure is always compiled
00:50AtKaaZwingy pleonasmic :)
00:50wingyto java bytecode!
00:50wingysuch a difficult word to learn
00:50arohnerat the repl, when you type (+ 1 1), the code is compiled, then the byte code is executed
00:51ynnivarohner: I defer to your certainty!
00:51AtKaaZarohner, that makes sense
00:51AtKaaZinteractive realtime compilation
00:52AtKaaZwingy, by the way that thing with the String being a value if it's immutable, got it from here: https://www.youtube.com/watch?v=-6BsiVyC1kM
00:53AtKaaZI can only hope I remembered it right:)
00:53ynnivclojure.org/evaluation says: "Clojure has no interpreter". That sounds pretty definitive.
00:53wingybut then the java bytecode is intepreted by the jvm?
00:53wingyso clojure is just a compiler you can say?
00:54wingycompiling to java byte code
00:54ynnivmost JVM's are Just In Time compiled
00:54wingylike coffeescript?
00:54wingyfor js though
00:54ynnivcoffeescript is more of a source -> source translator
00:54wingyynniv: a compiler then :)
00:54wingysince that is the essence of a compiler
00:55wingyfrom what i have read
00:55wingyAtKaaZ: good video! so recently
00:56wingyrich always looks so awesome
00:56AtKaaZi wonder if java can microprogram the cpu to execute bytecode directly just like cpu opcodes are really executing microopcodes or whatever they're called:)
00:56ynnivsource translation is practically somewhat different. CoffeeScript doesn't offer additional core functionality over JavaScript
00:57ynnivthe clojure language is substantially different from JVM bytecode
00:57AtKaaZhmm "Some processors can execute Java bytecode natively. Such processors are known as Java processors." well I didn't mean those :)
00:58wingyis clojure written in java?
00:58AtKaaZyes
00:58ynniva little
00:58ynnivit's mostly written in clojure
00:58wingycool
00:58AtKaaZJava+Clojure :)
00:58AtKaaZhttps://github.com/clojure/clojure/ 59% java it says, what do they know:)
00:58wingywrite clojure in clojure. david asks .. but how can you write a language with a non existing language?
00:59wingysteve answers, since we write that language initially using another language
01:00ynnivAtKaaZ: that's a ratio of source code characters. Java and clojure source code are not the same density
01:01AtKaaZynniv, I stand corrected
01:01wingythat has to mean 1.5% java logic
01:01wingyor even less when i think about the verbosity of java
01:01ynnivwingy: most of a lisp can be written using a small subset of the language
01:02wingyynniv: i remember i talked to you some months ago .. you were new to clj?
01:02ynnivdunno. i've been new to clj for years
01:02AtKaaZI'm new too, I welcome myself back again
01:03AtKaaZamalloy, I forgot to say, that wasn't rhetorical :))
01:04AtKaaZoh I just found something good: http://www.infoq.com/presentations/Datomic
01:04AtKaaZit's from 8 oct 2012
01:05wingyAtKaaZ: how do you find all that good stuff :)
01:05wingyill have a cup of milk and enjoy them now :)
01:05michaelr525hello
01:05AtKaaZwell I mean it was infoq, and I just randomly clicked on the right side
01:05AtKaaZit=I
01:05AtKaaZwish these were on youtube
01:06wingylol he is so cool :)
01:07AtKaaZI still can't start the video yet heh, that's why I wish they were on youtube
01:08AtKaaZgetting the epic NetConnection.Connect.Failed
01:11devnwee, the ML
01:52AtKaaZarohner, btw, I am glad I was wrong and that macro returning a macro was possible
01:53AtKaaZarohner, did you do any updates on that gist since then?
01:54arohnerAtKaaZ: just updated it
01:54AtKaaZarohner, thank you, looking forward to understanding it=)
02:05tomoj"returning a macro"?
02:06tomoje.g. ##(#'-> '(-> x y z) nil 'x 'y 'z) ?
02:06lazybot⇒ (clojure.core/-> (clojure.core/-> x y) z)
02:06AtKaaZlike: (ns-unmap *ns* 'y) (defmacro x [] `(eval (defmacro y [] `(+ 1 1))) ) (x)(y)
02:07tomojah. shouldn't need eval?
02:08AtKaaZyeah probably doesn't but I don't know much
02:08tomojthat evals the return value of defmacro, which is like ##(eval #'->)
02:08lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
02:08tomoji.e. a noop
02:08tomojoh, duh..
02:08AtKaaZyeah I just tested, it doesn't=)
02:09AtKaaZit makes sense, after all it's quoted
02:09AtKaaZhmm wait a sec=)
02:11AtKaaZI can't remember what it had to do, like when I call the first macro should the second macro be defined or returned to be defined later
02:12AtKaaZin the latter case, I wonder how's that possible
02:13AtKaaZok got it, I think: (ns-unmap *ns* 'y) (defmacro x [] `(quote (defmacro y [] `(+ 1 1)))) (eval (x))(y)
02:14tomojeval should generally be avoided
02:16AtKaaZ, (binding [*read-eval* false] (read-string "#=(eval (def x 3))"))
02:16clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
02:17AtKaaZ,(doc *read-eval*)
02:17clojurebot"; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"
02:17tomojhuh..
02:17AtKaaZi must be doing it wrong
02:17tomojclojurebot must be hackable?
02:18tomoj,x
02:18clojurebot3
02:18AtKaaZwhat? that worked?
02:18tomojI guess #clojure is just nice enough
02:18AtKaaZwhy did I get the error though?
02:18tomojno, I did it with [*read-eval* true] in a PM to clojurebot
02:19AtKaaZoh right, I don't wanna know :)
02:19AtKaaZbut it's supposed to err?
02:20AtKaaZI guess it makes sense, but for some reason I remember it wouldn't err before
02:20AtKaaZ,*clojure-version*
02:20clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
02:21AtKaaZmaybe on 1.5 it doesn't, must check
02:22tomojit errs if *read-eval* is false
02:22AtKaaZtomoj, ok, I then remember wrongly
02:22tomojI guess the example is confusing
02:23tomojshould say "will throw an error" or something
02:33AtKaaZdoes the same on 1.5.0, I don't know why I remembered someone using that with false and it wouldn't err
02:34AtKaaZhow can I find out what #= does?
02:35hyPiRion,(read-string "#=(+ 1 2)")
02:35clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
02:36AtKaaZ,(read-string "#=(+ 1 2)")
02:36clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
02:36hyPiRion,(binding [*read-eval* true] (read-string "#=(+ 1 2)"))
02:36clojurebot3
02:36AtKaaZwhat's #=() ?
02:37tomojheh
02:37AtKaaZ,(read-string "(+ 1 1)")
02:37clojurebot(+ 1 1)
02:37wingythis is a must see https://www.youtube.com/watch?v=-6BsiVyC1kM
02:37tomojit's the eval reader
02:37AtKaaZoh that's what causing the error
02:38AtKaaZ,(binding [*read-eval* false] (read-string "(eval (+ 1 2)")))
02:38clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
02:38AtKaaZ,(binding [*read-eval* false] (read-string "(+ 1 2)"))
02:38clojurebot(+ 1 2)
02:38AtKaaZ,(binding [*read-eval* false] (read-string "(eval (+ 1 2))"))
02:38clojurebot(eval (+ 1 2))
02:39AtKaaZok fair enough, I must've seen this variant :)
02:39tomojhmm
02:40tomojno
02:40tomojI don't know what's going on there
02:40AtKaaZmaybe it was this , (eval (binding [*read-eval* false] (read-string "(+ 1 2)")))
02:40AtKaaZ(eval (binding [*read-eval* false] (read-string "(+ 1 2)")))
02:40AtKaaZomg=)
02:40AtKaaZ,(eval (binding [*read-eval* false] (read-string "(+ 1 2)")))
02:40clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
02:41AtKaaZmaybe I'm better off admitting my memory deceived me, rather than making up some acceptable variant of what I think I've seen in the past:)
02:45AtKaaZwingy this one is good too: https://www.youtube.com/watch?v=EKdV1IgAaFc
02:45wingyAtKaaZ: sounds like a sequel to the previous one :)
02:56wingywhat does a sound model mean?
02:56wingyhear that in datomic sense all the time
02:57tomojso if you use e.g. jayq, will the closure compiler be able to remove parts of jquery you don't use?
02:58tomojoh, guess not
02:58AtKaaZwingy, like: Four Key Elements For a Sound Business Model. (ignore the capitalization)
02:59AtKaaZwingy, or this: Is that a sound business model? Central banks can print money. They can buy government bonds. So, the money spent by government seems to come from nowhere.
03:02wingyAtKaaZ: its an adjective?
03:02wingythought it was a noun
03:05AtKaaZwingy, yep you're exactly right: adjective
03:07wingyAtKaaZ: you are from the US :)
03:08AtKaaZI don't wanna say haha
03:25AtKaaZdo you think that doing something in pure clojure is better/faster than doing it so that it's also java compatible ? thinking of datomic here
03:32pyrmorning
03:33pyrhave people seen occurences of projects built with openjdk7 not working on openjdk6 ?
03:33AtKaaZwere they built for 1.6?
03:34pyri just lein uberjard :)
03:35pyrAtKaaZ: so there are compatibility flags to provide java with then
03:35AtKaaZcompiler compliance level if it's 1.7 then it shouldn't work on 1.6
03:36AtKaaZyou'd get something like unsupported major.minor version
03:36AtKaaZbut yeah there should be with lein, in project.clj not sure atm what
03:36pyrok, will investigate
03:38pyrjust to make sure, this applies to distributed jars also i guess, which means that no distributed jar on maven or clojars is supposed to be built with 1.7 yet ?
03:39AtKaaZthey can be built with 1.7 but the compiler compliance level can be less like: 1.6 , if it's 1.7 then shouldn't work
03:41AtKaaZpyr, something like: :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options" "-g:source,lines" "-encoding" "utf8"]
03:42AtKaaZand possibly also this: :java-cmd "c:\\program files\\java\\jdk1.6.0_31\\bin\\java.exe"
03:43AtKaaZ:java-cmd, if I remember right, is what lein will use to run/compile
03:44pyrack
03:47AtKaaZthere's also this if want to enable assert`s :jvm-opts ["-ea"] (btw, I'm speaking strictly lein v2)
03:48pyri'm lein v2 as well
04:10zoldar(dorun (repeatedly #(println (eval (read-string (read-line)))))) <= it there a shorter version for minimal repl? :)
04:15hyPiRion(loop (println (eval (read))))
04:16hyPiRion(while true (println (eval (read))))*
04:18wingyi wonder how rich sees stores like Redis
04:18wingythey update in place .. but they are fast .. good for session management?
04:19clgvwingy: the appropriate tool for each task? ;)
04:20wingyclgv: yeah .. i thought about the whole place vs fact thing in his presentations
04:20wingybut though for sessions its not that important i guess
04:20clgvwingy: you mean the datomic talks? I still have them on the "to watch" list.
04:21wingyclgv: they are really great
04:21clgvwingy: what I meant before was: choose the appropriate tool per task ;)
04:21wingythe value of values .. the database as a value etc
04:21tomojI think it would be fantastic to have a session store that wasn't update-in-place
04:22wingytomoj: how come
04:22tomojyou could implement one with redis of course, I think
04:22tomojjust like datomic is implemented on postgres and dynamodb
04:23wingytomoj: yeah
04:23wingytomoj: but why would time matter for a session store?
04:23janpaulbultmannDo you have a spontaneus idea for a function that splits a list into sublists by a predicate? Like partition-by, only not alternating.
04:24wingyyou can see when the user was logged in :)
04:24tomojI remember for example debugging session issues when using node.js and redis sessions
04:25tomojI think if all the session data were in something like datomic it would have been much easier to debug
04:27wingytomoj: https://groups.google.com/forum/?fromgroups=#!topic/datomic/wN36ZykKyrQ
04:27tomojhmm
04:33clgvjanpaulbultmann: you want only two parts?
04:39janpaulbultmannclgv, no, a split after/before every true/false ^^
04:42clgvjanpaulbultmann: you want it efficient? otherwise you build something together with take-while drop-while
04:42janpaulbultmannclgv, (defn my-part-by [f col] (map #(apply concat %) (partition 2 (partition-by f col)))) does the trick but this is rather ugly
04:43janpaulbultmannclgv, yeah efficient would be nice ^^ I don't get why partition-by splits when the value changes, it seeems rather obscure.
04:43clgvjanpaulbultmann: well that makes sense if your function is not a predicate and has more than 2 different values
04:44janpaulbultmannclgv, ah yeah right ^^
04:45clgvjanpaulbultmann: you can write it as recursion that builds the subvectors until the predicate returns true, then the subvector is added to the result and to new subvector is initialized with the current element
04:45clgv*"the new subvector"
04:46janpaulbultmannclgv, I'll probably do that :) I find it weird though that it is not in the std lib, seems commonly needed behaviour to me :/
04:47clgvjanpaulbultmann: I came to write one myself some time ago. but maybe its a good candidate for clojure.core.incubator
04:47clgvsplit-by-pred or something^^
04:47janpaulbultmannclgv, hrhr I'll consider submitting it ^^
04:48clgvbut maybe then it should be as general that it takes two elements of the input sequence
04:48janpaulbultmannclgv, hm?
04:48clgvI mean the predicate is executed with two elements of the input sequence
04:49clgvyour case would then be (fn [_ e] (your-pred e))
04:49janpaulbultmannand a split before would be (fn [e _] (your-pred e))
04:49clgvand it would be possible to split depending on both elements one before and one after the split
04:49janpaulbultmannawesome ^^
04:51clgvjanpaulbultmann: I hope you did already sign the CA so you can easily contribute to clojure.core.incubator
04:51janpaulbultmannclgv, no where, how, when ^^?
04:52clgvhttp://clojure.org/contributing
04:52janpaulbultmannah thanks ^^
04:53sw1nnclgv: why not wrap your predicate in something that keeps state of previous value?
04:53janpaulbultmannsw1nn, because state ;)
04:53clgvsw1nn: hmm? what do you mean?
04:54sw1nn(defn parter [pred]
04:54sw1nn (let [v (atom 0)
04:54sw1nn p (atom boolean)]
04:54sw1nn (fn [x]
04:54sw1nn (let [n (pred x)]
04:54sw1nn (if(= @p n)
04:54sw1nn @v
04:54sw1nn (do
04:54sw1nn (reset! p n)
04:54clgvuse a gist for that ;)
04:54sw1nn (swap! v inc)))))))
04:54clgv~gist
04:54clojurebotgist is http://gist.github.com/
04:54sw1nnhmm, better idea.
04:54clgvor refheap.com
04:56clgvsw1nn: the previous idea was to split based on a predicate and having two successive elements passed to the predicate for generality
04:57sw1nnhttps://gist.github.com/4684523a7063dc0fb08a
04:58janpaulbultmannwtf, partition by is recursive, and not with recur …
04:58sw1nnclgv: that gist's what you're looking for I think.
04:58sw1nnor should give you most of what you want
04:59clgvjanpaulbultmann: yes, it is a lazy sequence
04:59janpaulbultmannclgv, but doesn't that still mean a call stack?
05:00clgvjanpaulbultmann: no. you should read about lazy sequences
05:00janpaulbultmannclgv, noted I'll do that instantly ^^
05:00tomojwingy: https://github.com/hozumi/datomic-session
05:01janpaulbultmannsw1nn, yeah but using atoms just for this seems a little dirty :D
05:01clgvsw1nn: well, I would prefer an implementation without state as we discussed before. it's not that complicated.
05:01wingytomoj: cool
05:01wingybut the question is if dynamodb is fast enough for sessions
05:02clgvwingy: otherwise you can work around with an in-memory cache, I guess
05:02tomojpro supports memcached :/
05:02wingyah
05:02wingyneat
05:02wingyproblem solved then :)
05:03sw1nnjanpaulbultmann: atoms are very lightweight...
05:04janpaulbultmannsw1nn, yeah but they are state ;P
05:04sw1nnjanpaulbultmann: yes, but state in a closure - so not global
05:05clgvsw1nn: but thats no reason to use them everywere. if you have a new use case that can only be implemented that complicated by using a core function, you should consider implementing a new function that does directly what you want.
05:06sw1nnclgv: the 'new' function is gonna have to implement some of that anyway.
05:07sw1nnso I'd certainly have a function that took the pred directly.
05:07sw1nnrather than the clumsy (parter foo) bit
05:07clgvsw1nn: it would not need to use an atom at all. there is a straightforward lazy-sequence approach or a recursive one if he does not need/want lazy behavior
05:18sw1nnclgv: agree the atom(s) are messy, but reading back I think I misunderstood your whole problem anyway. you don't want new subsequences when the pred changes?
05:20clgvsw1nn: exactly. partition-by would work in that case. the split shall occur when the predicate is true
05:20sw1nnclgv: right so I've given you a bad implementation to the wrong problem ;-)
05:21wingyrich hickey is a little einstein in the digital world
05:21wingyhe wants the truth!
05:21sw1nnclgv: so split-with ?
05:22clgvsw1nn: that works only if you want only 2 parts. and is not very efficient
05:26sw1nn,(vals (group-by odd? (range 10))
05:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
05:27sw1nn,(vals (group-by odd? (range 10)))
05:27clojurebot([0 2 4 6 8] [1 3 5 7 9])
05:28sw1nnalthough no guarantees on the order of the two partitions I guess
05:28janpaulbultmannsw1nn, yeah the idea is to create a split for every case the predicate is true
05:29janpaulbultmannsw1nn, like the solution you provided
05:29clgvsw1nn: yep, group-by has a different semantic
05:29clgvjanpaulbultmann: did you manage the implementation yet?
05:30janpaulbultmann(our-split identity [false false true false true]) => [(false false true) (false true)]
05:30janpaulbultmannclgv, not yet I'm currently in a semi-meeting
05:32Kototamahi, i'm having troubles creating a clojurescript REPL
05:32Kototamaany ideas what the error is: http://paste2.org/p/2319045 ?
05:41sw1nnjanpaulbultmann: my implementation didn't give you that. I updated it, it's a little closer now. https://gist.github.com/4684523a7063dc0fb08a
05:41sw1nnbe interested to see a lazy-seq / atom-less implementation tho
06:07Kototamaactually I get the same error even if I only do "lein cljsbuild repl-listen"
06:23Kototamaok problem solved, probably an error in project.clj
06:25ptrlvare slides available for this talk? http://blip.tv/clojure/clojure-concurrency-819147
06:31clgvptrlv: the simulation code can be found online
07:35frawrHello Clojure irc
07:36sw1nnhello
07:37frawrDo you per chance have experience with duck-streams?
07:40tickingfawr, like so http://www.youtube.com/watch?v=2fpQQb0AvO8 ;)?
07:44frawrlooks like a wonderful experience, but no. http://freegeek.in/blog/2009/10/downloading-a-bunch-of-files-in-parallel-using-clojure-agents/ I was trying this exapmle
07:45frawrHowever the writer only writes an empty file
07:48_ulisesfrawr: keep in mind that that's from 2009
07:48_ulisesfrawr: things have certainly moved on
07:48tickingfrawr, where is he actually using the duck streams, I see them imported but not used :/
07:48frawrYes, I saw the date.
07:48frawrThey are used for the writer
07:49frawrd/copy
07:49tickingah right, sorry my fault, don't know why I'm so blind ^^
07:50frawrnm =)
07:50frawrI replaced the stream with a FileOutputStream, and that works, but I was wondering why it didn't work.
07:50tickingfrawr, it seems that duck-streams was integrated into clojure.java.io
07:51tickinghttp://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
07:51tickingthird paragraph
07:52frawrAh, IC. It's most likely not maintained anymore and I should try clojure.java.io then
07:53tickingfrawr, yes you will prbably find the descendatns of the functions there ^^
07:53frawrThanks a lot =)
07:53tickingyoure welcome ^^
07:58clgvI need a persistent linked blocking queue. The only way to go is implement something on top of persistentqueue, right? or are there alternatives?
07:59samratis anyone working with the dropbox API? or are there any up-to-date api wrappers?
07:59clgvI need that datastructure since I want to use transactions
08:21tickingAm I correct in assuming that using map in the core should be avoided and unrolled as much as possible to increase performance?
08:24_ulisesticking: what core?
08:24tickingclojure.core ;)
08:25_ulisesticking: oh, you're modifying clojure.core; way out of my depth here then :)
08:25tickingI picked up a few fragments from a dicussion some time ago arguing that core code often seems a bit cumbersome, which is because of of performance reasons
08:26_ulisesoh, right, gotcha
08:27ticking_ulises, I wanted to do a separate-at fn to make splitting seqs easier
08:29chronnoticking: Are you doing separate-at as an exercise?
08:30tickingchronno, I need it as well, but yeah there's also a little bit of fun involved ;D
08:31chronnoticking: he, ok. Spoiler alert, you might be interested in comparing your answer with split-at and split-with :-)
08:32tickingchronno, split creates 2 seqs, I want a variable amount
08:33tickingpartition-with would probably be a better name
08:34chronnoticking: ok, then maybe you're interested in one of partition, partition-by or partition-all
08:35tickingchronno: (partition-with (fn [x y]) (< x y)) [2 1 5 4 6]) => ((2 1) (5 4) (6))
08:36tickingThe cool thing about the separator fn is that you can use predicates to split before or after an occurence
08:37ticking(partition-with (fn [_ x] (pred? x)) …) includes the element for which the pred is true
08:38tickingsorry excludes ;)
08:38chronnoOk, I see :-)
08:38ticking(partition-with (fn [x _] (pred? x)) …) includes the element for which the pred is true
09:06AWizzArdInteresting. In my test namespace (called when doing a “lein midje”) I call my -main method and get the message “-main is not public”. I solved this by calling (#'-main arg1 arg2) vs. (-main arg1 arg2), but I still wonder why -main is not public…
09:14clgvticking: we had the same function discussion this morning
09:15clgvAWizzArd: no possible answer without a gist ;)
09:16clgvany idea on a persistent queue with blocking access?
09:21tickingclgv, sadly no ^^
09:22clgvticking: do you mean the last question?
09:22tickingyes ^^
09:23clgvthats bugging me. I have to use LinkedBlockingQueue but I cant modify it in a transaction since it might be retried.
09:23clgvbut modifying it outside a transaction might ruin consistency
09:24clgvhmm the only way to have something like a ref which signals
09:25chouserclgv: LBQs control access to themselves, so the only consistency problem would be between the LBQ and the refs, right?
09:25clgvyes.
09:26clgvor that I cant do (dosync ref-op1 lbq-op ref-op2) so that ref-op1 and ref-op2 are out of sync as well
09:26chouserref transactions are synchronous -- would it work to either do your LBQ work and pass it into the xaction, or take the return value of the xaction and use it with the LBQ?
09:29clgvchouser: I am doing some scheduling, thus I need to get a worker-id from LBQ then get its "worker data" from a ref, decide on a number of tasks and update "worker data" again
09:29chouserit may also be instructive to think about how agents and refs interact, since sending to an agent is a side effect.
09:31clgvchouser: right. so the question is whether I can incorporate an agent there correctly.
09:31chouserthat sounds like the LBQ work can be done before you start your xaction
09:31chouserso maybe I'm still missing something.
09:33clgvchouser: hm right I can factor out the get-data -> decision -> set data process. but I can not enforce the unique worker in LBQ constraint, yet
09:34clgvbut that might be doable with a lock on the LBQ I guess
09:34chouserhm. Did you describe this constraint earlier?
09:36clgvthe worker LBQ is like an event list. but I only want to have one event for each worker in it at a time since the state of the workers is in a ref and will consist of both events already when the first one is processed.
09:36clgvbut maybe simply doing nothing on "duplicates" would work too
09:38borkdudeIs it possible to be a programmer without drinking coffee?
09:38clgvborkdude: yeah, tea works as well
09:39chousercould you have a ref of a set of the worker ids that are in the LBQ, and then make sure everyone does a transaction to add to the ref before putting into the LBQ?
09:41clgvchouser: hm yes, that's possible
09:42chouseryou could bundle that into a "non-dup LBQ" object
09:43chouserto enforce your constraint, and make sure the when someone pulls an item it gets removed from the set
09:45clgvchouser: thx :)
09:45chousernp, hope it works out.
09:46chouserI'm often amazed at how many powerful concurrency tools we have with java+clojure, and how much careful thought is nevertheless required to avoid screwing it up.
09:47chouser...and that's all nothing compared to the minefield that is distributed concurrency. :-P
09:47clgvchouser: I do message passing for distribution ;)
09:48chouserwhat if the message doesn't arrive?
09:48borkdudeis there something like socket.io but based on clojure/clojurescript?
09:48clgvI am screwed performance wise but the tasks will get send to another worker after a timeout
09:49clgvbut RMI should secure the message arrival
10:32borkdudewow
10:32borkdudehttp://blog.datomic.com/2012/10/codeq.html
10:33@rhickeyI released codeq today http://blog.datomic.com/2012/10/codeq.html
10:34clgvrhickey: borkdude beat you.
10:34borkduderhickey great!!!
10:34sent-hilI installed clojure with maven, how do I find the repl and bin file?
10:34clgvwow nice idea. thats what I wanted for some time...
10:35borkdudeclgv it reminds me of that old microsoft video, which has similar ideas (versioning system that is code unit aware)
10:36clgvborkdude: since the "code bubbles" demo I thought who needs source files anyway, except for least common denominator for code exchange ;)
10:37borkdudeclgv it seems the world is moving away from file based thinking (light table)
10:37scriptorwell, I wouldn't say the world, but it's definitely an idea that's picking up
10:37@rhickeyIn this case you don't change your workflow or editr, just keep using git, occasionally import/analyze
10:37clgvborkdude: well, light table does not try to get rid of the files ;)
10:39clgvrhickey: so right now it's a pure external analyzing tool?
10:40clgvor maybe just the backend for one.
10:41XPheriorHey folks. I just introduced Clojure at a start up by means of web services. We have 4 web services right now. I split those services into 4 different repositories on Github. I also got Archiva running as a binary jar manager. They're a little apprehensive that it might be a pain in the butt to work on two different services at the same time, and therefore want to crush all the services into one repository.
10:41@rhickeyyes, just builds a db, then many tools can leverage
10:41XPheriorHaving a hard time articulating any more why that's a bad idea. Can anyone help a bit?
10:43ddaXpherior have you looked into git submodules?
10:43chouserrhickey: very cool.
10:44XPheriordda: I haven't. But I guess it's just that, I don't think working on two different repos is a pain in the first place.
10:45@rhickeychouser: thanks. we need to work on some more example queries so people can see how much fun it is
10:45ddaXpherior: I agree. what's the 'pain' that they are concerned about.
10:46sw1nnrhickey: queries like 'last 3 versions of this fn' etc?
10:46XPheriorrhickey: I netted an unbelievable amount of jobs offers after watching most of your talks. Thanks. :)
10:47XPheriordda: One sec. Looking through my chat log so I can get exact words for you.
10:47@rhickeysw1nn: yes, and which fns have the most churn etc
10:47chouserI've been fumbling around the edges of this idea (as have many others, I'm sure). The fact that git doesn't internally muck around with line-based diffs is so right.
10:47@rhickeyjkkramer: we hope to do just that
10:47jkkramersweet
10:47pyr"maybe some fancy browser-hosted UI built with ClojureScript talking to Datomic's REST API"
10:47pyr:)
10:50clgvhow about a clojure classloader with codeq backend? ;)
11:08frozenlockAnyone here tried clj-stripe? Any opinions/alternative?
11:30Goshany suggestion on which database library to use with clojure? I dont care if it is not the best in performance. I want it to be simple to use and to nicely intergrate with clojure syntax.
11:30GoshI will probably have at most 10k records in it
11:34nsxtGosh: which database are you using?
11:37algernonGosh: the stuff from clojurewerkz are great, they have libs for multiple dbs (http://clojurewerkz.org/)
11:38algernonthen there's also Datomic. Don't think you can be more idiomatic than that.
11:39clgvalgernon: clojurewerkz has "Monger" what else?
11:39lynaghkping: ohpauleez
11:39ohpauleezlynaghk: pong
11:39pyrclgv: cassaforte, though it's proably not what Gosh was looking for :)
11:39lynaghkohpauleez: do you know offhand why kibit uses functions for its rule substitutions?
11:40algernonclgv: neocons (neo4j), welle (riak), spyglass (memcached, if you count that as a db)
11:40lynaghkohpauleez: https://github.com/jonase/kibit/blob/master/src/kibit/rules/util.clj#L6
11:40OEis there any way to generate a list of numbers in clojure?
11:40OEsimilarly to haskell or ruby
11:40OE1..10
11:40clgvalgernon: ah ok, these are dbs as well. I just searched for "db" on that site ;)
11:40OEcould I do
11:40OE(reduce + [1..50])
11:40joly,(range 1 11)
11:40clojurebot(1 2 3 4 5 ...)
11:40OEah thanks
11:41jolygoes up to but does not include 2nd argument
11:41algernonclgv: ah, yeah. the descriptons could use some love, and briefly mention wtf neo4j and the rest are
11:42clgvalgernon: indeed :)
11:42ohpauleezlynaghk: Previously we had them in Vectors, but it was hard to compose them. Then Jonas changed the way we process them in core.logic. It was easier to clean everything up with functions that we could just apply
11:42ohpauleezas best as I can remember
11:44lynaghkohpauleez: hmm. hard to compose because you had name collisions between the uninstantiated lvars in different rules or something?
11:44ohpauleezNo, because writing raw rules was brutal, so it got abstracted
11:45ohpauleezthat's why we had the macro
11:45ohpauleezWhy, is it a pain point for some reason?
11:46lynaghkohpauleez: no, I'm just doing something similar for the ggplot rewrites and was wondering why the rule fns were needed. I am just using them raw and things seem to be working fine.
11:47ohpauleezIf you dig around in kibit code, it might be that it gets used in a threading expression
11:47ohpauleezor grouped in a way that only functions can participate
11:47ohpauleezIt's so that predicates and logic look the same, I believe
11:48ohpauleezbut I haven't gone into the core since jonas did a rewrite
11:48lynaghkohpauleez: okay, that makes sense. Seems like a good idea to me, so I might pick up the practice. Thanks for teh tip.
11:48ohpauleezCool
11:59antares_clgv: clojurewerkz also has an elasticsearch client, see http://clojureelasticsearch.info
12:04frozenlockEr.. is there a way to remove the stack trace from noir? In production mode I don't want to users to see it.
12:13sent-hilany good clojure install posts? i need nailgun + hookup to VimClojure
12:16dnolenfrozenlock: just remove it, libs like Noir configure the route wrapping for you based on prod / dev configuration.
12:16dnolenfrozenlock: oh sorry you're already using noir, I thought it did that for you.
12:17thorbjornDXsent-hil: do you have a nailgun client yet?
12:17thorbjornDXsent-hil: er, server
12:19sent-hilthorbjornDX: don't even clojure yet, originally installed with homebrew, but heard that wasn't so good
12:19sent-hilcloned the clojure repo from github, ran maven, not sure what to do next
12:20SegFaultAX|worksent-hil: What are you trying to do?
12:20sent-hilinstall clojure + nailgun
12:20sent-hilSegFaultAX|work: ^
12:20SegFaultAX|worksent-hil: vimclojure?
12:21sent-hilSegFaultAX|work: already got that installed
12:21frozenlockdnolen: Perhaps I'm just not using it correctly... do you know if I need do something else than 'lein run'? 'lein run production'?
12:21SegFaultAX|worksent-hil: Do you have lein installed somewhere (and accessible on the path)?
12:22thorbjornDXsent-hil: I would recommend checking out leiningen, and dropping [vimclojure/server "2.3.6"] into :dependencies
12:22sent-hilSegFaultAX|work: yep
12:23SegFaultAX|worksent-hil: Have you downloaded the most recent server jar?
12:23sent-hilSegFaultAX|work: of clojure?
12:23SegFaultAX|worksent-hil: Nailgun.
12:24thorbjornDXsent-hil: https://github.com/sattvik/lein-tarsier may be helpful
12:26sent-hilSegFaultAX|work: i'm not able to find nailgun, help please?
12:26SegFaultAX|worksent-hil: You must be new here. Go with thorbjornDX's suggestion.
12:26fckwHi there. In my Compojure defroutes I would like to do the following: (GET "/hello/:user" [user] (str "You have asked for " user))
12:27fckwBut this does not work (I'm using Compojure 1.1.0).
12:27fckwCan anyone explain me why? All the tutorials say this should work.
12:27fckwMy URL is then http://localhost:8080/hello/foo
12:28fckwNote that I can do both a GET without destructuring and a POST with destructuring using {params :params}.
12:32SegFaultAX|workfckw: Is that not the URL you were expecting?
12:33devthgiven a fn, is there a way to find which source file it's in and which line? been poking around with source, find-ns, meta, but no luck so far.
12:34technomancydevth: no, you need a var for that
12:34fckwyes
12:34dnolenfrozenlock: don't know I don't use noir, but I saw that in the source. Might want to ask on the noir ML.
12:34SegFaultAX|workfckw: Then what's the problem?
12:35devthtechnomancy: that's fine, i can use a var
12:36technomancydevth: see clojure.repl/source, I think
12:36hiredmanor just call meta on the var
12:36hiredman,(meta #'+)
12:36fckwI don't know what the problem is. I simply only ever receive "Page not found".
12:36clojurebot{:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 920, :arglists ([] [x] [x y] [x y & more]), ...}
12:36fckwWhich is my default fall back if no url matches.
12:37fckwI don't get an error message or anything.
12:37Bronsahttps://github.com/Bronsa/neurotic i just added defrecord support
12:37sent-hilSegFaultAX|work: thorbjornDX: got it work, thx!
12:37fckwThought, maybe this has changed in a newer Compojure version?
12:37sent-hil*working
12:38devthhiredman: ah, maybe it wasn't working for me because i loaded my ns into a repl. shows :file "NO_SOURCE_FILE"
12:38thorbjornDXsent-hil: awesome! <leader>el <leader>ef <leader>eb will prove pretty useful
12:38devthfor my own vars, not clojure.core
12:38devthtechnomancy: thanks, checking out source
12:38fckwIt's not that the URL should be something like http://localhost:8080/hello?=foo
12:38fckw?
12:39sent-hilthorbjornDX: sweet!
12:40devnhm, can't seem to get codeq to work
12:40fckw??? Now it works.
12:40devnIllegalArgumentException No implementation of method: :extrel of protocol: #'datomic.datalog/ExtRel found for class: datomic.api$db clojure.core/-cache-protocol-fn (core_deftype.clj:533)
12:41fckwOh, dear, sometimes I'm feeling stupid.
12:41fckwMaybe I forgot to reload my file when I restarted the server?
12:42pandeirowhere should this print in nrepl.el? (future (while true (Thread/sleep 1000) (println "hello")))
12:44fckwThat's weird. I am working with CCW in Eclipse using a nREPL. When I change only the defroutes function and restart the server, my changes are nowehere. But when I reload the whole file and restart the server, there are my changes.
12:46pandeirofckw: noir saves the routes in an atom
12:47fckwI am not using noir (yet) - only Compojure and Ring.
12:47fckwBut maybe Compojure does the same. This might explain the strange behavior.
12:50casion,(conj (array-map :a 1 :b 2) [:c 3])
12:50clojurebot{:c 3, :a 1, :b 2}
12:50pyrhhoHi. I have a ring question. I have a ring app starting an embedded jetty server, but I'd like to mount another servlet (com.yammer.metrics/metrics-servlet AdminServlet) into it. anyone know how to do that? or is there a better way of integrating that with my app?
12:50casionwhy does conj prepend to an array-map?
12:51fckwThanks guys, need to quit again.
12:51technomancycasion: order in array-maps is an implementation detail
12:57TimMccasion: There is no "prepend" with maps.
12:57casionTimMc: that's what I thought actually, however it seems to be a consistent result with any variation of the code above
12:58casionTimMc: using a hashmap shows the unordered behavious right away
12:58casionso I wasn't totally sure what I'm looking at
13:02pandeirovery weird: (future (mapv #(println %) (range 10))) ;=> prints to *nrepl* while (future (doseq [n (range 10)] (println n))) ;=> prints nowhere
13:21jsabeaudrypandeiro, doesnt that have to do with laziness?
13:21pandeirojsabeaudry: doseq isn't lazy though
13:21pandeiroso i would say no
13:23ivanpandeiro: I would guess it's because the mapv runs faster
13:23duck11231the latter one prints in lein repl
13:24pandeiroi think it's a specific nrepl.el issue
13:24ivanI see https://www.refheap.com/paste/5655 in clj-swingrepl
13:24pandeirohttps://github.com/kingtim/nrepl.el/issues/83
13:25duck11231I just tried these in the repl, and the first one returns the future before printing, the second prints then returns the future. (may just be the timing of those runs)
13:27pandeiroduck11231: using nrepl.el?
13:27duck11231let me try that
13:28pandeirohmm, maybe it is fixed in nrepl.el 0.1.4, i was using 0.1.3 ...
13:29duck11231yeah, using nrepl, in both cases they print
13:30pandeiroduck11231: thanks, working for me now with the upgrade too.. wish there was a way to auto-upgrade elpa packages
13:30jsabeaudryI'd be extremely surprised there isnt
13:31pandeirojsabeaudry: i use a snippet from technomancy's emacs config that iterates over my pkgs on startup and installs them if they're not there... maybe that can be extended to check versions
13:32technomancyyeah it's not included because it's like four lines, and half of that is just listing out your packages
13:40pandeirotechnomancy: how do you deal with upgrades, out of curiosity?
13:40technomancypandeiro: M-x package-install
13:40technomancyI've never felt the need to make sure everything is up to date
13:41technomancythis way if something breaks I have a better chance of figuring out what it is
13:41sw1nnM-x package-list-packages then U marks packages for upgrade and you can review install/delete
13:45sw1nnpandeiro: Is that what you're after?
13:45jsabeaudrysw1nn, programmatically
13:48duck11231I'd like to be notified when I start emacs (or once a day) that X packages can be upgraded
13:48duck11231I'll do it manually
13:53pandeiroyeah that would be the best, just a notification
13:53pandeirocould even be in the form of a y/N prompt
13:57pandeirocemerick: ever noticed java.net.URLConnection/guessContentTypeFromName can't recognize a javascript file!?
13:58antares_pandeiro: if you need to guess content types, use http://github.com/michaelklishin/pantomime
13:58antares_pandeiro: it is not magical and won't detect JS if you just give it a stream, but for most common formats and sane filenames it works flawlessly
13:59pandeiroantares_: thanks, it's that clutch has it builtin b/c clj-http or couchdb need it, i think
14:00pandeiroantares_: it's weird b/c clutch delegates to the class i mentioned above, and has an exhaustive mime.types meta info file that includes javascript, but it returns nil
14:15TimMcantares_: It works 100% of the time 60% of the time? :-)
14:20ibdknoxrhickey: why did you shell out instead of using jgit?
14:21@rhickey_don't know enough about the veracity of jgit
14:23@rhickey_ibdknox: do you have any experience with it?
14:24ibdknoxrhickey: I've used it with some success. Haven't done anything particularly crazy with it - though it is what eclipse uses (for what that's worth)
14:25ibdknoxrhickey: it's rather poorly documented, but seems to be fast and has been accurate for everything I've done with it. I'd imagine something as fundamental as getting commit information is pretty safe.
14:26ibdknoxrhickey: I figured I'd try to replicate the shell stuff you did in codeq with it and see what happens. My hope is it's a lot faster.
14:26@rhickey_ibdknox: happy to take a patch (er whatever) with that if it proves to be so
14:27@rhickey_is there javadoc?
14:28ibdknoxrhickey: http://jgit.info/javadoc/
14:28@rhickey_yikes
14:29ibdknoxhaha
14:29ibdknoxyeah
14:29ohpauleezhaha best reaction ever
14:29antares_there is a Clojure layer on top from beanstalk (the company)
14:30@rhickey_I bet jgit more code than trudging through the git output, but should be faster
14:30antares_https://github.com/clj-jgit/clj-jgit
14:30wingyif i make a query in my Datomic Peer, does Datomic have to fetch the whole database from the storage server (DynamoDB) to be able to query against it?
14:30wingysince the data stored in the storage server is just a blob
14:30ibdknoxrhickey: It might not be as much as you think, this opens a file from a commit: (.getBytes (.open repo (.getObjectId (TreeWalk/forPath repo "b/test.txt" tree) 0)))
14:31ibdknoxrhickey: either way, we'll see :)
14:31@rhickey_ibdknox: ok!
14:32@rhickey_wingy: nope, what is stored in storage is an index tree, only those portions needed are fetched
14:40wingyrhickey_: it is using multiple key value pairs in storage to store this index tree?
14:41wingycool that you can store an index tree in a key value store
15:08antares_can anyone think of a good example of a JDK interface to implement for the clojure-doc.org Java interop guide?
15:12pjstadigjava.io.Closeable
15:13pjstadigused with a with-open block or something
15:14antares_pjstadig: this is for a section on reify, to be specific
15:15antares_I am thinking java.util.Comparator is decent candidate. java.io.Closeable is small and easy to follow but I can't think of a good example to use it with
15:16pjstadigwe use reify to wrap a seq, fn pair in a closeable interface that can be used with with-open
15:17pjstadigalso to pair an inputstream with a function that gets called on close
15:17dgrnbrgtechnomancy: Why can't I invoke clojure-find-ns from outside of clojure-mode.el?
15:17pjstadigbut that uses proxy, not reify, since inputstreams must inherit an abstract class
15:20antares_pjstadig: I am going with java.io.FilenameFilter for one example, since it is small enough to understand for noobs and is not covered by clojure functions out of the box
15:21pjstadigthat sounds like a good example
15:21pjstadigan interface with a single method
15:24pisketti_Question: is there a clojure lib for handling zip files?
15:24dgrnbrgpisketti_: you can just use java.io.zip
15:24dgrnbrgit's a java lib
15:28pisketti_dgrnbrg: mmmkay. thanks, I'll take a look. So far haven't found any examples
15:28dgrnbrgpisketti_: http://docs.oracle.com/javase/6/docs/api/java/util/zip/package-summary.html
15:29dgrnbrgyou can create zipfile objects, iterate through the entries, read them
15:30pisketti_oh, you meant that one. Yeah I've used java.util.zip.ZipFile for some stuff but was hoping to find a clojure wrapper or something
15:31frozenlockpisketti_: https://github.com/Raynes/fs/blob/master/src/fs/compression.clj
15:31pisketti_but thanks anyway, I'm sure those will get the job done
15:33pisketti_frozenlock: ty. I already use fs.core. Didn't even cross my mind that fs.compression might be useful as well :)
15:47frawrHeey, is there a function for vecs that i can use to transform ((a b c . . .)) into (a b c . . .)
15:52honkfestival,(flatten [[1 2 3]])
15:52clojurebot(1 2 3)
15:52honkfestivalfrawr: ^
15:53TimMchonkfestival: Love the name, but not the advice.
15:53frawrI see now that I can just reorder the statement and use apply
15:53TimMcfrawr: 'first would do that for you.
15:54TimMcOh, you mean you want to call 'a on the rest of the args?
15:54TimMc~flatten
15:54clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
15:54honkfestivalTimMc: neat, thanks
15:55TimMchonkfestival: Are you in NY, MA, WA, TX, or RI?
15:55honkfestivalON, Canada
15:55frawrYeah, I get a bunch of items (a k-v pair as a vector) out of a for comprehension, and i want to make a map out of these
15:55honkfestivalbut I stole the name from the one in MA
15:56TimMchaha, OK
15:56hiredmanfrawr: (into {} ...)
15:56S11001001frawr: ^^hiredman
15:56frawrPerfect!
15:56frawrthank you all
15:56frawrlooks a lot less convoluted too. thanks
15:57TimMc(into {} (for ...)) is a pretty common idiom.
15:57Sgeo,(doc mapcat)
15:57clojurebot"([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."
15:58SgeoBasically >>= on sequences
15:58frawrStill quite new to clojure, have been trying for quite some time, but i find it quite hard to get into still
15:58SgeoErm, hmm
15:58Sgeo<<=
15:58SgeoErk
15:58Sgeo=<<
15:59frawrVery enjoyable experience though. Raises a lot of interesting questions with every new statement. Keeps you on your toes.
15:59antares_frawr: some are working on clojure-doc.org to make it easier on folks like you.
16:00frawrI bought the joy of clojure, and i like it a lot, but it's not a referece book.
16:01antares_frawr: by the way, we are looking for someone to contribute the guide on books ;) (just a listing of books on Clojure in reverse chronological order)
16:01frozenlockIn compojure/hiccup, will a 'submit button' send the data of every 'form-to' in the page, or only the current 'form-to' in which it's located?
16:01frawrthis keeps happening to me: Oh yeah, they explained how to do x in there, and then i can't find it back
16:03frawrFor clojure-doc.org?
16:04amalloyfrozenlock: that's not a hiccup or compojure question at all, it's an html question
16:04frozenlockindeed
16:06frawrThe site looks pretty nice
16:16frawr(defn distsq [from to] "calculate the distance between 2 vectors" (letfn [(square [n] (* n n))] (reduce + (map #(-> %1 (- %2) abs square) from to))))
16:16frawrSomehow I get the feeling I could do that cleaner. Without a letfn
16:17antares_frawr: looks good to me. You use letfn the way it is intended to be used.
16:19frawrcan't i add an annonymous function there instead?
16:20frawr(style aside)
16:20antares_frawr: you can, I don't know if that would be cleaner, honestly
16:21muhoowow, i'd love it if someone wrote a clojure wrapper for jgit
16:21AtKaaZhow do you add it? do you just replace abs square with abs #(* % %) ?
16:21frawrYeah, I think i agree, but how would it look? simply replacing the square with #(* percent percent) gave all sorts of scary errors
16:22jkkrameryou can't nest #()
16:22AtKaaZoh right
16:22frawrOh yeah, i don't need to abs if i square to begin with
16:22frawrAah thnx, makes sense
16:22raekyou can nest (fn ...) though
16:22AtKaaZcool
16:23raekbut you need to add an extra pair of parenthesis if you use it with ->
16:23frawrthnx!, though I'll have to agree on the cleanlyness of said solution
16:23raek(-> 1 (fn [x] (inc x))) expands to (fn 1 [x] (inc x))
16:23ohpauleezantares_: We're leaving because we're relocating?
16:24raekbut (-> 1 ((fn [x] (inc x)))) expands to ((fn [x] (inc x)) 1)
16:24antares_ohpauleez: we need to leave #clojuredocs so that dakrone can register it properly
16:24ohpauleezahh
16:24frawrthank you for the help, I'm out.
16:24dakroneantares_: ohpauleez: thinking of just registering #clojure-doc instead since not everyone is around to get out
16:25dakroneand it matches the website
16:25antares_dakrone: ok
16:25ohpauleezsounds good
16:26AtKaaZraek, can you call something to show you what it expands to?
16:26dakroneohpauleez: technomancy: uvtc: join #clojure-doc
16:27raekAtKaaZ: yes, macroexpand or macroexpand-1
16:27raek,(macroexpand '((-> 1 (fn [x] (inc x))))
16:27clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
16:27raek,(macroexpand '((-> 1 (fn [x] (inc x)))))
16:27clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: nth not supported on this type: Long>
16:27raek,(macroexpand-1 '((-> 1 (fn [x] (inc x)))))
16:27clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: nth not supported on this type: Long>
16:28raek,(macroexpand-1 '(-> 1 (fn [x] (inc x))))
16:28clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: nth not supported on this type: Long>
16:28Iceland_jack,(macroexpand-1 (-> 1 (fn [x] (inc x))))
16:28clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: nth not supported on this type: Long>
16:28raeknow, what am I doing wrong... :)
16:28AtKaaZraek, excellent, thanks works in my repl
16:28AtKaaZ,(macroexpand-1 '(-> 1 (fn [x] (inc x))))
16:28clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: nth not supported on this type: Long>
16:28AtKaaZit shows this for me: (fn 1 [x] (inc x))
16:28raek&(macroexpand-1 '(-> 1 (fn [x] (inc x))))
16:28lazybot⇒ (fn 1 [x] (inc x))
16:29AtKaaZclojurebot needs a reboot=)
16:29raekprobably some bug in the clojurebot sandbox code
16:29raekoh, frawr left...
16:29raekI was going to suggest 'comp'
16:29Sgeo&(macroexpand-1 '(-> 1 ((fn [x] (inc x)))))
16:29lazybot⇒ ((fn [x] (inc x)) 1)
16:29amalloyhe resets his sandbox every fifteen minutes or so
16:30hiredmanraek: please go ahead and try that in your repl
16:31hiredman,*clojure-version*
16:31clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
16:31Sgeointerim?
16:31Sgeo&*clojure-version*
16:31lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
16:32raek(sqrt (reduce + (map (comp square -) from to)))
16:38jweisswhat's the idiomatic way to provide a set of functions with some state already set? for example, i have a set of functions that do remote actions over ssh. the first arg to each function is the ssh connection. i can create a set of functions with this already fixed using partial, but then what? stick them in a map?
16:39jweisscreate a protocol on the connection type?
16:40gfredericksjweiss: trying to avoid the dirty version of dynamic var + binding?
16:40jweissgfredericks: yeah, gets ugly when trying to switch back and forth between hosts, and multithreaded gets ugly too.
16:41jweissFWIW, that's how i implemented it first, but now i have to deal with switching a lot mroe.
16:42amalloyjweiss: you can't get around having to keep track of the information somewhere. if you're not going to make it global/bindable (thank goodness), it has to be local. so, the client has to pass at least one connection-oriented option to the ssh functions
16:43amalloy(or, they have to keep a map of connection functions, which is much the same)
16:43gfredericksamalloy: do you have precise opinions about when dynamic vars are appropriate?
16:44technomancythings like log levels
16:45amalloynot really. i just like to complain
16:45technomancyor print-depth
16:45jweissamalloy: i guess the map of connection functions seems like cheap OO, and the syntax doesn't look like any idiomatic code i've seen. but nothing really wrong with it that i can think of
16:45amalloyjweiss: personally i prefer just having global functions that accept a map of connection info
16:46amalloytechnomancy: agreed re log levels, but i don't think i agree on print-depth. there's no reason the print functions couldn't take, modify, and pass on a depth arg
16:46technomancyin leiningen we use it for indicating you're operating in some alternate mode that is off the beaten path
16:46technomancyamalloy: IMO it should honor both
16:47amalloyi don't understand that
16:47technomancyamalloy: "alternate mode" or "honor both"?
16:47amalloyhonor both
16:47technomancyaccept an argument, fall back to the var if it's not provided
16:47gfredericksdynamic vars are appropriate exactly when nobody winces too much
16:56TimMcDear Abby, my friends tell me I use dynamic vars too much. How can I tell if they're right?
16:56hyPiRionHumm, you can't give a defrecord a docstring, am I correct?
16:59Apage43Now I am reconsidering my recent dynamic var use
16:59gfrederickshyPiRion: I doubt it, as I'm not sure where the docstring would be stored; defrecord just creates a class primarily I think
16:59technomancythings that aren't vars =(
17:00Apage43I'll probably add the option to take the dynamic thing as a parameter, but it's pretty useful when I often have a block that contains several forms that would all have the thing repeated
17:01gfredericksTimMc: it's easy! you just ask yourself "what option is simple?" and "what option is easy?" and then you pick the simple one of course.
17:01hyPiRiongfredericks: A shame :/
17:01gfredericksI started using this easy trick and now I don't make any more mistakes.
17:44AtKaaZin a REPL, if you define a macro then use it in a newly defined function then redefine the macro, how can you make that function reflect the new definition?
17:44AtKaaZI mean, without also redefining that function
17:44arohneryou don't
17:44arohneryou'll have to recompile the fn
17:44arohnermacros only run at compile time
17:44AtKaaZkind of makes sense
17:45antares_new Java interop section on clojure-doc.org: http://clojure-doc.org/articles/language/interop.html#implementing_java_interfaces_with_reify, feedback welcome
17:48brehautclojure-doc.org and clojuredocs.org makes me a little sad
17:48AtKaaZwhy?
17:48clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
17:48technomancybrehaut: the plan is to unify them
17:48brehautoh cool
17:48technomancybrehaut: but the clojuredocs.org maintainer is proving difficult to find
17:48brehautah
17:49brehautsorry, i didnt mean to be a grumpy old man
17:49AtKaaZunifying them sounds great!
17:49technomancybrehaut: well it's less than ideal, sure
17:49TimMcSounds like a job for core.logic.
17:49AtKaaZrofl
17:50brehauthah
17:51brehauton more positive points, the content on clojure-doc looks good
17:51technomancycontent is king
17:52technomancyantares_: looking good
17:54TimMc~maven
17:54clojurebotHelp, I'm trapped in an XmlFactoryFactory!
17:57cmdrdatshey guys, does anybody know where I can find a working pallet example installing the oracle jdk7 onto an ubuntu vm?
17:57S11001001TimMc: http://docs.oracle.com/javafx/2/api/javafx/util/BuilderFactory.html
17:58technomancydakrone: looks fine in w3m from here =)
17:59kirindave_How to _not_ document your code: http://palletops.com/pallet/api/0.6/pallet.core.html#var-lift
18:00kirindave_node-type, not actually a real thing
18:00kirindave_Only appears there. Ever.
18:02hugodkirindave_: well, thanks for reporting the issue
18:03dda,flatten
18:03clojurebot#<core$flatten clojure.core$flatten@4f25d6ca>
18:03kirindave_hugod: Literally just discovered.
18:03technomancykirindave_: how's the new gig?
18:03ddaflatten
18:03kirindave_hugod: Will probably note some stuff.
18:03antares_,(doc flatten)
18:03clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence."
18:03kirindave_technomancy: Getting provisioning set up.
18:03kirindave_technomancy: Fun tho.
18:03technomancyI can see =
18:03technomancy)
18:04kirindave_Yeah provisioning is a pretty grim world.
18:04kirindave_But not having anything is way worse.
18:04technomancyI know very little about pallet, but I really hope it makes a dent in chef
18:04hugodcmdrats: the pallet java crate can do that for you - https://github.com/pallet/java-crate - though that readme could use an example
18:06kirindavehugod: I don't suppose you know what lift is asking for in the first argument? It's obviously not a server-spec.
18:06hugoda group-spec
18:07kirindavehugod: Ahh, cool. Thanks. Kinda tired of using converge over and over. W/ AWS it varies between shockingly fast and tediously slow.
18:08hugodvmfest/vitualbox is great for developing your crates
18:08TimMcS11001001: I think I wrote one of those once.
18:10kirindavehugod: Has virtualbox stopped chain-breaking on OSX yet? I tried this and had kernel panics. Like 2 in one day.
18:10kirindavehugod: Every time there is a new OS release, it takes some time for the virtualization dust to settle.
18:10kirindaveI'll have to try.
18:11cmdrdatshugod: ye, i'm trying the java-crate, but not having much luck
18:12hugodyeah, virtualbox's network driver can cause issues - seems ok at the moment with vbox 4.1.23 and OS X 10.7.5
18:13antares_kirindave: on 10.8, virtualbox 4.2 works OK
18:13cmdrdatshugod: one of the issues i'm finding is that the oracle jdk has a licence agreement rubbish that needs and 'enter' key and hangs there..
18:13antares_cmdrdats: on Debian and ubuntu, you can work around that with preseeding
18:14kirindavecmdrdats: Actually a lot of the crates seem subtly broken in some places. You're probably best off forking and fixing on your own.
18:14hugodcmdrdats: defining a group-spec like (group-spec "java" :extends (pallet.crate.java/java {:vendor :oracle})) should work on ubuntu
18:14antares_cmdrdats: like here https://github.com/travis-ci/travis-cookbooks/commit/3f0d12caf95af4f3a42ba2f2bfd660a4e725fdea or via preseed file
18:15antares_(this assumes you use the oracle jdk7 ppa)
18:15kirindavecmdrdats: It turns out universal installation and management rules are hard. ;)
18:16cmdrdatsantares_: interesting, that's a good link to keep around
18:16hugodkirindave: and the target is constantly moving
18:16kirindavehugod: And some of the crates suffer from neglect. Like mysql.
18:16antares_cmdrdats: for the seed file, see https://github.com/travis-ci/travis-cookbooks/commit/3fdf7048abd0318904b8f41eff7a464ce668d568
18:17kirindaveCuz mysql is not exactly a popular target anymore.
18:17cmdrdatskirindave: ye, but seriously. java? it's only, like, the cornerstone of pretty much every clojure app out there..
18:17cmdrdats(not ranting at pallet, more at the fact that java is such a mess to install)
18:18hugodkirindave: yeah - slowly getting round to updating them, but it is a huge amount of work and nobody offers much help with them
18:18kirindavecmdrdats: I'm sort of at the point where I write off most pre-packaged configuration stuff. All goodwill towards the pallet crew for trying, but it's sort of a given with _every_ distributed conf system you're gonna just write your own code to force software onto boxes
18:18kirindavecmdrdats: Even big-name ones like puppet and chef have their _entire_ stdlib written off by most serious shops I know.
18:19kirindavecmdrdats: So just having a reasonable syntax and model that doesn't require a rendezvous server is a pretty big accomplishment in this space.
18:19kirindavehugod: I'll commut back for my changes to nginx.
18:19cmdrdatsantares_: thanks - I wonder if I can work that preseed file into the java crate
18:20hugodkirindave: thanks!
18:20antares_kirindave: that's largely what happened with travis-ci/travis-cookbooks. Almost every cookbook is modified or rewritten for our needs.
18:20hugodcmdrdats: so the crate is failing without it? Which install method are you using?
18:20technomancycmdrdats: openjdk is easy
18:20antares_kirindave: at ~80 of them
18:20cmdrdatshugod: I'm going to try again now and let you know
18:21cmdrdatstechnomancy: ye, i'm considering using it, but deep in my gut, something tells me something inexplicable is going to break one day if i do
18:21kirindaveantares_: Yeah we _didn't_ do that at CrowdFlower and it ended up being a huge debacle that those guys are still extricating themselves from.
18:21technomancycmdrdats: very unlikely
18:21kirindaveFundamentally bad model.
18:22kirindavePallet & Jclouds is much more suited to elastic provisioning.
18:22technomancydoes oracle jdk still adhere to the ancient US crypto laws like they did a couple years ago?
18:22hugodcmdrdats: if you have more issues, you can find more pallet people in #pallet
18:22cmdrdatstechnomancy: ok, then I probably will just end up using openjdk because it's more sane.
18:23shaungilchristsay I have a keyword (def x :thingy/majigger) - if I do (name x) I get "majigger" how do I get the first part "thingy" ?
18:23cmdrdatshugod: cool, that's a good point - i'll be sure to pop my head in there
18:23nDuffkirindave: Be nice if all the world worked like that. Of the last several startups I've been at, _none_ of them had every machine profile in our clusters completely stateless. (Web frontends, yes; app servers, yes... but there's always been _someone_ with a datastore who can't be nuked and paved).
18:23technomancycmdrdats: at heroku the only people who want oracle JDK are the kind of people who buy big up-front enterprise sales packages for a service that's easily available via the CLI
18:24technomancyit's 100% a brand name recognition thing
18:25cmdrdatstechnomancy: ah. ok, i'll definitely switch to openjdk then
18:26kirindavenDuff: I think until we get totally off of hosting our monolithic db's in the cloud we're stuck with that property.
18:26kirindavenDuff: There is just no magical way to wave a wand and have postgres failover with all the popular and modern app stacks.
18:27kirindavenDuff: I try to use DynamoDB wherever I can. It's often cheaper than the box you'd require for a beefy postgres cluster, and if it can do what you want it's plenty fast.
18:27nDuffkirindave: I've done wave-a-wand PostgreSQL failover, but that was targeting a single (in-house) stack.
18:27kirindavenDuff: Yeah, you can break it until you make it happen. It's a lot of engineer hours tho.
18:27shaungilchrist(namespace :thingy/majigger) is what I needed
18:28AtKaaZshaungilchrist, cool thx
18:28AtKaaZ,(namespace :thingy/majigger)
18:28clojurebot"thingy"
18:28AtKaaZ,(name :thingy/majigger)
18:28clojurebot"majigger"
18:29AtKaaZ,(namespace :majigger)
18:29clojurebotnil
18:29AtKaaZ,(namespace ::majigger)
18:29clojurebot"sandbox"
18:30AtKaaZ,*ns*
18:30clojurebot#<Namespace sandbox>
18:30wingydoes anyone know what is wrong with this datomic query: (q '[:find ?account :in $ ?uid :where [?account :db/id ?id]] (db conn) uid)
18:30wingyi get Exception: java.lang.Exception: processing rule: (q__3580 ?account)
18:30shaungilchristI think you have your rule backward?
18:30AtKaaZwhat is ?id ?
18:30shaungilchrist[?uid :db/id ?account] perhaps?
18:31AtKaaZor add ?id to :find ?
18:32shaungilchristwingy: is uid an entity id?
18:32wingyyeah i think i have it wrong
18:32wingyyeah
18:32wingythats the issue :)
18:36wingyso if i wanna find an entity with that id (its a user) how should it look like?
18:36wingyi tried this: (q '[:find ?name :in $ ?id :where [?id]] (db conn) id)
18:36wingybut it gave me an error: java.lang.Exception: processing rule: (q__3580 ?id)
18:37AtKaaZmaybe you need ?name inside the :where ?
18:37shaungilchrist[:find ?name in $ ?id :where [?id :attr/name ?name]]
18:38shaungilchristassuming :attr/name is what ever your actual name attribute is
18:38AtKaaZor replace ?name with ?id ?
18:39AtKaaZwhat shaungilchrist said makes sense:)
18:40shaungilchristthat is not a phrase often said
18:40AtKaaZI assumed he wanted the entity id, but that's like asking does this entity with this id exist, but he wanted the name (ie. :attr/name) associated to that entity id
18:41shaungilchristyeah it comes from sql mindset that first you must match a record to an id
18:41shaungilchristbut in datomic the id IS the record
18:42wingyi dont get the error: java.lang.Exception: processing rule: (q__3580 ?val)
18:42wingy(q '[:find ?val :in $ ?id :where [?id :account/name ?val]] (db conn) id)
18:42wingyit looks correct .. but why that error
18:43shaungilchristwhere are you getting id from?
18:43wingyas a fn parameter
18:43wingylet me have it as a string to see if it changes
18:44wingynope
18:44shaungilchristis it cast to long?
18:44AtKaaZwhat do you do to get set 'id' ?
18:45AtKaaZ,(class 12367136812)
18:45clojurebotjava.lang.Long
18:45wingythis worked (q '[:find ?val :where [?id :account/name "_gid_6YFM5nDHBkGY5ylI2vwa9OluSPR9i6A0i7fCRNiRf90="]] (db conn))
18:45wingyso i guess its something with the variable thing
18:46wingyperhaps i need to encode it first?
18:46shaungilchristwait what?
18:46wingyoh yeah
18:46wingywhat am i doing .. wait
18:46shaungilchristare you sure the "id" you have is datomic entity id and not some other id you are creating?
18:47AtKaaZwish we had a datomic both here:D
18:49shaungilchristseems feesible to have one which does not allow transactions populated with a decent pet store schema or what not
18:49wingyshaungilchrist: i am using gigya which is giving me an id .. i need to see if that is an id that exists in the db .. if not, i create a new user and then tells gigya what that newly created account id is .. next time that user logs in it gives me that id and i would know that he/she already exists in my db
18:50shaungilchristso you need to have an :gigya/id attribute defined
18:50shaungilchristand check that
18:50shaungilchrist[:find ?exists :in $ ?gid :where [_ :gigya/id ?gid]]
18:51AtKaaZeverytime I watch this (Datomic Datalog) I learn something new: https://www.youtube.com/watch?v=bAilFQdaiHk
18:51wingyshaungilchrist: ?exists is a built in variable?
18:51shaungilchristsorry I accidently pressed enter
18:51shaungilchristjust a moment
18:52shaungilchrist[:find ?exists :in $ ?gid :where [_ :gigya/id ?id] [(= ?id ?gid) exists]]
18:52shaungilchristbah forgot ? on last exists but you get the idea
18:52AtKaaZneat
18:55wingythe thing it is better for me to use whatever ID is in my db for an entity and just tell gigya that the new user's id is X and gigya will know that it is X next time it gives me the ID
18:55AtKaaZis that potentially slower than just returning the ?gid ? since the first part will find all entities with any :gigya/id ids and then check if they are the one, instead of just finding the one with that specific id, but I guess both have to cache the same amount of data?!
18:55wingy1. i create a new account 2. give gigya the ID of the newly created account
18:56wingywhich means i cant have it as a :gigya/id attr
18:56shaungilchristyeah I would try and use the entity id directly
18:56AtKaaZso you're using entity id?
18:56wingyyeah
18:56wingyill ask in datomic ML why its not working then
18:57shaungilchristbtw I would revise my answer to
18:57AtKaaZthey'll probably ask you to tell the type of the 'id' ie. (class id) before you run that query
18:57AtKaaZbut it's probably Long already
18:57shaungilchrist[:find ?id :in $ ?gid :where [_ :gigya/id ?id] [(= ?id ?gid)]] and just check if it is empty vector
18:59AtKaaZwhy not this? (q '[:find ?eid :in $ ?gid :where [?eid :gigya/id ?gid] (db conn) gidvar)
19:00shaungilchristthe where is just binding any entity id with any gigya/id to ?gid
19:01AtKaaZoh? just a sec I'll recheck/learn
19:02AtKaaZI mean, if you're right then it would explain why this wouldn't work: <wingy> (q '[:find ?val :in $ ?id :where [?id :account/name ?val]] (db conn) id)
19:03shaungilchristyeah that is just binding the account/name of any entity to ?val
19:03AtKaaZbut also to ?id ?
19:04shaungilchristoh the :in yeah it is looking for that specific id but that is why it is breaking
19:04shaungilchristit is a string and not the long an eid should be
19:04AtKaaZyeah it's possible, that's why I wish wingy would do a (class id) :D
19:05shaungilchrist[:find ?id :in $ ?gid :where [?id :account/name ?val] [(= ?val ?gid)]]
19:05shaungilchristwould probably do the trick as that way it would be string -> string comparison
19:05shaungilchristand if found it would return the entity id
19:19wingyshaungilchrist: dont you have to pass the db value as well?
19:20wingyi c .. you just wrote the the matching clause
19:21AtKaaZwingy, looking at this https://www.youtube.com/watch?v=bAilFQdaiHk&amp;t=4m30s
19:22wingyi should too
19:22wingylets watch!
19:23AtKaaZI mean, that part at 4:30 about finding a customer by email, and the ?email is passed as a param
19:35wingyAtKaaZ shaungilchrist that means i just have to convert the id to a long if its a string and i wouldn't get error
19:37wingy(q '[:find ?name :in $ ?gid :where [?gid :item/name ?name]] (db conn) (java.lang.Long. "17"))
19:37wingyno error
19:40wingyAtKaaZ shaungilchrist: FYI this worked great: (q '[:find ?id :in $ ?id :where [?id :item/name _]] (db conn) (java.lang.Long. "17592186045425"))
19:41AtKaaZthat makes me wonder, if you put the "_" does it mean the value of attribute :item/name for that ?id is restricted to being something? as in, it cannot be nil? (can it ever be nil anyway?) and if you don't put "_" would it allow it to be either something or nil? (assuming nil is doable)
19:42AtKaaZby nil I merely mean, missing
19:42wingywait .. regarding my answer it didn't work since Gigya ID is a string that cannot be converted to a nr :)
19:43wingyi guess ill just stick with the gigya ID as a attr approach
19:43wingyless hacky
19:49tacomanis there a list of the individual packages that make up Emacs-Live? I like some of the ideas but don't really want to go whole-hog with everything in it
19:52tacomanah, nevermind. the interesting stuff looks like it's largely in the configs in the packs
19:53AuroraXdoes anyone know LonTalk?
19:59gertis there a function f such that (f :foo/bar) returns "foo/bar"? i.e. like `name` but without removing the namespace part?
20:02AtKaaZ,(defn keywordname [keyword] (symbol (namespace keyword) '/ (name keyword)))
20:02clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
20:03AtKaaZi failed: ,(defn keywordname [keyword] (symbol (str (namespace keyword) '/ (name keyword))))
20:04AtKaaZ,(#(symbol (str (namespace %) '/ (name %))) :foo/bar)
20:04clojurebotfoo/bar
20:04AtKaaZ&(#(symbol (str (namespace %) '/ (name %))) ::bar)
20:04lazybot⇒ clojure.core/bar
20:04gertAtKaaZ: thanks!
20:06AtKaaZhmm, doesn't work for namespaceless keywords :) &(#(symbol (str (namespace %) '/ (name %))) :bar)
20:06AtKaaZ,(#(symbol (str (namespace %) '/ (name %))) :bar)
20:06clojurebot/bar
20:06patchworkI have a file, what is the best way to get a content-type?
20:07patchworkI was about to write something, but I feel this MUST have been done before
20:07patchworkjust not sure where
20:07AtKaaZ,(#(symbol (str (when-let [ns (namespace %)] (str ns '/)) (name %))) :bar)
20:07clojurebotbar
20:09AtKaaZpatchwork, possibly this? https://github.com/michaelklishin/pantomime
20:10patchworkWow, perfect!
20:10patchworkknew it had to exist, thanks AtKaaZ!
20:11AtKaaZI'm glad my life was not a waste ;)
20:12patchworkAtKaaZ: At the very least, you have done this much
20:13AtKaaZyeah ;)
20:13AtKaaZtotally worth it, bbl
20:23AtKaaZgert, btw, just making sure you saw the fix for when using that function with namespaceless keyword ie. :bar didn't work, it would show /bar fix was this: &&(#(symbol (str (when-let [ns (namespace %)] (str ns '/)) (name %))) :bar)
20:24AtKaaZwas this the syntax for bot? ##(#(symbol (str (when-let [ns (namespace %)] (str ns '/)) (name %))) :bar)
20:24lazybot⇒ bar
20:24gertyup AtKaaZ I've got it working, ta :)
20:32kovasbure
20:49seancorfield,(#(->> % ((juxt namespace name)) (remove nil?) (clojure.string/join "/") symbol) :bar)
20:49clojurebotbar
20:50seancorfield,(#(->> % ((juxt namespace name)) (remove nil?)
20:50seancorfield (clojure.string/join "/") symbol) :foo/bar)
20:50clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
20:50seancorfieldbah!
20:50frozenlo`Is there a function to round up numbers?
20:50frozenlo`Wrong question: surely there is, I just don't know the name.
20:50amalloylike yeehaw, round em up, cowboys?
20:51frozenlo`-_-
20:51seancorfield,(Math/round 4.5)
20:51clojurebot5
20:51brehaut,(iterate inc 0)
20:51clojurebot(0 1 2 3 4 ...)
20:51brehaut^ amalloy
20:51frozenlo`seancorfield: ah! The ubiquitous java call. Thanks!
20:51amalloybrehaut: i was thinking more like clojure.core/set, to get a bunch of free-ranging numbers from an infinite seq into a corral
20:52brehauti hope those are only grass fed numbers
20:52AtKaaZseancorfield that is pretty cool
20:54frozenlo`Grr... it chokes on a rational number. I suppose I should convert it to float before rounding it?
20:55gfredericksFrozenlock: are you dealing with rationals specifically?
20:55Frozenlockyes
20:56gfredericksthen surely we don't have to resort to those nasty floats
20:56gfredericks,(#(+ % (- 1 (rem % 1))) 7/5)
20:56clojurebot2N
20:57FrozenlockMore elegant indeed :)
20:57gfredericksverify it does what you want with negatives and such if you're dealing with those too
20:58wingyi have a clj server running using compojure/lein ring server .. how can i connect to it from repl so i can investigate the memory environment?
21:02AtKaaZseancorfield, I just understood that code :) it's quite elegant
21:04wingyis it possible to destructure stringed keys
21:04gfredericksyep
21:04gfredericks:strs instead of :keys
21:04wingyah
21:04wingynice!
21:04gfredericks(inc rhickey)
21:04lazybot⇒ 1
21:05gfredericksfirst!
21:06wingy(inc rhickey)
21:06lazybot⇒ 2
21:06Hodappout out damned statefulness!
21:06FrozenlockSo much to learn, so little time!
21:06wingyi remember it from the (Programming) Clojure (Programming) book
21:06gfredericksFrozenlock: study that for a week and come back and I'll tell you all about :syms
21:07FrozenlockNaow! I want to know naow!
21:08wingyclj is said to be an interactive env where one can interact with the program .. how can i do that after i have run my program with "lein ring server"
21:08gfrederickswingy: you could start the server from the repl instead?
21:08chouserhttps://github.com/clojure/clojure/commit/000a3068a9e24d6f1a2464390fdecb4241133f45 ...I'm just sayin'
21:08seancorfieldAtKaaZ: you can "blame" amalloy for my fondness for juxt :)
21:08wingygfredericks: yeah
21:09gfredericksset destructuring??
21:09lazybotgfredericks: Uh, no. Why would you even ask?
21:09gfredericks,(let [{:keys [a b]} #{:a :c}] [a b])
21:09clojurebot[:a nil]
21:09gfredericksO_O
21:10AtKaaZ,(let [{:keys [a b]} #{:a :b}] [a b])
21:10clojurebot[:a :b]
21:10AtKaaZtypo?:)
21:10seancorfieldwingy: or start a swank server inside your app and then slime-connect to that (assuming emacs)... that's what we do at world singles
21:10gfredericksAtKaaZ: no, I was just surprised it worked at all
21:10gfredericksclojure is full of secrets
21:10AtKaaZoh
21:11chouserI haven't done anything useful lately so I have to take props from 4 year old patches.
21:11wingyseancorfield: not an emacs user though
21:11gfrederickschouser: oh I didn't see your name there
21:11FrozenlockIs :syms a way to pass functions?
21:11gfredericks(inc chouser)
21:11lazybot⇒ 11
21:11gfredericks(dec rhickey)
21:11lazybotYou want me to leave karma the same? Fine, I will.
21:11AtKaaZlol
21:11gfredericks(dec lazybot)
21:11lazybot⇒ 6
21:12amalloy&(let [{:keys [a b c]} (reify clojure.lang.ILookup (valAt [this k] "foo"))] [a b c])
21:12lazybot⇒ ["foo" "foo" "foo"]
21:12gfredericks(dec rhickey)
21:12lazybotYou want me to leave karma the same? Fine, I will.
21:12chouserFrozenlock: no, it's just for when you're using symbols as map keys
21:12gfredericks$karma rhickey
21:12lazybotrhickey has karma 2.
21:12chouser,(let [{:syms [a b]} '{a 1 b 2}] [a b])
21:12clojurebot[1 2]
21:12amalloyi knew :keys worked on vectors, but it never occurred to me that it's just ILookup
21:13wingyclojurebot is more helpful than Siri
21:13FrozenlockOh... OH!
21:13FrozenlockWow that never even occured to me to do something like this. Is this approach used often?
21:14gfredericksFrozenlock: what part?
21:14Frozenlockuse symbol in a map instead of keyword or string
21:14chouserno, it's not very common to use symbols as keys, but occasionally it's exactly what you want.
21:15FrozenlockOne could use a function as a key, for example?
21:15brehautchouser: macros and stuff?
21:15FrozenlockWell the symbol for the function
21:15gfredericksFrozenlock: not functions no
21:16gfredericksit is probably mostly macro work
21:16FrozenlockI'll stick with my newly learned :strs for now :)
21:17chouserbrehaut: sure, lists and symbols are used most often when dealing with code such as in macros
21:17chouserFrozenlock: you can also use functions as keys, but that's probably even less common.
21:17chouserthough, I do think I had a bit of code that did that...
21:18patchworkIs there a version of ring that does not include this heinous hiccup dependency issue?
21:18gfredericksring depends on hiccup?
21:18chouserFrozenlock: http://fogus.me/fun/unfix/infix-src.html
21:19chouserthere, functions as keys.
21:20patchworkYes, and fails hard if there is another version of ring somewhere
21:20gfrederickswhich ring lib is that?
21:21gfredericksI see ring-devel does
21:21patchworkHere is the error: java.io.FileNotFoundException: Could not locate hiccup/core__init.class or hiccup/core.clj on classpath:
21:21gfredericksoh yeah hiccup changed it's namespaces didn't it
21:21FrozenlockActually this might be what I was missing when trying to store functions in a map... https://github.com/Frozenlock/zyzanie/blob/master/src/zyzanie/core.cljs#L51 With the symbol however I could easily that.
21:21patchworkhiccup renamed a bunch of stuff and now everything blows up
21:22patchworkterrible, I don't even use hiccup
21:22FrozenlockOhh this is exciting :)
21:22patchworkNow my app is broken : (
21:22gfrederickspatchwork: so you're using ring-devel specifically?
21:22patchworkNo, but it gets included
21:22gfredericksby another dep?
21:22gfredericksso you have hiccup as a 2nd degree dependency conflicting with hiccup as a 3rd degree dependency?
21:22patchworkYes
21:23patchworkexactly
21:23patchworknowhere do I include it directly
21:23gfredericksapparently encouraging lots of libraries has its downsides
21:23wingyi have this fn i run from the lein repl: (defn run [] (run-jetty handler {:port 3000}))
21:23gfredericksbest you can do is pick the one that depends on the older hiccup and update it
21:24gfrederickssend a pull request and push your own version to clojars in the mean time
21:24wingythe server starts but then i cannot interact with the repl anylonger
21:24gfrederickswingy: add :join? false I believe
21:24gfredericksto the options map
21:25wingyok i did this: (run-jetty #'handler {:port 3000 :join? false})
21:25wingyand it worked
21:26gfrederickswingy: SWEET
21:26patchworkgfredericks: Thanks
21:26wingymuch better than lein ring server since now i can interact :)
21:26gfrederickspatchwork: you can also use lein checkouts if the clojars part sounds difficult (which it isn't)
21:27gfredericksI think...actually I don't remember if the checkouts feature uses the project.clj from the checkout
21:27gfredericksit probably does
21:27wingyjust to check with you that this is the correct workflow: 1. "lein repl" 2. (require 'myapp.server)(ns myapp.server)(start) .. it can't get simpler than this?
21:28gfredericksif you set that ns as your :main in the project.clj then it'll go there automatically cutting out 2/3 of your steps
21:29AtKaaZawesome
21:29gfredericksI think you could also have a function that starts the server and starts a repl itself but it might not be fully featured
21:35Hodappwonder of its author ever steps in here...
21:37wingygfredericks: i added main: myapp.server in project.clj and now it jumps right to it .. so all i have to do is (start)
21:37wingyi did (start) in the server.clj file directly but the repl timed out
21:37wingyis there a way to set a longer timeout value?
21:37wingyi should consult lein github doc
21:38wingyhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L134
21:40FrozenlockThat is a big project file.
21:41gfredericksand if you really love clojure you'll memorize it
21:41Frozenlocklol!
21:44wingywhy is lein "compiling myapp.server" after i added it to :main in my project file
21:45wingyits taking forever to compile it
21:45gfrederickseh...that might be a side effect :)
21:45gfredericksleiningen y u complect
21:45wingywhat is compilation do? compiling it to java byte code?
21:45Hodappyou told me that there were no side effects :(
21:45wingysince now it just hangs up in "compiling myapp.server"
21:45gfrederickswingy: yeah; I imagine the primary purpose of :main is setting a main class for an executable jar
21:46gfredericksideally lein would have a :lein-repl-ns option
21:46wingysince i added (server) in my server file .. if i remove it it compiled it perfectly
21:46gfredericksoh ah ha
21:46wingyill file an issue
21:46gfredericksthere's a compile flag you can check for
21:46gfredericksso that you don't start the server if it's compiling
21:46gfredericks,(doc *compile-files*)
21:46clojurebot"; Set to true when compiling files, false otherwise."
21:47gfredericksso just say (when-not *compile-files* (server))
21:47AtKaaZwait that's too good to be true
21:48wingyUnable to resolve symbol: server in this context, compiling:(myapp/server.clj:142)
21:48gfredericksWAT.
21:48wingymy fault
21:48wingywait
21:48wingystart ! not server :)
21:49wingywohoooooo
21:49wingyso now my workflow looks like this: lein repl :)
21:49wingythx for the help
21:49gfredericksalias lr="lein repl"
21:50wingyyeah
21:50wingy:D
21:50brehautyou close your repl‽
21:50AtKaaZ,(compile 'clojure.core)
21:50clojurebotclojure.core
21:50aperiodicthere's a way to tell leiningen not to compile your main, if you want
21:50wingywhen i think about it "lein ring server" is a bad practice
21:51wingysince clj is built around interactive env
21:51gfredericks(inc wingy)
21:51lazybot⇒ 0
21:51wingywho gave me minus???
21:51lazybotwingy: Yes, 100% for sure.
21:53gfrederickswingy: it doesn't matter. that's all over now. he can't hurt you anymore.
21:54AtKaaZgfredericks, how can I test that and see *compile-files* is true? I don't really know how to make it compile in a new thread
21:54wingyi still have nightmares
21:54wingyhe was a monster
21:55gfredericksAtKaaZ: you could add a ns to :aot in project.clj and run `lein compile`
21:55AtKaaZgfredericks, but I mean from repl, to be easier
21:55gfredericksAtKaaZ: no clue
21:56gfredericks,(doc compile)
21:56clojurebot"([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."
21:56AtKaaZsomething like ##(.start (Thread. #(compile 'clojure.core))) *compile-files*
21:56lazybot⇒ nil
21:57Frozenlockseancorfield: I'm aware this is more a mongodb question, but I'll take my chances anyway.. Any tricks to avoid this error? "command failed [findandmodify]: { "serverUsed" : "/127.0.0.1:27017" (...)" I think it's because I try to modify a recently created collection, but I'm not sure.
22:08AtKaaZgfredericks, I looked at the source, compile does (binding [*compile-files* true]
22:08AtKaaZand I was trying to get the value from a different thread:)
22:10AtKaaZbinding is threadlocal right?
22:10amalloyi'm pretty sure *compile-files* is a compiler internal that you're not really supposed to use
22:11AtKaaZI was trying to see if I can catch it to ever be true
22:11hiredmanamalloy: no, it's cool, you can use it
22:12amalloyhiredman: so there are actual good situations to use it in?
22:13AtKaaZ"but you can get bitten by sloppily thinking that an established binding will migrate to another thread" from chas
22:13AtKaaZI mean, from here: http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/
22:13hiredmanif you have something you only want to happen when you are compiling
22:14seancorfieldFrozenlock: I'd need to see more of your code and know more about your setup... is there more detail in the error?
22:15seancorfieldFrozenlock: are you using congomongo? if so, asking on the congomongo-dev list might be a good idea, where you can provide full details
22:18Frozenlockseanaway: Yes I'm using congomongo. Thanks for the tip, I'll try the mailing list if my current workaround fails.
22:21AtKaaZhiredman, but can you ever get the *compile-files* to be true to do any such work ? if the compile happens in a different thread it'll always be false to you, or if it happens in the same thread you're either doing the check before or after the compile is done, again seeing it as false
22:24AtKaaZlooks like it's used internally to know when to generate files (when it's true)
22:30aperiodicAtKaaZ: when the namespaces being compiled are evaluated, *compile-files* will be true. try adding (when *compile-files* (println "compilation is happening")) as a toplevel form in some namespace, then compile that namespace
22:33AtKaaZaperiodic, wow I did not see that, I stand corrected
22:33AtKaaZthank you for that
22:33wingyis it okay to shadow symbols like _name_ in eg. (let [name (...)] …)
22:34aperiodicyou're welcome
22:34wingycause name already exists
22:34aperiodicthat's totally kosher
22:34aperiodicclojure has lexical scope
22:35wingyaperiodic: yeah so its okay as long as i dont use the name fn inside of the let scope
22:35aperiodicyeah, inside of that let name will always refer to the local
22:36aperiodicbut you can still refer the core fn by using the fully-qualified symbol
22:37aperiodic,(let [name 'Bob] (clojure.core/name name))
22:37clojurebot"Bob"
22:42AtKaaZ,#(1)
22:42clojurebot#<sandbox$eval53$fn__54 sandbox$eval53$fn__54@6b497573>
22:42AtKaaZ,#(identity 1)
22:42clojurebot#<sandbox$eval81$fn__82 sandbox$eval81$fn__82@465155b6>
22:45AtKaaZI think I'm losing my mind, I need an anonymous function that returns 1 when called, how to?
22:45aperiodic,((constantly 1))
22:45clojurebot1
22:47RaynesAtKaaZ: (constantly 1) or (fn [& _] 1)
22:47AtKaaZcan I use #() ?
22:47aperiodicwhy?
22:47clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
22:47AtKaaZcurious how to
22:48AtKaaZI mean other than like this: ((#(constantly 1)))
22:48aperiodicthat's the only way you can do it
22:49AtKaaZI see that ##(fn [] 1) is easy but #(1) is like calling function 1
22:49lazybot⇒ #<sandbox7657$eval11377$fn__11378 sandbox7657$eval11377$fn__11378@98df31>
22:49AtKaaZ,((fn [] 1))
22:49clojurebot1
22:49AtKaaZaperiodic, it's not possible with #() ?
22:49brehaut,(#(-> 1))
22:49clojurebot1
22:50AtKaaZneat, ok I guess what I learned is, #(..) will require first thing to be function call, unlike (fn [] ...)
22:51AtKaaZthanks aperiodic, Raynes, brehaut
22:51Raynesbrehaut: That is hideous.
22:51brehautRaynes: i have something worse
22:51brehaut,(#(or %& 1))
22:51clojurebot1
22:51aperiodic(inc brehaut)
22:51lazybot⇒ 7
22:51Raynes&(#(do 1) 1 2 3)
22:51lazybotclojure.lang.ArityException: Wrong number of args (3) passed to: sandbox7657$eval11389$fn
22:52RaynesThe problem with that is that it only works if you're passing no args.
22:52brehautaperiodic: its chouser or fogus's fault (from JoC)
22:52aperiodici'm utterly addicted to ->
22:52AtKaaZI actually like that one with -> :)
22:52brehautRaynes: didnt i say it was worse?
22:52Raynesbrehaut: I meant your -> and my do example/.
22:53brehautRaynes: oh right. the %& breaks much worse with arguments
22:54aperiodicyeah, don't you just want #(or 1 %&)?
22:54amalloy&'#(1) ;; in case you're unclear on why that fails
22:54lazybot⇒ (fn* [] (1))
22:54AtKaaZok *compile-files* can be used to guess if it's first time run, thanks to aperiodic's eye opener
22:55AtKaaZI mean, first time ever :) like after checking out the project
22:56brehautaperiodic: aha of course
23:03AtKaaZdisregard my previous statement, doesn't work with lein (or I'm doing it wrong: lein clean, lein repl ...)
23:05amalloyaperiodic, brehaut: #(or 1 %&) isn't very general, since it only works for truthy values. if you were really going to rewrite (constantly x) with #(), the answer is #(do %& x)
23:06AtKaaZit only works (in ccw or lein) if I invoke compile
23:07SgeoWhat's wrong with just using constantly?
23:07aperiodicso straightforward!
23:08AtKaaZ,(#(do %& 1))
23:08clojurebot1
23:08Sgeo,(#(identity %&) 1 2 3)
23:08clojurebot(1 2 3)
23:08AtKaaZ,(#(do %& 1) 1h l 12hlk 131 3hl1)
23:08clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 1h>
23:09Sgeo,(type (#(identity %&) 1 2 3))
23:09clojurebotclojure.lang.ArraySeq
23:09AtKaaZ,(#(do (comment %&) 1) 1h l 12hlk 131 3hl1)
23:09clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 1h>
23:09SgeoAtKaaZ, is there a reason to not use constantly?
23:09AtKaaZSgeo, i wanted to do it with #()
23:09SgeoAnd the problem with the examples you're trying is the 1h, not the function
23:10AtKaaZyeah my bad passing random stuff, not even valid numbers
23:12AtKaaZ,(#((comment %&) 1) 1 2 3)
23:12clojurebot#<NullPointerException java.lang.NullPointerException>
23:13AtKaaZ,(macroexpand '(#((comment %&) 1) 1 2 3))
23:13clojurebot((fn* [& rest__193#] ((comment rest__193#) 1)) 1 2 3)
23:14Sgeo,(nil 1)
23:14clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0)>
23:15Sgeo,(macroexpand '(#(#_%& 1) 1 2 3))
23:15clojurebot((fn* [& rest__245#] (1)) 1 2 3)
23:15AtKaaZoh right, comment returns nil
23:15Sgeo,(macroexpand '(#( 1) 1 2 3))
23:15clojurebot((fn* [] (1)) 1 2 3)
23:15SgeoHmm, so the reader will see the %& no matter what, I take it?
23:16AtKaaZ,(#(#_%& do 1) 1 2 3)
23:16clojurebot1
23:17AtKaaZvery clever of you Sgeo :)
23:17Sgeo,(macroexpand '(#("%&" 1) 1 2 3))
23:17clojurebot((fn* [] ("%&" 1)) 1 2 3)
23:17amalloySgeo: yeah, that's a quirk of the reader: %n "counts" even inside an #_ form
23:18AtKaaZso that's the right way to ignore any extra params with #_%& ?
23:20AtKaaZamalloy, I think you mean that in the future it could change?
23:20AtKaaZ,(#(do (comment %&) 1) 1 2 3 "x" true)
23:21clojurebot1
23:24scottjcodeq: continuing the clojure tradition of obfuscating spoken conversations.
23:25ynnivanyone know the difference between an empty "let" block and a "do" block?
23:26ynnivI was surprised to see defrecord using an empty "let" block
23:26AtKaaZhow can you test is the stuff inside comment is evaluated or not like: (comment (+ 1 2))
23:27SgeoIt should in theory be completely ignored
23:27ynniv(comment (println 'a)) ?
23:27Sgeo,(comment (println "HoNk HoNk :o)"))
23:27clojurebotnil
23:27ynniv,(println "HoNk")
23:27clojurebotHoNk
23:28ynnivwasn't sure clojurebot printed stdout
23:28AtKaaZynniv, that's pretty epic, why didn't I think of it:)
23:28ynnivAtKaaZ: the proper answer to your question is "side effects" ;-)
23:28AtKaaZyep
23:29Sgeo,(doc set!)
23:29clojurebotexcusez-moi
23:29AtKaaZcomment is a macro, makes sense now
23:30uvtc&(doc set!)
23:30lazybotjava.lang.SecurityException: You tripped the alarm! set! is bad!
23:30Sgeo&(comment set!)
23:30lazybot⇒ nil
23:31AtKaaZif it were a function they would've been evaluated ##( #(#_%&) (println 1) )
23:31lazybot⇒ 1 ()
23:31uvtcFirst rule of `set!` is that you do not talk about `set!`.
23:32SgeoI should watch that movie sometime
23:33AtKaaZdidn't know this returns empty list: ##(class (#(#_%&)) )
23:33lazybot⇒ clojure.lang.PersistentList$EmptyList
23:33AtKaaZthat is, if no return is specified
23:34AtKaaZ,(class (#()) )
23:34clojurebotclojure.lang.PersistentList$EmptyList
23:35AtKaaZ,(count (#()) )
23:35clojurebot0
23:35Sgeo,(class nil)
23:35clojurebotnil
23:35SgeoOh, what you're doing makes... wait, hmm
23:35AtKaaZ,(#())
23:35clojurebot()
23:35SgeoYou're right, that's weird
23:35ynniv,(reduce *' (range 2 100))
23:35clojurebot933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000N
23:36Sgeo,(apply *' (range 2 100))
23:36clojurebot933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000N
23:36AtKaaZwhat's the ' ?
23:36ynniv,(list (reduce *' (range 2 100)) nil)
23:36clojurebot(933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000N nil)
23:36ynniv,(do (reduce *' (range 2 1000)) nil)
23:36clojurebotnil
23:36SgeoAtKaaZ, bignums
23:36ynniv,(do (reduce *' (range 2 100000)) nil)
23:36AtKaaZthanks
23:36clojurebotExecution Timed Out
23:36AtKaaZ,(class (*'))
23:37clojurebotjava.lang.Long
23:37wingywouldn't this be cool: https://www.refheap.com/paste/5705
23:37ynniv*' autopromotes
23:37AtKaaZSgeo, it expands as needed?
23:37AtKaaZ,(class (*' 19289821 7129872189889899))
23:37clojurebotclojure.lang.BigInt
23:37ynniv,(class (*' (range 2 100)))
23:37clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.LazySeq to java.lang.Number>
23:37ynniv,(class (apply *' (range 2 100)))
23:37clojurebotclojure.lang.BigInt
23:38AtKaaZ,(class (* 19289821 7129872189889899))
23:38clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
23:38AtKaaZnice
23:38ynniv,(do (reduce *' (range 2 100000)) nil)
23:38ynniv,(do (reduce *' (range 2 100000)) nil)
23:38clojurebotExecution Timed Out
23:38clojurebotExecution Timed Out
23:46ynniv,"/me sighs"
23:46clojurebot"/me sighs"
23:48dlitvak,(println "/me sighs")
23:48clojurebot/me sighs
23:48dlitvakclojurebot: you evil creature
23:48clojurebotI don't understand.
23:48dlitvakclojurebot: you disrespect the rules of irc
23:48clojurebotirc is only for opionfests
23:49dlitvak\(println "/me sighs")
23:49dlitvaklazybot: help
23:49lazybotYou're going to need to tell me what you want help with.
23:50dlitvaklazybot: help commands
23:50lazybotTopic: "commands" doesn't exist!
23:50dlitvaklazybot: help all
23:50lazybotTopic: "all" doesn't exist!
23:50dlitvaklazybot: help eval
23:50lazybotTopic: "eval" doesn't exist!
23:50dlitvaklazybot: help clojure
23:50lazybotTopic: "clojure" doesn't exist!
23:50dlitvaki hate bots...
23:52ynniv,(do (Thread/sleep 5000) (symbol "Hi!"))
23:52clojurebotHi!
23:52SgeoI wasn't watching, did it sleep?
23:52ynniv,(do (Thread/sleep (* 10 1000)) (symbol "Hello from 10 seconds ago!"))
23:53ynniv2
23:53ynniv3
23:53ynniv4
23:53ynniv5
23:53ynniv6
23:53ynniv7
23:53clojurebotExecution Timed Out
23:53ynniv8
23:53ynnivbah
23:53Sgeo,(symbol "&(println "boom"))
23:53clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading string>
23:53Sgeo,(symbol &(println "boom"))
23:53clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(NO_SOURCE_PATH:0)>
23:53ynnivhaha
23:54Sgeo,(symbol "&(println \"boom\")")
23:54clojurebot&(println "boom")
23:54lazybot⇒ boom nil
23:54ynnivSgeo: you're no good
23:54ynniv:-)
23:55SgeoConsidering the -> I don't see a way to do it
23:55SgeoThen again, I suck at botloops
23:55ynniv,(symbol "&(symbol \"boom\")")
23:55clojurebot&(symbol "boom")
23:55lazybot⇒ boom
23:55ynnivperhaps someone thought of this
23:55ynniv&1
23:55lazybot⇒ 1
23:56ivanmaybe you can get a multi-line message
23:56AtKaaZsomething like make the other bot dec rhickey's karma :)
23:56AtKaaZonly cause normal users can't do it :)
23:57ynniv1 ,2
23:57ynniv&(println "\n1")
23:58lazybot⇒ 1 nil
23:58Sgeo&(symbol "hi\nbye")
23:58lazybot⇒ hibye
23:58AtKaaZthat works in repl
23:59AtKaaZ,(symbol "hi\r\nbye")
23:59clojurebothi
23:59clojurebotbye
23:59AtKaaZi did not believe it
23:59Sgeo&(symbol "hi\r\nbye")
23:59lazybot⇒ hibye
23:59SgeoAtKaaZ, note the different bots
23:59AtKaaZoh right
23:59AtKaaZfinally, I was right to not believe :)