#clojure logs

2012-10-04

00:12ori-li'm new to clojure and am totally boggled by namespaces -- there seem to be 12 ways of managing them. since i'm still learning the language, i'd like to have an ease way to load the repl and have all the bindings from my clj file in the immediate repl scope.. how do i do that?
00:12gertori-l: use leiningen
00:12SgeoIf I add-watch on a mutable reference, and then sometime after that nothing is holding on to the mutable reference, will it stick around due to the watcher holding the reference to the mutable reference in memory, or will it be GCed, along with the watches?
00:12gertori-l: http://leiningen.org/
00:13ori-lgert: i did. lein new foo, editing things in foo/src/core, not available in repl unless i require
00:13gertah.
00:13gertyes
00:13uvtcori-l: there's a link to this tutorial http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html in the cheatsheet.
00:13ori-l(as far as i remember -- i last butted my head with this a few hours ago)
00:13ori-luvtc: this looks useful..
00:14uvtcori-l: if you create your project as an app, like so: `lein new app my-proj`, and then `cd my-proj` and start a repl, it will be in your project's namespace by default.
00:14ori-luvtc: why isn't that the default? is the default template geared toward libraries?
00:15uvtcori-l: yes, the default template is geared for creating libs.
00:15rmarianskiori-l: (ns my-namespace)
00:16uvtcori-l: what rmarianski said. :)
00:17ori-lthis is a little nuts. just think of the number of discrete concepts you need to grok to fully parse this line: (use '[clojure.string :only [split]])
00:19uvtcori-l: I suggest not using `use`. Prefer `require` (in the repl) and :require in your own `ns` macro.
00:21ori-lyes, that's what the tutorial recommends too
00:21uvtcori-l: just curious; which tutorial are you following?
00:22ori-li'm a bit too erratic to follow one thing through, so i'm solving problems on 4clojure and going to the books when i get stuck
00:22uvtcAh.
00:24ori-lthe riddles are mostly about transforming sequences, though, and i feel like what i'm missing is how to glue these transformation together into a program. can you recommend some short, idiomatic open-source clojure apps?
00:28uvtcori-l: what sort of app do you want to write?
00:28ori-luvtc: reads udp datagrams, parses them, slots them into redis
00:29ori-luvtc: but i'm not particular.. if that's not a particularly good problem to explore clojure with i could fish around for something else to do
00:31uvtcori-l: the only suggestion I think I can make is that you might try what I've done: start a new lein app project. Into -main put a call into some high-level function that seems like it ought to do what you want, then work your way down. :) Top-down like that works nicely for me.
00:32uvtcori-l: sounds like you're going to need a few extra pieces working too though, such as db connectivity and network support. You might ask about those separately at a time when this place has more active folks. Maybe in 10 hours or so.
00:33ori-lthanks, both good tips
01:39spoon16I'm looking for advice about running noir in production
01:40spoon16it uses embedded Jetty right? but I can also build a war and deploy that to standalone Jetty....
01:40spoon16what is the best practice?
01:40spoon16there does not seem to be clear documentation
01:42Raynesspoon16: lein-ring
01:42Raynesspoon16: Look at gen-handler in noir.
01:42RaynesYou can generate a handler that can be passed to run-jetty (and specified in your lein ring config).
01:44spoon16looking
02:00spoon16lein-ring talks about being run as a development web server
02:00spoon16I may not understand linux system administration well enough
02:00spoon16but how do you set things up so that if the process crashes it is restarted?
02:15spoon16upstart for Ubuntu looks like a good way to keep things running
03:31beberleiin clojure sql examples you often see the (into [] results) inside with-query. is there anything similar to get all values into a vector of records?
03:43amalloyit sounds like you just described exactly what you're asking for
04:00LongGood afternoon everybody!
04:00LongI am trying to :gen-class a Servlet
04:01Longthis is my code
04:02Long(ns test.test
04:02Long(:import (java.io PrintWriter) (javax.servlet.http HttpServlet))
04:02Long(:gen-class :name test.TestServlet :extends javax.servlet.http.HttpServlet))
04:02Long(defn -doGet[request response]
04:02Long (let [wrtr (.getWriter response)]
04:02Long (.println wrtr "hello from clojure")))
04:02Longit can't be compiled by Lein
04:02Longit said "Exception in thread "main" java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet (Test.clj:1)"
04:03LongI already modified the :library-path in Lein as ":library-path "/home/long/workspaces/spring/LongHDi/war/WEB-INF/lib"
04:04Longbut it didn't work
04:04Longdo you have any idea why it did not find the class?
04:56lpetitHello everybody, everybody hello
04:57ejacksonHello lpetit !
04:57clgvbonjour monsieur
04:57lpetitejackson: congratulations for your talk at the conj !!!
04:57lpetitclgv: bonjour jeune homme
04:57lpetit:)
04:57ejacksonthank you :)
04:58ejacksonI'm running around a bit to develop something worth presenting
04:58ejacksonI was thinking that 45 mins of lolcats might not make me popular :)
04:58ejacksonalthough....
04:58lpetitYMMV :)
04:59ejacksonindeed
04:59ejacksonI'm just back from Strata in London where I was pushing all things Clojure
04:59lpetitI guess people will definitely expect more from you ;)
04:59lpetitWhat's this Strata thing ?
04:59ejacksonits a conference put on by O'Reilly about data
05:00ejacksonits fully buzzword compliant, but did manage to attract some nice hackers
05:00ejacksonthey hold the conference every few months in a different city so it always seems to be on :)
05:00lpetithe
05:03ejacksonlpetit: you standing today ?
05:03lpetitejackson: no, but I should, I'm almost asleep :)
05:04carkhow should i go about providing clojure style equality to a type i created with deftype ?
05:04ejacksonhehe, I also succumb in those times to sitting
05:05lpetitejackson: but it's a clear indicator that maybe we should rest.
05:05lpetitOk, let's take a snap :)
05:06lpetitI haven't done standing much these days. I need to by a separate keyboard.
05:06clgvcark: assuming the fiels of you deftype are pure clojure data you can just compare them
05:07carkbut isn't there an interface i should "derive" from ?
05:08ejacksonlpetit: yeah the keyboard is critical
05:09clgvcark: you just need to overwrite `equals` and `hashCode` from java.lang.Object
05:09carkallright thanks
05:17carkclgv: thanks, worked like a charm
05:17carktho i'm not quite sure how good my hashCode is =D
05:17carkI should just minimise potential collisions, right ?
05:18carklike add a random (per class) number to the sum of hashcodes of my enclosed data ?
05:21clgvcark: clojure exposes it's own hash function clojure.core/hash
05:22clgvcark: you should not do a per class modification when you want clojure's comparison by value semantic
05:22clgvcark: you could return (hash [field1 field2 ...])
05:23carkwell if i have class A and class B which both contain a char, but I don't want these to be equal even when containing the same char, so they should have a different hashCode ?
05:24clgvyes, but then you do not have comparison by value anymore
05:24carkright, I'm not really building a clojure style container or collection
05:24carkit's actually the Either type
05:25cark(Left 1) and (Right 1) should not be equal
05:25carkanyways thanks !
05:26tomoj&(clojure.set/union {1 2 3 4} {3 4 5 6})
05:26lazybot⇒ {5 6, 1 2, 3 4}
05:26tomoj&(clojure.set/union [1 2 3] [3 4 5])
05:26lazybot⇒ [1 2 3 3 4 5]
05:27tomoj&(clojure.set/intersection #{1 2 3} [4 5 6])
05:27lazybot⇒ #{1 2}
05:27tomoj(clojure.set/intersection #{1 2 3} {3 4})
05:27tomoj&(clojure.set/intersection #{1 2 3} {3 4})
05:27lazybotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IPersistentSet
05:27carkwoah the intersection with vector and set is pretty bad =P
05:28tomojI wonder if those are bugs
05:28carki'd say undefined behaviour
05:28tomojI know I saw code that depended on the union of a vector
05:28tomojI think it was in the cljs compiler
05:28clgv,(doc clojure.set/intersection)
05:28clojurebotExcuse me?
05:28clgv&(doc clojure.set/intersection)
05:28lazybot⇒ "([s1] [s1 s2] [s1 s2 & sets]); Return a set that is the intersection of the input sets"
05:28clgvtomoj: "input sets" so it is a user error^^
05:29tomoj&(clojure.set/union {1 2 3 4} #{3 4 5})
05:29lazybot⇒ #{[3 4] [1 2] 3 4 5}
05:29tomojsure
05:30tomojbut what should clojure do?
05:31clgvwell, that' the discussion "checking every possibility VS assume some knowledge of the user"
05:31carkthat's clojrue for you, providing the fast path, let you shoot your foot
05:31carki like it this way
05:32carkmeans *I* can be so much more inefficient =)
05:32ejacksonafter a few days conferencing I'm so glad to get back to coding
05:32ejackson(with a cold, compliments of the huddled masses of fellow conferenceees)
05:34tomoj&(clojure.set/union #{} "foo")
05:34lazybot⇒ "foo"
05:34tomoj&(clojure.set/union #{1} "foo")
05:34lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection
05:34tomojclgv: makes sense
05:35kralnamaste
05:35tomojbut it is hard to see where to draw the line
05:35ejacksonand good luck !
05:35clgvtomoj: you could wrap a contract function with :pre :post around those for your development phase
05:35tomojwith alter-var-root?
05:36clgvnot necessarily. fogus wrote about it,
05:36clgvjust write a second function with pre post that calls that one
05:37tomojlooks like trammel uses alter-var-root
05:37tomojbut, yeah
06:07clgvtomoj: you could use trammel right
06:18wingywhy is :/sdasd invalid as keyword but :/sd/asd valid?
06:47clgvwingy: namespaced keyword probably only looks for the last /
07:13marianoguerrahi, how can I store a "reference" to a module in a dynamic variable?
07:13marianoguerraI want to be able to change that dynamic variable when testing
07:13marianoguerraor is there any other way of achieving this?
07:14clgvwhat is a "module"?
07:14marianoguerra(new to clojure) a set of functionallity in a namespace
07:15clgvmarianoguerra: do you mean a namespace?
07:15marianoguerraclgv: maybe :)
07:15clgvmarianoguerra: what exact yrtifact do you want to exchange?
07:15marianoguerraI have a namespace that stores objects in a database
07:15clgv*artifact
07:15marianoguerraI want to change it for tests
07:16marianoguerraother one is a messaging namespace, I would like to be able to "mock" those for testing
07:16clgvmarianoguerra: you know that functions are first class in clojure? so you could just pass a function along
07:16clgvmarianoguerra: do you use midje for testing?
07:16marianoguerraclgv: but if I'm testing a ring handler I don't want to pass the storage functions to it so it knows how to test
07:17marianoguerraclgv: will look at midje, I'm coding in clojure since a week :)
07:17clgvmarianoguerra: well you can assign a function to a dynamic variable if you like to
07:18carkmock functions =)
07:18marianoguerraclgv: ok, that would work too :)
07:18marianoguerranamespaces in clojure are like in java? (non first class?
07:19marianoguerrain python/js/erlang I can store the module in a variable and use the variable, that's why I was asking
07:19clgvmarianoguerra: there are namespace objects.
07:19lotiamarianoguerra: you can use the :as keyword to alias a namespace
07:20clgvbut I dont think that mocking the whole namespace via a variable is idiomatic
07:20marianoguerraclgv: ok, will check midje and do the function in a variable thing, thanks!
07:20clgvmarianoguerra: usually you would mock the functions individually
07:43wingyclgv: yeah forgot it was a namespace
08:32ds300Anyone know how I can extend a custom java class which implements an immutable map to use assoc and dissoc? Can I just make it implement IPersistentMap or is there something easy I can whip up with protocols?
08:33wingyis datomic open source?
08:33altioushi
08:33altiousdoes anyone got an idea why 4clojure dislikes def s?
08:33altious"You tripped the alarm! def is bad!"
08:34beberleiit wants you do work without defs
08:34xeqialtious: it uses clojail, which blocks it for security and isolation from other users
08:34beberleilet always works instead
08:35altiousmay someone give me advise how to rewrite this without using def? http://pastie.org/4908536
08:35altiouslet is not an option
08:36xeqids300: I think you have to implement that interface, the clojure on the jvm doesn't use protocols for that
08:36beberleiwith (fn fib for example
08:36xeqithere might be clojure in clojure for the jvm that does, but not yet
08:36xeqi* one day there might be
08:37xeqiwingy: no, it is closed source
08:37SgeoCan someone please explain TryClj's behavior here? https://www.refheap.com/paste/5496
08:37wingyxeqi: :(
08:37ds300altious: (map (memoize fib) (range 1 (inc x))) ?
08:37altiousds300, no
08:37altiousfib uses fibm inside
08:37wingyclosed source is never good for business!
08:37altiousfib use memoized results as well
08:38SgeoWho's the genius that thought that letrec would be unnecessary in Clojure?
08:38Sgeo:(
08:38altiousmaybe i can rewrite (def fibm (memoize fib)) with defn?
08:41altiousdoh :(
08:41altiouswriting without defs is effectively impossible
08:41altiousdon't remember such limitations earlier
08:42Sgeoletfn?
08:42cark,(doc letfn)
08:42clojurebot"([fnspecs & body]); fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+) Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body."
08:42carkbeat me to it =P
08:42Sgeoletfn is recursive, but it kind of sucks that it's limited to functions
08:42algernonaltious: loop + recur?
08:42SgeoErm, using function syntax
08:42altiousalgernon, code may be not left recursive
08:43altiouslike in this case
08:43SgeoBecause you want to use fibm and have it visible from before it, but writing fibm as a function with an argument is tedious and idiotic
08:43algernonaltious: aha, I see
08:43Sgeo(Well, ok, not very tedious, but it's still stupid.)
08:43clgvaltious: you can write single recursions without def like: (fn [x] ... (recur (inc x)))
08:45carkalso don't have to have tail recursion with this :
08:45cark,((fn blah [val] (when (> val 0) (blah (dec val)))) 10)
08:45clojurebotnil
08:45carktho it's tail here
08:45clgvaltious: in the case of fibonacci numbers you should use dynamic programming since you need all previous numbers anyway
08:46altiousclgv, you mean to storea a map of earlier values manually?
08:47clgvaltious: no you calculate the whole vector up to the number.
08:47clgvthere should be a lot of examples on the net ;)
08:47altiousclgv, memoization in this sample give us more
08:47clgvmore runtime ;)
08:48altiousit removes necessity to always do "+1"
08:48altiouserr. no sure i can explain this
08:48altious*not
08:50SgeoSeems like defns at tryclj expire
08:50SgeoNot sure if it's after a number of lines or after an amount of time
08:50clgvSgeo: I think your whole session expires overthere
08:50altiousone more question
08:50SgeoI think it's number of lines
08:50altiousis there a builtin fucntion which executes f(x), receives result of function and pass the result back to f(x) as param?
08:51altiouscreating infinite loop
08:51clgvaltious: `iterate`
08:51altiouswith shared state
08:51SgeoWell, (comp last iterate)
08:51Sgeooh
08:51clgv,(iterate + (range 5))
08:51clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: Cannot cast clojure.lang.LazySeq to java.lang.Number>
08:52Sgeo,(iterate + 5)
08:52clojurebot(5 5 5 5 5 ...)
08:52clgv,(take 10 (iterate inc 0))
08:52clojurebot(0 1 2 3 4 ...)
08:52altiouserr
08:52altioussomething like fsm
08:52Sgeo,(type (last (range 3))
08:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
08:52Sgeo,(type (last (range 3)))
08:52clojurebotjava.lang.Long
08:52altiousdo i really have to have a lazy seq :\
08:53Sgeoaltious, last tries to get the last element of a lazy seq
08:53clgvaltious: otherwise you have to write that function yourself, but then you need a stop criterion as well
08:53altiousclgv, probably System.exit ? :)
08:53altiousoh, criterion
08:53altiousof course
08:54lpetitclgv: say you have this expression in an editor : "^foo :bar" and your cursor is at the start. Say you hit "forward delete" key. Currently it throws an exception. So I have to fix it.
08:54clgvlpetit: it's the mean reader, I guess ;)
08:55lpetitthe issue is in the :paredit-forward-delete of paredit's multi method.
08:56lpetitclgv: my question is: what should be the correct behavior, so that it is consistent with the rest of paredit mode?
08:56lpetitshould the expected result be "^foo :bar" with cursor after the ^, or should it erase the ^and bring "foo :bar" as a result
08:56lpetitclgv: I guess the former would be more consistent
08:58clgvlpetit: the first suggestion is the behavior with parentheses, right?
08:59lpetitclgv: right
08:59clgvlpetit: well, then it's probably the consistent one
08:59lpetitagreed
08:59lpetitdeal :)
09:01clgvlpetit: I got my hands on repl backward search on monday after setting up the dev environment.
09:01lpetitoh great
09:01clgvlpetit: not completed yet - but maybe next weekend
09:01lpetitmake sure to synchronize somehow with cemerick because I know he's quite busy correcting issues atm
09:02lpetitgrrrr8 ! :)
09:02lpetitI should mark you as a developer, so you can mark the issue as started
09:03clgvlpetit: do you still have a CA to sign? I read something on the google code page somewhere
09:06lpetitclgv: it's still not ready (shame on me). But when it's ready (in one month ? one year ?) you can sign it and it will also concern past contributions to the project. So since I trust you, if you say to me now that you'll sign it eventually, that's fine with me.
09:08clgvlpetit: ah ok. that was not obvious from that page ;)
09:08lpetitsure, I don't remember why I suddenly stopped the initiative. One more thing on my plate .. :)
09:08lpetitclgv: you're now have the "commuter" profile, I hope it allows you to update issues
09:10clgvlpetit: I marked it "started"
09:11lpetitclgv: thanks, it will help a lot tracking what's happening
09:15jweissis there a way to have a var's root binding be an alias to another var (when the target changes, so does the alias). and still be able to make thread-local bindings?
09:15clgvjweiss: afaik, there is no real defalias even the one in contrib copied the root binding
09:16jweissclgv: so i would have to set the var's value to another var, and explicitly deref everywhere i want to get the value?
09:17clgvjweiss: sounds like that would get the job done. you should make sure that you really need such behavior, though
09:19jweissclgv: i have 2 ns's, api and conf. conf reads in some credentials at runtime, but doesn't know anything about the api ns. the api ns needs to have a default value for the credentials as soon as conf knows them.
09:21clgvjweiss: so why do you need the alias? you could just use the var defined in conf in the api namesapce
09:22jweissclgv: hm, that is a good point. i don't want api to mess with the value in conf, but thread-local bindings would be ok because no other ns would end up seeing any change.
09:23clgv jweiss: you mean no other thread, I guess ;)
09:24jweissclgv: well, even the same thread. i know clojure isn't stopping other namespaces from seeing the thread-local change, but the api namespace doesn't call anthing that would care.
09:32clgvjweiss: if the thread local bindings must not be visible for other ns - then thread local bindings are probably wrong for that task
09:42clgvlpetit: should the completion work with namespace-alias already?
09:42jweissclgv: that's why i wasn't using the same var between conf and api. but the model you suggest should work, it's just a different assumption than i had before. might have to comb through the code to make sure it's all going to accept the change and fix where necessary. thanks for the help.
09:43lpetitclgv: yes
09:43lpetitand it does, afaik
09:43clgvlpetit: but nor for protocol functions?
09:43clgv*not
09:44wingywhy are they using "c" in [:find ?c :where [?c :community/name]] in datomic
09:44wingywhat does c stand for?
09:44ejacksonanything
09:44Bronsaa variable
09:44wingywhy not ?e for entity
09:44wingyor ?i for id
09:44wingyjust want to know why they picked c
09:44clgvcommunity starts with c ;)
09:44wingyah
09:45wingyriddle solved
09:45clgvjust guessing ^^
09:45lpetitclgv: ??
09:45lazybotlpetit: What are you, crazy? Of course not!
09:45wingyclgv: has to be right
09:46wingylol
09:46wingyif i just read 1 more sentence
09:46wingyThe :find section specifies we want to retrieve all values of the variable ?c (for community).
09:46clgvlpetit: normal functions are suggested in the completion dialog but protocol functions are not, it seems
09:46lpetitclgv: well, if they are present in ns-publics, they should show up
09:47clgvlpetit: they are only suggested if I used them once before in the file.
09:47clgvon 0.10.1 stable
09:48lpetitclgv: I'll check that. Maybe it's a bug in clojure-complete which has been inherited by ccw ..
09:51clgvwingy: fail ;)
09:52clgv(dec wingy)
09:52lazybot⇒ -1
09:52clgv:P
09:52lpetitclgv: you're right, it's a bug. Can you please file an issue ,
09:52lpetit?
09:54clgvlpetit: "code completion" is the right term here?
09:54lpetitclgv: Eclipse 's jargon is "content assistant", but using "auto completion" or "code completion" is fin
09:54lpetite
09:54lpetit"content assist"
09:59clgvlpetit: done. #451
10:01lpetitok, tthx
10:04iosicaquestion about java interfaces and clojure:
10:04iosicaI have 2 interfaces A and B extends A
10:04iosicaA defines a method foo
10:04iosicaB defines a method bar
10:04iosicain clojure I reify A and assign implementation to var a
10:04iosicahow do I reify B and reuse implementation from a for foo method defined in A
10:08chouseriosica: factor out the common code into a function and call it from each refiy?
10:08clgviosica: you cant directly
10:08clgviosica: what chouser said ^^
10:09iosicaok, I'll have to dup then, as my A actualy has 10 methods and B adds 2
10:09iosicathx
10:11pandeiroanyone know the difference between a java.io.InputStream and a java.io.FilterInputStream?
10:13antares_Langohr doc guides are up: http://blog.clojurewerkz.org/blog/2012/10/04/announcing-langohr-documentation-guides/, http://clojurerabbitmq.info
10:14clgvpandeiro: InputStream is abstract, FilterInputStream not
10:21TimMc&(cycle [])
10:21lazybot⇒ ()
10:22iosicatrying from a different angle:
10:22iosicasay I have interface B with 2 methods foo and bar
10:22iosicaI reify B to var b
10:22iosicais it possible to dynamically change the impl of foo method on b?
10:24clgviosica: if you use `proxy` instead, yes
10:24iosicamoce, so how do I use proxy for this?
10:26iosicaclgv: update-proxy?
10:27clgviosica: yes. there is an example in JoC
10:31iosicaclgv: thx I got it
10:52iosicaclgv: I have a solution to my original question, works fine with proxies
10:52iosica(def a
10:52iosica (proxy [rvm.stat.A] []
10:52iosica (foo [] "foo called")))
10:52iosica(def b
10:52iosica (-> (proxy [rvm.stat.B] [] (bar [] "bar called"))
10:52iosica (update-proxy (proxy-mappings a))))
10:52iosicauser=> (.foo b)
10:52iosica"foo called"
10:52iosicauser=> (.bar b)
10:52iosica"bar called"
10:53clgviosica: good. :) next time use a gist on e.g. refheap ;)
10:54carkomg i've been developing quite a bit based on the state monad, state-t, and now i find that because there's no tail call optimization in clojure it breaks with a stack overflow on larger datasets
10:54carkthat one won't be easy to fix =/
10:54clgvcark: you probably have to use trampoline therefore
10:55carkyeah, won't be easy at all
10:55mpenetsweet, we are finally getting column metadata
10:56cark m-bind (with-monad m (fn m-bind-state-t [stm f] (fn [s] (m-bind (stm s) (fn [[v ss]] ((f v) ss))))))
10:56carknow trampoline this
10:56cark=P
10:56carkit truly returns a value in the end
10:57carkbut hell
10:57carkm-bind is like the very base of everything monadic
10:58carkthen what if the state is itself a function
11:22mmitchel_what's the most succinct way to apply a function to every value in a map, and get a new map back? I'm using reduce, thought about doing map wrapped in an "into"... but thinking there must be a simpler, core function to do this?
11:23_ulisesmmitchel_: how about merge-with?
11:23_ulises&(doc merge-with)
11:23lazybot⇒ "([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
11:23_ulises&(merge-with inc {:a 1} {:a 1})
11:23lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$inc
11:24_ulises&(merge-with #(inc %1) {:a 1} {:a 1})
11:24lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: sandbox7657$eval57656$fn
11:24_ulises&(merge-with (fn [a _] (inc a)) {:a 1} {:a 1})
11:24lazybot⇒ {:a 2}
11:24mmitchel__ulises: ahh ok, thanks. that's what I'm after!
11:24_ulisesI know it's ugly, but that might work for you
11:25_ulisesI'd certainly document what you want, because when you come back and see (merge-with your-fn the-map the-map) it's likely that you'll go wtf?
11:25mmitchel_yeah maybe so :)
11:27clgvthe merge-with approach is strange.
11:27clgvclojure 1.4 has reduce-kv
11:28clgvmmitchel_: ^^
11:28mmitchel_clgv: cool, i'll check that out
11:28mmitchel_,(doc reduce-kv)
11:28clojurebotExcuse me?
11:28mmitchel_&(doc reduce-kv)
11:28lazybot⇒ "([f init coll]); Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no en... https://www.refheap.com/paste/5510
11:31clgv&(reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 1 :b 10})
11:31lazybot⇒ {:b 11, :a 2}
11:42clgvlpetit: does the auto completion need a literal "defn" statement to work?
11:42lpetitclgv: ?
11:42clgvlpetit: I have a defn+opts that expands to a defn
11:43clgvand the auto completion doesnt show me that one. gotta restart the repl to double check
11:43lpetitauto completion is dynamic, it calls (ns-publics), etc., so yes that should just work
11:44clgvlpetit: oh well, than namespace aliases are broken in general.
11:45clgvlpetit: oh. there is a difference whether I use it in the repl or in the editor
11:46clgvlpetit: in the repl it works - in the editor not
11:46lpetitclgv: must leave for 30', feel free to fill in an issue please
11:46clgvlpetit: I'll add a comment to the previous one
11:46lpetitok
11:46lpetitbbl
12:20abalonecljsbuild question: i had it generate a debug version and an optimized version. the optimized version throws an exception that the debug version does not. has anyone seen something like this? please see the issue at https://github.com/achengs/subpar/issues/1 which has a link to a page that demos the exception
12:22abaloneif you want to see the debug version handle your requests without throwing the exception, go to demo.html instead
12:22hiredmanabalone: how familiar are you with the google closure model?
12:22ds300Anyone know how to convert a java Iterable to an ISeq from within java without writing a wrapper class? There must be something in clojure.lang...
12:22abalonehiredman: not. also not very familiar with js
12:23hiredmanare you using any external libraries and expecting that to work?
12:23abaloneno
12:23abalonecodemirror is separate.
12:23abalonedidn't :use or :require
12:24abaloneonly dependency is clojure 1.4.0
12:26gfredericks"codemirror is separate" is a correction to "no"?
12:26gfredericksfor any raw JS libs you're using you'll need to provide an externs file to the cljs compiler
12:26abalonei didn't ask google closure to minify any codemirror stuff with mine. i kept the codemirror js file separate
12:27gfredericksabalone: so without the externs, any reference in your code to codemirror things will get munged and thus not work
12:27abalonewhat i mean is i have a plain js file that calls codemirror stuff. it also calls my cljs stuff. but my cljs stuff doesn't call any codemirror stuff
12:28gfredericksokay. then all you should need is for the functions in your code that you call from elsewhere to be exported
12:28abaloneso my cljs stuff is meant to compile and it does export functions for my plain js file to call
12:28gfredericksokay I'm out of ideas then
12:29abalonei think the fact that the debug version that the google closure tool outputs ... the fact that this version works is a good indication that i got it mostly right
12:29Bronsawow, :column metadata patch was pushed to clojure
12:30holohi
12:30redline6561hell yeah source maps!
12:31clgvBronsa: that means there is column information for a def additional to the line information?
12:31Bronsayeah
12:32gfredericksBronsa: what does column information consist of? How far indented the (defn ...) line is?
12:33technomancygfredericks: now you can write a lein plugin that yells at anyone who puts def in a nonzero column; what's not to like?
12:34gfredericksamalloy would not like that
12:34gfredericksand neither would I! we must fight for our right to top-level-let!
12:34Bronsagfredericks: column info is now also used in error messages
12:34clgvI like the sound of that commit: "reduce lock contention in MultiFn"
12:34hiredmanitym fight for our right to leak memory
12:35gfredericksBronsa: I wonder about it because I would think it's usually 0
12:35technomancygfredericks: why do you hate private def?
12:35gfredericksI guess maybe helpful for tools trying to find an in a filesexp?
12:36gfredericks"sexp in a file"*
12:36gfrederickstechnomancy: that only gives me only one kind of visibility
12:37technomancyclosing over stuff means you can't access it from the repl
12:38gfrederickstechnomancy: stop making me reconsider in public!
12:38hiredmanvars are the best
12:38hiredmanwhy do you hate them?
12:38gfredericksI don't hate them I just like hiding stuff
12:39hiredmanwhy do you hate me then?
12:39hiredmanhiding stuff is just going to make it harder for me to make your code do what I want
12:39gfredericksokay I renounce all previous opinions
12:40holois there any pattern for "any vector"? i want to use it in a multimethod
12:40clgvholo: vector?
12:40gfredericksholo: what are you dispatching on? the value of the vector?
12:41hologfredericks, yes, i'm dispatching a vector value
12:41holoclgv, yes
12:41clgvI mean: `vector?`
12:42gfredericksholo: then you could either use :default, or if not that, then you can't do it
12:42clgvor if your decision is not binary dispatch on `type`
12:42gfredericksmultimethods are a bit limited that way
12:42gfredericksclgv: it's not predicate dispatch so he couldn't just (defmethod foo vector? ...)
12:43holoclgv, gfredericks, no, i think you are spot on.. thanks. will try it. hope the order in which they are declared matter
12:43clgvgfredericks: I didnt suggest that. you can build something via `cond` and `vector?`
12:43gfredericksclgv: still using multimethods?
12:44holoclgv, oh, so you mean "vector?" as some available function for binary test. hehehe. no, the dispatch function doesn't evaluate that
12:44clgvgfredericks: yes. (defmulti foo (fn [x] (cond (vector? x) :vector (map? x) :map ...))
12:45gfredericksso depends if he can change the dispatch function or not
12:45gfredericksI was assuming not
12:46clgvhe didnt write that he can't change the defmulti
12:47gfredericksI think a dispatch function that only returns a fixed set of values somewhat defeats the purpose of a multimethod
12:48clgvgfredericks: dont forget the default case of the `cond` you can add (type x) there
12:49gfredericksdo vectors have more than one type?
12:49gfredericksI guess transients count
12:50clgvdunno, maps do. I didnt check since he said "all vectors" ... ;)
12:50hologfredericks, i think i can't change the dispatch function, because adding a new test would still oblige me to match the previous ones
12:50clgvotherwise `type` is sufficient. that way you can even use :type metadata^^
12:51jkkramer,(map (juxt vector? class) [[1 2 3] (subvec [1 2 3] 0 3) (vector-of :int 1 2 3)])
12:51clojurebot([true clojure.lang.PersistentVector] [true clojure.lang.APersistentVector$SubVector] [true clojure.core.Vec])
12:53lpetitjkkramer: hello
12:53jkkramerlpetit: howdy
12:54lpetitjkkramer: just wanted to know if you had switched back to emacs :)
12:54jkkramerlpetit: still using ccw :) though I occasionally find myself using emacs keychords
12:55lpetitjkkramer: wow, you're almost converted then :)
12:57jkkramerlpetit: I still wrangle with ccw's paredit now and then, but it's not too bad
12:58jkkramerlpetit: is syntax highlighting repl return values on the to-do list?
12:59lpetitjkkramer: ?
13:00lpetitno, indeed, but that could be a great addition. Feel free to file an issue !
13:00lpetit(working on REPL Log Area colors right now, for people using Eclipse Color Themes)
13:00jkkramerI used a hack in emacs for that and it was very helpful
13:01clgvdoes it make any sense to have `ref`s inside a `ref`?
13:05jkkramerlpetit: issue created
13:05gfredericksclgv: I hope not
13:05lpetitjkkramer: thanks. Must go now, see you.
13:05clgvgfredericks: well atoms in an atom makes sense
13:06clgvgfredericks: refs in a ref could - if the transaction fail semantic considers that
13:06jkkramerclgv: see http://clj-me.cgrand.net/2011/10/06/a-world-in-a-ref/ and https://github.com/cgrand/megaref
13:07gfredericksclgv: what do you use atom atoms for?
13:07clgvjkkramer: thanks =)
13:08Frozenlo`technomancy: Thanks for the mostly lazy podcast!
13:08djanatynI don't have access to clojars right now, but I managed to download the joda-time jar
13:08djanatynhow can I use the classes inside in clojure, just with the jar? I use leiningen and nrepl inside emacs
13:09wingydatomic question: i get a vector with all ids with (def results (q '[:find ?c :where [?c :item/name]] (db conn)))
13:09djanatynI tried starting lein repl inside the directory with the jar, but I'm not entirely sure what classes to iport anyway
13:09wingynvm
13:12wingyback to my question
13:12wingythat will give me : [[17592186045424], [17592186045423], [17592186045425], [17592186045427], [17592186045428], [17592186045429], [17592186045431]]
13:12wingywhat is the best way to loop through each of the ids?
13:13antares_wingy: map over them to get the first value of each vector, then doseq or map or whatever you need?
13:16wingyyeah map is good
13:17djanatyncan I launch "lein repl" with the classpath including the current directory?
13:18lynaghkping: ohpauleez
13:18ohpauleezlynaghk: pong
13:18ohpauleezinternet already?
13:18lynaghkI'm at a coffee shop.
13:18ohpauleezstaying strong - I admire your dedication - what's up?
13:19lynaghkBut yeah, realized I should get an Internet hookup at my apt. otherwise my sq. meter of monitor space is basically wasted.
13:20lynaghkohpauleez: I need someone to bounce ideas off of re: the grammar of graphics and, more generally, architectural tradeoffs between specificity and generality.
13:20lynaghkbasically, a technical beer or two. You have time later today?
13:21ohpauleezI do. I'll be busy around 3:15-3:45 and 7:45-8:15 - other than that, just call/text and I'll bike to wherever
13:21muhoois something dead at heroku and/or maven? it's complaining that the checksums on clojure don't match.
13:22muhooRetrieving org/clojure/clojure/maven-metadata.xml, Checksum validation failed, expected 9c684b580e1a70ab5eea761b854e1899152d4a40 but is a7d750077d5f2d54ae2d660a48539f7b068bda8f
13:22ohpauleezmuhoo: I know heroku keeps their own mirror of things and last week maven central was all over the place (down and up without reason, missing packages)
13:23muhoo:-/
13:23technomancymuhoo: no don't do that; #heroku is useless
13:23technomancylemme take a look
13:24muhootechnomancy: thank you!
13:24wingyi ended up with this: (map #(d/entity (db conn) (first %)) (q '[:find ?item :where [?item :item/name]] (db conn)))
13:24wingygave me a vector with all entities
13:26technomancyanyone else seeing checksum mismatches for clojure?
13:27technomancymuhoo: also, did it say which repo it was coming from?
13:27wingyfail again
13:27borkdudeWhat's with this (Object.) in get-in? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5517,L5534
13:27wingy(dec wingy)
13:27lazybotYou can't adjust your own karma.
13:27wingyone more line and i could see they using map
13:27wingyim such a failure!
13:28scriptorborkdude: the key is in line 5530
13:29scriptorsentinel is the not-found value for that get call, and I guess they need to use identical to make sure that they actually got sentinel
13:30borkdudescriptor ah right…
13:30pandeirowhy is intern called intern?
13:30dnolennice :column metadata made it into 1.5.0
13:30dnolenalpha
13:31shaungilchristpandeiro: "To confine, especially in wartime." /war/run
13:31emezeskednolen: Last I heard, you were pessimistic about that happening. That's great news!
13:32technomancypandeiro: I think it's a CLism
13:33dnolenemezeske: yes it is.
13:34pandeirothanks shaungilchrist technomancy
13:36scottjdnolen: when I saw that commit I wondered if today was your birthday :)
13:42dnolenscottj: haha, let's get excited when we can actually step through sexprs in Chrome.
13:42_firesofmayAnyone tried this Clojure to Obj C Library? https://github.com/joshaber/clojurem
13:42dnolen_firesofmay: no, and it looks stalled
13:43_firesofmaydnolen, oh :-/
13:43firesofmaydnolen, Why do you think its stalled? Last update was 22 days back.
13:44dnolenfiresofmay: if you want to interop with iOS I think it would be more useful to hear issues around leveraging ClojureScript for that via PhoneGap or JavaScriptCore directly etc.
13:45dgrnbrg_Hey clojurians--I have an interesting problem that i'm trying to find a more elegant solution to in clojure
13:45dnolenfiresofmay: I follow him on Twitter. Just a hunch.
13:45firesofmaydnolen, Hmm.
13:47dgrnbrg_I have an atom that periodically gets assigned a new value, and often that value corresponds to a resource on an unreliable blocking network resource. I need to fetch that resource's data and update a textbox with its contents, and when the resource changes, display "loading..." until the resource becomes available. I'm currently using a swing timer and futures to do the blocking reads, but this causes problems if the resource beco
13:48dgrnbrg_since too many threads spawn. I have experimented with using an atom for rate-limiting, but the imperativeness of the code makes me sad
13:48firesofmaydnolen, people are using Clojurescript to write iOS Apps? Any idea?
13:49dnolenfiresofmay: not that I'm aware of. But people write iOS apps w/ JS so seems like a promising direction to me.
13:49dnolenfiresofmay: certainly interested in anything that makes that easier for people
13:50_ulisesdnolen, firesofmay: it may be an idea to try clojurescript + phonegap
13:51firesofmaydnolen, I was learning Obective C today. Makes me feel so yuck :-/ specially after learning basics of clojure.
13:51_ulisesdgrnbrg_: without any more context or knowledge, it almost sounds like you could be using agents there
13:51firesofmay_ulises, yeah dnolen was suggesting the same thing.
13:51_ulisesfiresofmay: oh, I'm late to the party then ... as always.
13:52firesofmay_ulises, it's cool :)
13:52dnolenfiresofmay: I like fine Obj-C for what it is, but I'd much prefer to program in Clojure if I could.
13:53dgrnbrg__ulises: it does feel like something that could be done with agents, but it's more of a single agent sending the function to itself, repeatedly
13:53firesofmaydnolen, Yeah. And moreover I've heard that phonegap (or similar) apps are damn slow. So clojurescript might not work for everyone.
13:54_ulisesdgrnbrg_: and how is that bad? :)
13:54_ulisesdgrnbrg_: I mean, other than it potentially being insane and all
13:54dgrnbrg__ulises: i made the mistake of using swing for a gui :/
13:54dgrnbrg_lol
13:54dgrnbrg_so i've been losing my sanity slowly as threads overwhelm me
13:56uvtcHi #clojure. I've been working on a Clojure tutorial. It's currently at http://www.unexpected-vortices.com/clojure/cds/tutorials/introduction.html . Feedback appreciated.
13:56_ulisesdgrnbrg_: can you have the update fns update the swing component and then call itself again?
13:56dgrnbrg__ulises: that's what i'm thinking about. But there's the additional issue of rate-limiting
13:56dgrnbrg_i mean, I can solve it all, but i was hoping there's a lib I haven't heard of that I could use :)
13:57dnolenfiresofmay: I started on something like a XCode project template for doing CLJS last year but I'm too busy with other stuff. Basically it would be sweet to have a XCode template project that could run the ClojureScript compiler and give you a REPL for live coding.
13:58_ulisesdgrnbrg_: if you want to go down the library route, you could enqueue requests using aleph channels and have the agent pull these and rate limit the frequency of the pulls
13:58dnolenfiresofmay: yes there are some kinds of apps (mostly games) where I think this might not be fast enough.
13:58_ulisesdgrnbrg_: but I'd keep it simple initially, try with an agent without rate limiting. Then you can wrap the update fn of the agent with something that retries, rate-limits, etc.
13:59_ulisesdgrnbrg_: i.e. make those two orthogonal
13:59firesofmaydnolen, yeah live coding is what would set it apart besides beautiful code. And to think of it, it'll open up a huge door for clojure developers to make iOS apps.
14:01casionuvtc: do you mention keywords as functions in here?
14:02uvtccasion: Oh, y'know, I accidentally omitted that. Thanks. The source is on github, btw.
14:02dnolenfiresofmay: somebody w/ a lot of time (& probably money) could try something like RubyMotion ...
14:03pandeiroyou can't destructure nested keys in defn arguments?
14:04casionuvtc: IMO, it maybe worth mentioning that when you say "we can get a modified copy of the data structure", that you're not actually getting a new object like one would expect in another language
14:05TimMcpandeiro: Huh, I guess not. Interesting design tradeoff.
14:05casionwhen I started clojure that confused me that it was "returning copies"… and in fact I'm pretty sure you're the person who clarified that for me :)
14:05pandeiroTimMc: did you not know that?
14:06pandeirodnolen: firesofmay: i did a basic cljs wrapper for the casperjs (phantomjs) api and i like the idea of doing the same for phonegap when i have time... would love to write clojure for android; my brain is just not big enough for java syntax
14:06TimMcpandeiro: I had never tried it before.
14:06pandeiroTimMc: so you are calling me weird?
14:06pandeiro:)
14:06pandeiroit works with let, right?
14:06muhootechnomancy: maven, iirc
14:07TimMcpandeiro: I think it uses the desctructure macro.
14:07uvtccasion: updated, thanks.
14:07muhootechnomancy: no, it was s3pository
14:08technomancymuhoo: still getting it? I can't reproduce here
14:10firesofmaypandeiro, Clojure for android/iOS would be killer. I don't know so much of android/iOS but this might be a game changer.
14:11TimMcdgrnbrg_: I just wrote my first actually-multithreaded Swing GUI. It wasn't that bad, except I suspect I'm still missing something re: Swing threads...
14:11antares_casion: for all intents and purposes, you are getting a new copy
14:12TimMcSpecifically, according to one stack trace, SwingUtilities/invokeLater at one point called a Runnable right away isntead of putting it into an event queue.
14:13casionantares_: I just noticed he explains it under values, immutability and persistence… I just found the idea of persistent shared data structures confusing when I started, and most tutorials didn't really make the concept very clear
14:14antares_I don't think a tutorial should go deep into how persistent data structures are implemented
14:14uvtccasion: Ah, I got that out of order. Will put a note in there. Thanks.
14:14antares_only that they can be considered immutable copies
14:14casionantares_: I agree, but in the order I read the tutorial it didn't look like it was mentioned at all :)
14:15uvtccasion: It's meant to be read in order. I took care to have it make sense that way. But you found a minor bit that I overlooked. Will fix.
14:16dgrnbrg_TimMc: it's not bad at all, until you start dealing with other weird blocking IO
14:16dgrnbrg_which is where my problems come from
14:16casionuvtc: looks like a great intro tutorial, it's nice that people are still putting effort into things like this
14:17uvtccasion: thanks. Please let me know if you spot any more inconsistencies.
14:20doomlordwhat are the barriers to clojure/android
14:20hiredmanthe android gc is apparently not great
14:21doomlordah, and pure-functional generates more garbage..
14:22doomlordperhaps other GC's make better use of immutability assumptions too
14:22hiredmanandroid doesn't use a real jvm, which causes issues when you generate jvm bytecode
14:22chouseranyone know if python has something like clojure's 'take' fn?
14:22hiredmanall this is solvable of course, and oracle is pumping out arm jvms
14:23scriptorchouser: slicing, maybe?
14:23TimMchiredman: Does Scala have issues on Android as well?
14:23chouserscriptor: ah, of course! thanks.
14:23hiredmanno idea
14:23TimMcI'm thinking of other non-Java things that produce JVM bytecode...
14:23chouserscriptor: silly me looking for functions when I should have been looking for syntax...
14:23technomancyscala makes it easier to strip out the parts you're not using
14:24technomancyplus it makes imperative code more idiomatic
14:24TimMctechnomancy: That's more a size/startup time thing, right?
14:24technomancyTimMc: yeah, startup time is the #1 blocker for Clojure
14:24hiredmanhttps://github.com/sattvik/neko
14:25technomancyhiredman: ouch, the last commit message just reads ":("
14:25TimMcdgrnbrg_: My program just has the Swing thread and an application thread that blocks ona queue until the human does something.
14:26casionthe commit messages are pretty pessimistic sounding on neko
14:26dgrnbrg_TimMc: did you check out seesaw? It's really awesome for that part
14:26casion:(, try again, still doesn't look good, try fixing…, try fixing…,
14:26TimMccasion: Fighting with Github, looks like.
14:27TimMcdgrnbrg_: I haven't! I really should, though.
14:27hiredmanthe oracle arm jvm runs clojure great :)
14:27scriptorcasion: to be fair, it looks like he was just trying to change something with the docs
14:27dgrnbrg_TimMc: it's glorious for making a swing gui!
14:27TimMccasion: This is where editing on Github directly makes sense.
14:27TimMcdgrnbrg_: My GUI consists entirely of one JComponent I use for drawing. :-P
14:28pandeirointeresting read on using v8 in android: http://stackoverflow.com/questions/6880778/android-utilize-v8-without-webview
14:28casionAh, so these are all commits on the readme
14:28doomlordwhat are the pros and cons of clojure v scala
14:28casionthat makes more sense then :)
14:28dgrnbrg_TimMc: seesaw also has a nice api for graphics
14:28hiredmanclojurebot: tell us about scala?
14:28clojurebothttp://www2.palomar.edu/users/mhudelson/studyguides/rmnsqvsgothic_wa.html
14:29hiredmanclojurebot: tell us about scala
14:29clojurebotscala is val foo = bar ~-> 45 <~< "Fred" %% x
14:29hiredmanclojurebot: tell us about scala
14:29clojurebotscala is val foo = bar ~-> 45 <~< "Fred" %% x
14:29hiredmanclojurebot: what about clojure?
14:29clojurebotclojurebot is amazing
14:29hiredmanclojurebot: what about clojure?
14:29clojurebotclojureql is http://github.com/LauJensen/clojureql
14:29hiredmanclojurebot: clojure
14:29clojurebotclojure is like life: you make trade-offs
14:29hiredmanclojurebot: clojure
14:29clojurebotclojure is a language to use if you want to up your game
14:29hiredmanclojurebot: clojure
14:29clojurebotclojure is not groovy
14:29casionclojurebot is having a stroke
14:29Lutin`lol
14:30Lutin`\o/
14:30metellusclojurebot: clojurebot
14:30doomlordok.. i'm none the wiser :)
14:30thorbjornDXwhat is going on @_@
14:30clojurebotclojurebot is a cold unfeeling genderless mechanism
14:30wingyi love clojure
14:30Lutin`thorbjornDX: You're in here too!
14:30TimMcthorbjornDX: hiredman is playing clojurebot factoid roulette.
14:31thorbjornDXLutin`: :)
14:31doomlordi like FP ideas, i'm kind of hovering around lisp for being multiparadigm and little dedicated syntax (eg wont reprogram symbol recognition i have for c++)
14:31uvtcI ♡ clojurebot.
14:31uvtcTimMc: teehehe... "factoid roulette"
14:32hiredman~clojure
14:32doomlordthose who say they love clojure- were they lispers *before* clojure. has anyone moved from an algolsyntax language too clojure and liked it
14:32clojurebotclojure is not groovy
14:32hiredman~blip.tv
14:32clojurebotblip.tv is http://clojure.blip.tv/
14:32technomancydoomlord: check out the "state of clojure" survey; very few people come to Clojure from other lisps comparatively
14:32thorbjornDXI have a problem with a function: I want it to use functions from different namespaces based on the input arguments, is this something I want a multimethod for?
14:33hiredmanthorbjornDX: (if ...)
14:33doomlord(perhaps ; over on #lisp .. they seem to look down on clojure as some strange mutant ..)
14:33technomancydoomlord: they're just jealous
14:33Lutin`Now I'm coming from Haskell and am interested in clojure
14:34thorbjornDXhiredman: okay. I had a seemingly terrible idea of passing a namespace into the function, and I quickly dismissed it :p
14:34doomlordi like the threading macro , funcallable objects, and literal vectors/maps
14:35technomancyyeah it's amusing that "just use reader macros" is an acceptable excuse for not having map literals in CL
14:35Lutin`Where should I start
14:36nDuffLutin`: The O'Reilly book is a pretty good place.
14:36nDuffhttp://www.clojurebook.com/ <- that one.
14:36thorbjornDXLutin`: Joy of Clojure is good once you get the basics down
14:37scriptorLutin`: the best free and online resource is http://java.ociweb.com/mark/clojure/article.html
14:37thorbjornDXnDuff: I'm pretty sure you suggested it to me in the first place :)
14:37scriptorhmm, if only they used syntax highlighting in there
14:38thorbjornDXLutin`: http://www.4clojure.com/problems can be fun too
14:38uvtcscriptor: I actually sent him a pull-request for that, but I think the maintainer is a bit busy with other things.
14:39scriptoruvtc: ah, hopefully he'll get back to working on it soon
14:40pandeiroLutin`: i would start with https://github.com/technomancy/leiningen/blob/master/README.md
14:40muhoouvtc: there's also lein-droid
14:41uvtcmuhoo: wrong person perhaps?
14:42scriptorLutin`: and for a light but very quick introduction there's the online repl: http://tryclj.com/
14:42muhoosorry
14:42SgeoIs it still accurate to say there are no REPL applets?
14:43muhootechnomancy: still failing. https://www.refheap.com/paste/5515
14:44muhootechnomancy: i can't seem to figure out which jar exactly it's failing on, based on that error message
14:45technomancymuhoo: ugh yeah, unfortunately we don't get enough data back from the underlying API to construct a useful error message =(
14:45muhootechnomancy: well, this is a production app, now dead in the water
14:45muhooany ideas?
14:46technomancyI'll pm
14:47muhook, thanks
14:48kaoDhi
15:06bonegadoomlord: I had never used Lisp before Clojure. Mostly c/python
15:07bonegaAnd I love Clojure :)
15:07Iceland_jackI've used tons of Lisps before Clojure and I love Clojure :)
15:08bonegaI still think that the java knowledge "needed" for Clojure were harder than the Lisp/functional leap
15:08Iceland_jackbonega: depends on your functional background though?
15:08boneganone
15:09bonegaBut I might just be weird
15:13pandeiroworkflow to add some println to a third-party lib while in emacs/nrepl: change .m2/.../file, overwrite, C-c C-k, work at repl, back to .m2/.../file in emacs, C-/ C-/ etc, resave ... is there a better way?
15:20gfrederickspandeiro: a clojure lib? you can't just re-def some vars?
15:30jkkramerpandeiro: clone the lib's repo and symlink in 'checkouts' dir
15:30pandeirojkkramer: projectroot/checkouts ?
15:30antares_pandeiro: what jkkramer said, the checkouts feature leiningen has
15:31jkkramerpandeiro: yup
15:31pandeiroawesome
15:31antares_pandeiro: if the 3rd party lib name is someorg/libxyz, then it should be under root/checkouts/libxyz and leiningen will use it from there instead of ~/.m2
15:31jkkrameryou could also use with-redefs or robert hooke to wrap target fns, if you don't need to alter the fn interiors
15:33pandeirojkkramer: and i could still inspect state inside the function when it is being invoked?
15:33jkkramerpandeiro: you could inspect the arguments or outputs, but not the inner workings on the fn
15:33jkkramers/on/of
15:37pandeirolein says it is ignoring the checkouts dir b/c the lib has no project.clj, but in the jar it is there, just in META-INF/leiningen/lib/project.clj
15:38TimMcpandeiro: ls -l ./checkouts
15:39pandeiroTimMc: I need to manually copy it to the lib root?
15:40neotykpandeiro: try adding sources to source-paths
15:40TimMcNo, I was asking for a listing of your checkouts dir.
15:41technomancypandeiro: have you tried the tracing lib?
15:41TimMcpandeiro: Are you symlinking an unpacked jar? The target needs to be a Leiningen project, with a project.clj at the root.
15:42TimMcpandeiro: And remember that checkouts won't work unless the project is still listed as a :dependency
15:46neotykcan anyone help with lein templates?
16:05pandeiroTimMc: neotyk: thanks, i thought i could use a jar
16:06pandeirotechnomancy: which tracing lib?
16:06technomancypandeiro: I think there's a contrib or something?
16:07pandeirotools.trace, got it, thanks
17:11bisenbekk
17:19SegFaultAX|workI have a massive lazy seq (like, causes an OOM if I realize the whole thing massive). How can I scan the list in constant space?
17:20SegFaultAX|work(some my-pred big-ass-seq) doesn't work as I thought it would.
17:20technomancySegFaultAX|work: it should work if you're not holding the head of the seq
17:21SegFaultAX|workIn other words, once I've realized a value I can safely discard it.
17:21SegFaultAX|workHmm, that's what I thought.
17:22SegFaultAX|workIs mapcat not lazy, or break lazy semantics?
17:22emezeskemapcat is lazy.
17:23SegFaultAX|workThen wtf.
17:23SegFaultAX|workLemme paste some code
17:23SegFaultAX|workhttps://gist.github.com/3836525
17:24SegFaultAX|workThat's to find the longest palindrome inalongsentencewithnospaces
17:24SegFaultAX|worktechnomancy, emezeske: Code paste ^
17:25amalloySegFaultAX|work: (count s)
17:25casionI'd imagine...
17:25casionamalloy beat me
17:25SegFaultAX|workWhy would counting the size of the string matter?
17:25amalloythat's the most obvious problem; the algorithm would have similar issues if you addressed that
17:25SegFaultAX|workHow is that relevant?
17:26casionemezeske: re: question I asked before you logged off last night, conj was correct as I'm sure you guessed :)
17:26amalloySegFaultAX|work: you walk to the end of the seq to count it, and you need to keep the head of the seq around to mapcat it
17:26SegFaultAX|work,((fn [s] (count s) "hello world")
17:26casionI was misunderstanding what I was trying to do
17:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
17:26SegFaultAX|work,((fn [s] (count s)) "hello world")
17:26clojurebot11
17:26SegFaultAX|workamalloy: Wait, huh?
17:27SegFaultAX|workamalloy: I'm counting the size of the input string once to build the range which is used to subdivide the string. I don't understand.
17:27emezeskecasion: Oh, wasn't apply (as amalloy suggested) even better?
17:27amalloySegFaultAX|work: what object is it that you think is getting too large?
17:28SegFaultAX|workamalloy: The result of slice-all, I think.
17:28casionemezeske: no, afaik apply wouldn't apply (pun intended) because I needed to 'unroll' the arguments in the middle of a nested vector
17:28SegFaultAX|workamalloy: But I don't see how what you suggested is hurting it.
17:28SegFaultAX|work,((fn [s] (mapcat #(partition % 1 s) (range (count s) 1 -1))) "hello")
17:28clojurebot((\h \e \l \l \o) (\h \e \l \l) (\e \l \l \o) (\h \e \l) (\e \l \l) ...)
17:28emezeskecasion: Well, glad you got a solution working.
17:28casionso I just needed to put a conj in the right place, which I had tried before I asked but had it at the wrong nesting level because the enlive docs (imo) were confusing
17:28amalloyno, the size of slice-all will not cause memory issues. but if the size of any particular element of it is too large, it will
17:29casionemezeske: I don't think I'd have ever figured it out if you didn't say conj would work so plainly
17:29SegFaultAX|workamalloy: It just gets a large-ish string.
17:29SegFaultAX|workamalloy: About 1170 bytes.
17:29SegFaultAX|workamalloy: That's the issue?
17:30emezeskecasion: :)
17:30amalloyif you're running on a machine with 1KB of ram, that's probably the issue
17:30SegFaultAX|workamalloy: I mean the biggest element would have 1170 bytes.
17:30SegFaultAX|workamalloy: It's a MBP with like 8gigs. :)
17:30casionthe whole 'code as data' thing still needs to sink into my head haha
17:32SegFaultAX|workCan anyone see any obvious reason why my code is dying?
17:32SegFaultAX|work(Or non-obvious, as the case may be)
17:36amalloyi don't think this should cause you to run out of memory. how long does it take, and can you provide a string for which that happens?
17:37SegFaultAX|workamalloy: http://challenge.greplin.com/static/gettysburg.txt
17:37SegFaultAX|workamalloy: Just grab like 100 characters of that and you'll see what I mean.
17:38SegFaultAX|workamalloy: Doing the whole thing will OOM.
17:38amalloyhuh. i did this problem about a year ago in clojure
17:38SegFaultAX|workamalloy: Do you see anything horrificly wrong with my code?
17:39amalloywell, you're using seqs, reverse, and partition instead of vectors, rseq, and subseq; those will reduce performance problems
17:40amalloybut i ran your code to completion and it works fine
17:40amalloyon the whole string
17:40SegFaultAX|workamalloy: Wtf.
17:40SegFaultAX|workamalloy: How long did it take?
17:40amalloya minute? two?
17:40technomancyPSA: central has screwed up jackson again =\
17:40amalloyprocess has 1.5GB of virtual memory
17:40casionI get out of memory
17:40SegFaultAX|workamalloy: Lame. Maybe I'll just rewrite it with a list comprehension.
17:41SegFaultAX|workI don't care if it runs slow, but why is it consuming memory like that?
17:41SegFaultAX|workI mean a list with just 1k elements is not an issue.
17:42casionSegFault1X: slice-all making a huge collection
17:42SegFaultAX|workcasion: But I'm not holding the head, am I?
17:44casionhmm
17:54casionSegFaultAX|work: why do you want mapcat instead of map?
17:55SegFaultAX|workcasion: Try it and see.
17:55casionI did, and either I don't understand what you're trying to do, or map works correctly
17:55casionthe former is quite likely
17:58amalloyi think chunking is to blame
17:58clojurebotYou don't have to tell me twice.
18:00amalloyi don't quite see what you're winding up with too many of, but if i un-chunkify the result of range, the whole thing runs in 60MB
18:00SegFaultAX|workcasion: Slice-all is just trying to get a list of all possible subsequences of its imnput
18:00SegFaultAX|workcasion: So if the input is 5 characters, get all 5 4 3 and 2 character long subseqs
18:01SegFaultAX|workcasion: Then check each one to see if it's a palindrome, and yield the largest one.
18:01SegFaultAX|workcasion: Using a map there would result in a list of lists of subseqs. Mapcat makes it just a list of subseqs.
18:01casionSegFault1X: ah, I misunderstood what the function was trying to accomplish
18:01SegFaultAX|workcasion: http://challenge.greplin.com/
18:02amalloySegFaultAX|work: https://gist.github.com/3836677 is a change that should work
18:02SegFaultAX|workamalloy: Is it something I did wrong?
18:02amalloywell, you caused an OOM, so yes
18:02amalloybut i don't see why
18:03SegFaultAX|workWell, at least my initial assumption that it should have worked wasn't totally off.
18:03amalloylike i said, something about chunking. i think you're keeping dozens of the 1k-element strings in memory at a time. that should still be fine, though, i would think
18:03SegFaultAX|workamalloy: Either way, this is probably better done with a list comprehension and subseq.
18:04SegFaultAX|workI
18:04SegFaultAX|workI'm sad my first pass didn't work, though.
18:04amalloyright, subseq is the more important change
18:04amalloysince you never need make a second copy of the string in memory
18:05SegFaultAX|workamalloy: Ah! It can share memory with the original string, can't it!?
18:05amalloynot just share; entirely reuse
18:05SegFaultAX|workamalloy: So each subseq will be a view of the original?
18:05amalloyyes. subvec though, not subseq
18:06SegFaultAX|workShould I vectorize the string, then?
18:06amalloyi would. i guess you can leave it as a string and use subseq instead, if that works
18:06amalloy&(subseq "abc" 0 1)
18:06lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Sorted
18:06SegFaultAX|work,(doc subseq)
18:06clojurebot"([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"
18:24TimMcSegFaultAX|work: Have you checked whether there are any leaks related to .substring?
18:25amalloyTimMc: he doesn't call substring, so it seems unlikely :P
18:25TimMcOh, this is all done as seqs of chars?
18:25TimMcSorry, I haven't looked at the code. :-P
18:26SegFaultAX|workTimMc: I'm still befuddled as to why it doesn't work. But I'd love to hear your input if you have time to look at the code.
18:26SegFaultAX|workTimMc: Either way, I solved the problem using a different technique.
18:27TimMcWell, I'll most likely take a look when I get home. Glad to hear you solved it!
18:38thorbjornDXhow should I make a lookup table for a function? def a map? or defn a function that takes a key and looks in a map?
18:38SegFaultAX|workthorbjornDX: What are you trying to do?
18:39thorbjornDXSegFaultAX|work: I pass a map into a function, and I want to pass that map on to a different function based on the content of the map
18:39SegFaultAX|workthorbjornDX: Is this not a case for multimethods?
18:40thorbjornDXSegFaultAX|work: I was thinking that way earlier, someone suggested that I just used 'if. I compromised by making these fn-lookup-maps
18:41SegFaultAX|workthorbjornDX: It sounds like the pattern you're looking to recreate is multiple dispatch. Maybe you should look at multimethods again :)
18:42thorbjornDXSegFaultAX|work: I'll take a look. Thanks for the advice.
18:42amalloyi don't see anything "multiple" about that dispatch, but multimethods are still reasonable
18:44BrainBacon1Can someone tell me what I'm doing wrong in a cheshire binding? I'm trying to decode json with single quotes in a middleman in noir https://gist.github.com/3836907
18:45amalloyBrainBacon1: that's a bunch of code and no question
18:49BrainBacon1amalloy: specifically the function json-update gist.github.com/3836907#L24 I have a middleman that uses that function with a binding for cheshire options. In the repl it will parse the json properly (single quotes in json, no quotes on field names), but when I run the noir server it doesn't seem to bind the options I put in.
18:50BrainBacon1amalloy: https://github.com/dakrone/cheshire#advanced-customization-for-factories is what I was basing my binding on
18:51BrainBacon1amalloy: https://github.com/dakrone/cheshire/blob/master/src/cheshire/factory.clj#L11 is where I found the options
18:55casionSegFaultAX|work: does this work for you? https://gist.github.com/3836958
18:56casionI assume that unchunks the range and makes the mapcat 'actually lazy'
19:04casionupdated with something that actually returns the palindrome
19:04casionwhich is accepted as the answer on greplin
19:05TimMcSegFaultAX|work: What is slice-all?
19:06casionTimMc: it returns all subseqs of s
19:08casionwell, all that are count > 1
19:11TimMcI'd like to see the definition on that.
19:11clojurebotexcusez-moi
19:11TimMcclojurebot: ~chunking
19:11clojurebotNo entiendo
19:11TimMcclojurebot: chunking?
19:11clojurebotPardon?
19:11casionthat was fun to figure out though, and amalloy was as usually correct
19:11casionusual*
19:12TimMcOh, DERP. slice-all is a local!
19:12casionTimMc: for whatever reason, slice-all was being realized in chunks of 32 due to the range
19:13holohi >.<
19:18thorbjornDXSegFaultAX|work: I'm a little lost on how to use multimethods. Is the second argument to defmulti a 'lookup' function to determine which method should be dispatched?
19:18nDuffthorbjornDX: Yes.
19:19thorbjornDXnDuff: so when I 'defmethod, I need to provide the expected results of calling that 'lookup' on whatever I'm passing in?
19:21nDuffthorbjornDX: Right.
19:23thorbjornDXnDuff: would you mind looking at this?: http://pastebin.com/UmH4LrLB I must be doing something wrong
19:24thorbjornDXnDuff: it doesn't like that I'm passing in PersistentArrayMaps for some reason.
19:29casionthorbjornDX: that code works for me
19:29SegFaultAX|workYup.
19:29thorbjornDXcasion: clojure 1.4.0?
19:29casionthorbjornDX: yes
19:30thorbjornDXI wonder if it's vimclojure or something
19:30SegFaultAX|workthorbjornDX: Try reevaluating the whole file.
19:31thorbjornDXoh, weird
19:31SegFaultAX|workthorbjornDX: Got it working?
19:31thorbjornDXyeah, that's strange
19:31thorbjornDXI dropped it into a separate file/namespace
19:31thorbjornDXand reevaluated
19:32SegFaultAX|workthorbjornDX: Sweet :) So is that kinda what you're looking for?
19:32casionSegFaultAX|work: did my comments above clarify the issue with your palindrome func anymore?
19:32thorbjornDXSegFaultAX|work: yes, it seems like a more-concise version of what I was doing before
19:32amalloythorbjornDX: multimethods have a misfeature whereby if you redefine one its dispatch function doesn't change
19:32amalloyyou can avoid it by (ns-unmap *ns* 'foo)
19:32technomancyor just (def foo nil) before defmulti
19:33thorbjornDXamalloy: can I just re-evaluate the entire block again? Including the defmulti
19:33SegFaultAX|workcasion: I don't really understand why realizing the range makes a difference.
19:34amalloySegFaultAX|work: nothing to do with realizing. de-chunking
19:34casionSegFault1X: it was making mapcat produce chunks of data… which seems to be too much for either of our jvm processes
19:34SegFaultAX|workOhhh. Neat.
19:34casionso when you dechunk the range it's 'one at a time' again
19:34SegFaultAX|workStill, isn't the chunk size 32 by default?
19:35casionperhaps not again, but now
19:35amalloyit's 32, yes
19:35casionI thought it was 32, that's what it looked like it was doing
19:35SegFaultAX|workSo with a large string like the proposed input, that would only be 1170 * 32 which still is only 32k per chunk /at worst/
19:35amalloythere's still the problem of each chunk being much larger than we think it should be, but de-chunking makes the total small enough to fit in memory
19:35SegFaultAX|workWhy did it consume gigs?
19:36casionit wasn't consuming gigs here
19:36SegFaultAX|workcasion: amalloy said his ran up to like 1.7g
19:36amalloySegFaultAX|work: 32k per chunk is pretty optimistic. strings waste a big glob of space, and lazy sequences have to allocate a bunch of objects
19:36casionthat's odd!?
19:36thorbjornDXamalloy: I dropped a (def foo nil) above my defmulti, and that takes care of it
19:37amalloymeh. i'm sure 1.5g was the max heap size set for the process, so it didn't bother to gc before then
19:37SegFaultAX|workamalloy: Even if the overhead was a meg each, that's still only 32 megs.
19:37SegFaultAX|workIs it something worth filing a bug over?
19:38SegFaultAX|workIt does seem like one of those pathological worst-case scenarios.
19:39casionSegFaultAX|work: fwiw I found lots of similar cases while googling
19:40casionwhere people were having issues withe chunked sequences consuming seemingly way more memory than they should
19:40casionall the way back to when chunked seqs were introduced
19:40casionunfortunately every resolution was along the lines of 'don't do that then!'
19:44amalloySegFaultAX|work: i don't recommend filing a bug if you can't figure out what's actually happening. "my program uses a lot of memory and nobody can tell why, so it must be a bug in chunking" is not a convincing issue
19:46dnolenargh
19:46dnolendefrecord's are IPersistentCollection
19:46dnolenbut they don't implement empty
20:20thorbjornDXmultimethods seem dangerously powerful, should I use :default to raise an exception to make sure I don't break anything?
20:21nDuffthorbjornDX: they'll raise an exception if there's no handler regardless.
20:22dnolenthorbjornDX: haha dangerously powerful :)
20:23hiredmanthey throw an exception by default if there is no :default
20:23doomlordDoes closure have CLOS style multiple dispatch
20:23nDuffdoomlord: Not CLOS style, no.
20:23nDuffdoomlord: ...but it has flexible dispatch mechanisms.
20:23doomlord.. or is the OO more defined by java
20:23thorbjornDXnDuff: okay, cool
20:24nDuffdoomlord: ...there are both mechanisms that are meant to be fast on the JVM, and mechanisms that are meant to be flexible; you take your pick.
20:24technomancywhen stuart H spoke on clojure at rubyconf one of the Q&A audience questions was "multimethods sound like they can be really hard to follow if they allow completely arbitrary dispatch"
20:24doomlordjava etc use double-dispatch as a workaround for multi-dispatch?
20:24thorbjornDXdnolen: danger is good, unless my code is capable of causing physical harm to someone
20:24technomancywhich was kind of ironic considering ruby has method_missing
20:24doomlordheh usual tradeoff
20:24nDuffdoomlord: (which is to say -- Clojure supports some of each kind)
20:25nDuff...so that's also an available option, if you're willing to use 3rd-party code.
20:25thorbjornDXI'm using multimethods to close some fns around variables based on a :type that I pass in. I odn't think that's too far off the track
20:29azkeszhey, does anyone want to do something(that we both agree on) in clojure, _together_ ? I'm not really a programmer(certainly not in clojure) but maybe it will work eventually - I have the time
20:29amalloy"close some fns around variables based on :type"? i don't understand what that means
20:29dnolentechnomancy: it's also only seems too powerful in theory - most uses I've seen are fairly straightforward.
20:29amalloyazkesz: just find an open-source project that you use and try to contribute something that would make your use of it better
20:30amalloyyou'll wind up working with someone that way
20:30azkeszokay thanks amalloy
20:30azkeszany sugestions tho?
20:30azkeszof such projects :)
20:31azkesz(in clojure preferably)
20:31technomancydnolen: it's easy to imagine code using it that is hard to follow, but yeah, it's also easy to use your judgment and just don't do anything crazy =)
20:33amalloyeasy?! but the crazy things i want to do are usually really cool!
20:34technomancyamalloy: just stick to juxt
20:35amalloy~:(
20:35clojurebotHuh?
20:35amalloyi dunno what that emoticon is supposed to look like. i was just hoping clojurebot had a factoid for :(
20:36amalloyit kinda looks like a sad squirrel
20:36azkeszdid anyone try storing clojure code in datomic? instead of in files let's say?
20:37holoazkesz, are you polish?
20:37azkeszI'm mainly wondering if the reloading of code would be better that way
20:37azkeszno holo
20:37dnolenazkesz: not Clojure code but the Clojure AST yet.
20:37dnolenazkesz: reloading of the REPL session maybe, kovasb is working on that.
20:42gfredericksclojurebot: :( is <reply> #<RuntimeException java.lang.RuntimeException: Invalid token: :>
20:42clojurebotIk begrijp
20:42azkeszdnolen, this abstract syntax tree is it something like Extended Backus–Naur Form (EBNF) of the clojure language, or more likely the tree after the macro parsing and can thus store any clojure code written by anyone?
20:44holoit can even store macros written by me
20:46azkeszok so the repl reads the textual code and transforms it into the AST ? that kind of AST then...
20:48wingythere is a function returning its argument. what is it called now?
20:48emezeskewingy: identity?
20:48wingyyeah thx
20:50gfredericks$findfn 42 42
20:50holoazkesz, an AST is so i think because it doesn't have any "concrete" syntax (so it's abstract). coding in clojure is almost the same, because it doesn't use concrete syntax.. hey guys, did i say something wrong?
20:50lazybot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/long clojure.core/short clojure.core/+ clojure.core/* clojure.core/doto clojure.core/unchecked-long clojure.core/+' clojure.core/unchecked-short... https://www.refheap.com/paste/5524
20:54wingyi need to loop through a sequence and return a value for matching if test
20:54wingyhttps://www.refheap.com/paste/5525
20:54azkeszI'm kind of hoping that by using datomic to store and load functions (even though I only saw it with java code) would be better with code reloading than by reloading an entire namespace file like normally; and in effect if would be a better way for me at least, to store my code like so
20:54dnolenazkesz: holo: I was referring to the AST produced by the CLJS analyzer
20:54wingythe issue is that a for loop takes only one body form
20:55wingyhow can i make the logic of the code snippet working
20:55dnolenazkesz: by AST I mean a form of Clojure code such that it's something useful for further analysis or for a compiler backend.
20:56azkeszdnolen, i think I get it, but isn't clojure already doing something like that after the read part of repl? or something
20:56azkesz...i thought that's what you meant at first
20:57dnolenazkesz: sexprs are friendly then ASTs for user level code transformation - but they lack too much context for other kinds of things you might want to do.
20:57dnolenazkesz: of course that's debatable - Racket seems to pushing the macro things very far.
20:57dnolenmacro thing
21:00adiabaticClojure newbie here. I tried Eclipse with counterclockwise and, oddly enough, found myself missing C-a and C-e and C-k something fierce — especially since End took me to the end of the file. I'm actually ready to try Clojure in — dun dun dun — an emacs on OS X. What's everyone's favorite SLIME-compatible emacs that runs on OS X?
21:01holowhat is a dun dun dun?
21:01amalloymost mac users i know installed cocoa emacs via homebrew
21:02wingyi should have used (case)
21:02azkeszlike a sound effect :))
21:02adiabaticIt's a musical something-or-other to introduce something in a dramatic fashion
21:02holooh! i know what it is!
21:02azkeszwell said :D
21:02holoit's actually 4 duns i think
21:03gfredericksprobably depends on the melody
21:03adiabatic^
21:03dnolenadiabatic: I just use Cocoa Emacs from here http://emacsformacosx.com
21:04dnolenadiabatic: I think all you need to do now is install clojure-mode via (M-x package-list-packages)
21:05dnolenadiabatic: some of the cool kids are on nREPL but I haven't ventured there - others might have pointers about using that.
21:05adiabaticnot from an identified developer…grumble grumble…
21:06eggsbymmm techmesh looks like a good conference... wonder if I can get work to float it :3
21:06adiabaticalso an emacs newbie — what do I do to find clojure-mode on that page?
21:07azkeszis there something that would allow applying updates to clojure code in a stack-like fashion? where each update is say a transaction changing/adding clojure code
21:07eggsbyadiabatic: I highly recommend technomancys emacs-starter-kit
21:07iceyIs there anything like a "Built with Clojurescript" site out there?
21:07eggsbyadiabatic: https://github.com/technomancy/emacs-starter-kit helped me enormously getting started with emacs
21:08azkeszi don't dare think of modular transactions :))
21:08iceyor barring that, does anyone have any clojurescript sites they think are particularly great?
21:09akhudekicey: I imagine that most sites using clojurescript use clojure on the server
21:09eggsbyI've always thought himera was a good cljs example icey http://himera.heroku.com/
21:09dnolenicey: emezeske has one
21:09zmarilAny ideas about how to get better performance from a noir server?
21:09dnolenicey: Light Table is mostly CLJS
21:09iceyakhudek: I'd imagine the same thing, I'm interested in seeing what people are doing with CLJS on the client side
21:09eggsbyd2 is pretty great as well
21:10eggsbyerr, c2 :p
21:10iceydnolen: Ah, I didn't think about Light Table
21:10dnolenicey: ohpauleez's startup uses a bunch of CLJS on their frontend as well I believe.
21:11iceydnolen: Is that Tutorspree?
21:12dnolenicey: yes
21:12iceydnolen: awesome, thank you sir
21:12emezeskeicey: You are looking for an example of a site built in CLJS?
21:13azkeszwhat do you guys think about datomic? i wanna get into it
21:13iceydnolen: btw, core.match is half the reason I'm looking at CLJS for some stuff; awesome library
21:13iceyemezeske: Yeah, mostly I'm just curious as to what people are doing with it. Are they using it for everything, or just for application bits, etc
21:14dnolenicey: thanks, sadly only 2/3rds awesome ... but it'll get there one day.
21:14emezeskeicey: http://blog.mezeske.com/?p=552
21:14emezeskeicey: Unfortunately I haven't written the blog posts that go into great detail yet
21:14emezeskeicey: But I used it for all the UI stuff
21:14akhudekazkesz: think it's pretty interesting, but haven't yet had any experience working with it
21:15iceyemezeske: bad ass, this is exactly the sort of thing I was looking for
21:15azkeszakhudek, same here, I only watched the youtube videos and I'm pretty excited about it
21:15emezeskeicey: The first post isn't super detailed :/
21:15SgeoWhat's the discussion about?
21:16SgeoAlso, why isn't the URL to the logs in the topic?
21:16SgeoI believe it's Freenode policy to have them in the topic?
21:16SgeoOr at least mention that it's being logged
21:17azkeszyeah the last part
21:17SgeoAlso, the logger seems broken
21:18holo:o my crap is being logged
21:18azkeszlol crap
21:18Frozenlockholo: yeah, it's really creepy the first time a google search gives you back one your conversations...
21:19adiabaticeggsby: do you also recommend starter-kit-lisp?
21:19iceyIs there anything like socket.io out there for ring?
21:19holomakes you feel kind of a public figure right?
21:19gfredericksholo: and all I do is make stupid jokes
21:20FrozenlockWell I'm used to #emacs no-logging. I was mostly surprised... and happy I haven't said anything dangerous :P
21:20hologfredericks, you're being humble. i saw you more than once, giving god like tips in this #
21:21iceyemezeske: Your blog post is useful just for the libraries listed at the bottom.
21:21xeqiicey: https://github.com/ztellman/aleph
21:24Sgeoxeqi, I'm... I don't quite get it. I see how you could buold a socket.io like thing on top of Aleph, but that's not the same as being a substitute for socket.io
21:25iceyI saw someone was working on a browserchannel implementation in Clojure, but that's the closest thing I've found
21:25azkeszwhat does this mean to unify in this context: https://github.com/clojure/core.logic/wiki/Extending-core.logic-%28Datomic-example%29
21:26Sgeoicey, well, there are socket.io servers for Java, maybe ... doing something with that might be possible
21:26iceySgeo: ah, right - I think there's something for Jetty. Thanks
21:26SgeoOoh, there is?
21:27SgeoLink? Because I also happen to need this, and browserchannel may be bad for my use case because I plan on sending both ways lots of small information
21:27iceySgeo: NO idea if it's any good: https://github.com/thegeez/clj-browserchannel-demo
21:28holoanyone knows why "clojure.java.shell" 's "sh" form sits there alot of time after returning the map with :in , :out, etc?
21:28iceySgeo: err - https://github.com/thegeez/clj-browserchannel
21:28Sgeoicey, that's browserchannel, not socket.io
21:28iceySgeo: sorry, I didn't realize which thing you were asking about
21:28zerokarmaleft,(assoc-in [[nil nil] [nil nil]] [0 0] 0)
21:28clojurebot[[0 nil] [nil nil]]
21:29zerokarmaleftis it possible to update an inner pair in one call?
21:29zerokarmalefti'm thinking no, but need a sanity check
21:29iceySgeo: there are a few socket.io java libraries around on github
21:29iceyI'm coming from .net so I couldn't tell you which ones are better than others though
21:29Sgeozerokarmaleft, isn't that what you just did?
21:30amalloy&(update-in [[nil nil] [nil nil]] 0 assoc 0 0 1 0) is what you want?
21:30lazybotjava.lang.UnsupportedOperationException: nth not supported on this type: Long
21:30amalloy&(update-in [[nil nil] [nil nil]] [0] assoc 0 0 1 0)
21:30lazybot⇒ [[0 0] [nil nil]]
21:30zerokarmaleftamalloy: yea, that's it
21:31zerokarmaleftthat solution also makes me feel like i'm off in the weeds
21:32Sgeo,(doc assoc)
21:32clojurebot"([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."
21:32Sgeooh
21:40zerokarmalefti'm basically wanting to reduce into a 2d matrix by checking the collection i'm reducing against a corresponding row# in a diff 2d matrix: https://gist.github.com/3837554
21:42zerokarmalefti guess it's going to be hairy no matter what since i don't think i can escape dealing with indices
21:57TimMczerokarmaleft: Why not this? ##(assoc-in [[nil nil] [nil nil]] [0] [1 2])
21:57lazybot⇒ [[1 2] [nil nil]]
21:58azkeszlooks nice
21:58azkesz,(assoc-in [[nil nil] [nil nil]] [1] [1 2])
21:58clojurebot[[nil nil] [1 2]]
21:58azkeszawesome
21:58TimMcwhich of course is just ##(assoc [[nil nil] [nil nil]] 0 [1 2])
21:58lazybot⇒ [[1 2] [nil nil]]
21:59azkeszso many ways to do it...
21:59zerokarmaleftTimMc: that would work great as well, but it presumes i build a nested data structure of nils beforehand, right?
21:59zerokarmaleftelse it inserts a MapEntry?
21:59azkesz,(assoc-in [[nil nil]] [1] [1 2])
21:59clojurebot[[nil nil] [1 2]]
21:59azkesz,(assoc-in [] [1] [1 2])
21:59clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
22:00azkesz,(assoc-in [] [0] [1 2])
22:00clojurebot[[1 2]]
22:00zerokarmaleftah, swank
22:00TimMcazkesz: vectors support assoc'ing to the index right after the end, for convenience.
22:00azkesztimmc makes sense thanks
22:02TimMczerokarmaleft: I don't quite understand what you're trying to do. Sample input and output?
22:02TimMcAre the elements of sigs pairs of row #s?
22:02zerokarmaleftTimMc: https://gist.github.com/3837554
22:03TimMcOh wait, you're going column-first?!
22:03TimMcYeah, I was reading that and failing to comprehend.
22:03azkeszwhat's a sig?
22:04azkeszsignature?
22:04zerokarmaleftyea, they're collections of hash function values
22:08TimMczerokarmaleft: If you want advice, you're going to need to explain more clearly what you're trying to do.
22:12zerokarmaleftTimMc: i'm updating the gist to explain it in a couple steps
22:12TimMcok, cool
22:15TimMcAh, this is starting to make sense.
22:16zerokarmalefti omitted some less interesting steps
22:17zerokarmaleftbah, i'll go ahead and add it
22:17SgeoHmm, I'm wondering if it would be a bad idea to just put a large hash into an agent rather than have the hash hold mutable values which hold hashes with mutable values etc.
22:19RaynesSgeo: You're going to want to restrict yourself to as few mutable things as possible. Go for a mutable thing holding a not mutable thing and not a not mutable thing holding a bunch of mutable things.
22:20SgeoHmm. Although I do wonder about efficiency with that, in particular, different threads trying to update different parts of it at the same time, there's no reason for one to wait for the other
22:21SgeoThere's also the fact that I would want watchers watching just portions...
22:21TimMczerokarmaleft: So the inputs are an r-by-c matrix and a pair-vector of length r, and the output is a pair-vector of length c.
22:22TimMcand you're merging pairs element-wise by min.
22:22zerokarmaleftTimMc: yes
22:23zerokarmaleftmuch more succinctly put, heh
22:25TimMcI think you'll want a map followed by a reduce.
22:26TimMc(map (fn [row sig] ...) matrix sigs) gives you a seq of ([[1 1] nil nil [1 1]] ...)
22:27TimMcand then (reduce merge-sigs (vec (cycle c nil)) sig-partials)
22:28TimMcThis supposes that the matrix is a sequence of rows, not columns.
22:30zerokarmaleftah, that makes sense
22:31zerokarmaleftit should be possible column-wise too, it just needs to be consistent throughout
22:31zerokarmaleftTimMc: thanks, i'll try that track
22:36TimMcrow-then-column is the convention, so if you have a choice, it may be more maintainable that way.
22:36TimMcMay I ask what this is all in pursuit of?
22:41TimMcOh, and I'll note that the reduce step is associative, so if you're dealing with big wads of data, the reducers lib might be useful.
22:45wingyim trying to learn cljs
22:45wingycould someone help me converting this to cljs: $(document).on('mobileinit', function() {...});
22:58wingy(.on (js/$ js/document) "mobileinit" #(...))
23:01wingyif i :use js in the beginning of the file: (.on ($ document) "mobileinit" #(…))
23:06wingydidnt seem to work to :use js
23:14adiabaticHalf off-topic, but: I have a line that looks like " ))". How can I tell emacs to take the entire file, or at least a region, and reformat everything so the parens go at the end of the previous line? C-M-\ only handles indentation
23:48zerokarmaleftTimMc: sorry, wandered off to grill some dinner
23:49zerokarmalefti'm implementing an algorithm for finding similar items with locality-sensitive hashing
23:52zerokarmaleftit probably makes more sense to do it in hadoop, but i just wanted to hack it up in clojure as a non-trivial exercise
23:55TimMcAh, LSH.
23:55bjorkintoshlispshell?
23:56TimMcbjorkintosh: It's a way of clustering things based on feature vectors.
23:59zerokarmaleftTimMc: hence, that naive matrix representation and so on