#clojure logs

2015-09-05

01:14reutermjHow do you add metadata to a macro with a def? `(def ^{:some-meta 4} ~name 4) doesn't work.
01:19amalloyreutermj: http://stackoverflow.com/a/11920022/625403
01:23reutermjamalloy: ok so when I set *print-meta* and change the macro to `(def ~(vary-meta name assoc :some-meta 4) 4) it prints the correct meta data. But, calling (meta some-name) returns nil
01:24amalloy(meta #'some-name)
01:25reutermjok that was mentioned earlier. What exactly does that reader macro do?
01:30amalloy,'#'x
01:30clojurebot(var x)
01:31reutermjthanks
01:31reutermj(inc amalloy)
01:31lazybot⇒ 300
02:42TEttinger(identity amalloy)
02:42lazybotamalloy has karma 300.
02:42TEttingercongrats
03:58QuasimodemI have experience with programming, java, c++, Pascal(good intro for me). I think what essentially is true in programming, is that it's more based on mindset, and how you use the language to benefit you.
06:21ashwink005can I convert a list of HashMaps, to a vector of HashMaps?
06:24Rurikashwink005, yes, wrap the list in vec
06:24Rurik,(vec ())
06:24clojurebot[]
06:27mavbozo,(vec '({:a 1} {:b 2}))
06:27clojurebot[{:a 1} {:b 2}]
06:42irctcHello everyone, is there any reason why clojure is not implemented in clojure?
06:42Rurikirctc, it is implemented in clojure
06:43Rurikirctc, https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj
06:43irctcbut why does 60% of the code base is written in java ?
06:44luxbockRurik: it's only partly implemented in Clojure, though there is a separate projects that can read, analyze and emit JVM bytecode
06:45luxbockI wonder why the Clojure jar doesn't include the java files btw
06:45luxbockit would be nice if I could jump to the Java source location from my editor
07:00sobelthere may be a distribution that includes source in the same jar but typically sources are omitted for brevity
07:05clj-beginnerHello.
07:06clj-beginnerCan try take multiple expressions?
07:06clj-beginnerMost of the examples that I have seen uses only one expression before catching
07:06clj-beginneris it possible to use multiple?
07:07clj-beginnerI tried experimenting but I kept on getting a class cast exception error
07:07luxbocksobel: looking here I see that such a .jar exists https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0/
07:08luxbockbut using [org.clojure/clojure "1.7.0-sources"] doesn't seem to work, nor does it mention sources in the pom file
07:08amalloyhttp://central.maven.org/maven2/org/clojure/clojure/1.7.0/clojure-1.7.0-sources.jar
07:08amalloyluxbock: it's not a differently-named artifact
07:08amalloyit's the same artifact with a different qualifier - look up how to get sources from maven in general
07:08amalloyor maybe classifier? i forget
07:09luxbockamalloy: ok thanks
07:09mavbozo,(try (inc 1) (inc 2))
07:09sobelluxbock: sorry, i don't have the details, and i actually don't hope to step into Clojure code if I can help it :)
07:09clojurebot3
07:19luxbockI think :classifier "sources" is right, but I get the following stacktrace when I try to start my REPL: https://gist.github.com/luxbock/b78272185608adb6b7b8
07:20luxbockNo matching method: unsignedShiftRight, compiling:(clojure/core.clj:1337)
07:21luxbockI feel like it's taunting me
07:23luxbockit did download the clojure-1.7.0-sources.jar though
07:27luxbockso I guess the -sources .jar only includes the sources and not the class files
07:29luxbockso you can't even start a REPL with it via clojure.main
10:40ashwink005can anyone give me a simple example how return a string containing "foo" x number of times
10:40ashwink005*how to
10:42Rurik,(apply str (repeat 3 "foo"))
10:42clojurebot"foofoofoo"
10:42rhg135(apply str (repeat 10 "foo"))
10:42Rurikashwink005, this works? ^
10:42ashwink005Rurik: this can be done without loop?
10:43ashwink005cool
10:43ashwink005yup thanks
10:48tomjackshould there be a "confirm before running a template you just downloaded" option for lein?
10:59sobelwhy?
10:59clojurebotsobel: because you can't handle the truth!
10:59sobel...guess i asked for that
11:00sobeltomjack: it's a CLI development tool. i'm thinking, probably not.
11:01justin_smithI could imagine a "delete this code that breaks the project to prove you've read the code the template generates"
11:02justin_smithbut that would be weird
11:05tomjackI'm imagining camping in clojars on many distance 1 edits of popular templates..
11:06justin_smithoh, template-name typos
11:06sobelthe correct way to manage that is to stop it at the source so the fewest number of people would be affected. beyond that, my strategy is don't take risks on precious machines. my code has been unpredictable in the past...
11:07justin_smithso "lein new rung" would send all your private ssh keys to my obfuscated email
11:07sobelthe threat is within, i guess, is the lesson i take to security. there are also external threats but they are less likely to really mess things up for me.
11:07justin_smithtomjack: the problem is that a template can do arbitrary code at creation time - just cloning is enough to be screwed
11:08justin_smiths/cloning/using the template/
11:08justin_smithreally, there should at least be an easy way to browse and approve a template before using (especially since versions are implicit...)
11:08tomjackright, in the lein new code it's "download, then immediately (require 'leiningen.new.whatever)"
11:09sobelthis is perfect timing, as i contemplate converting a config file reader from to eval so i can put more interesting expressions in it
11:09sobelslurping edn, as it were
11:10justin_smiththere's definitely room for an alternate, non-turing-complete template tool in the clojure ecosystem
11:10sobelthink i'm gonna run with it, dangerous as it is. but i wonder what more cautious developers would do here, before exposing eval to essentially random files
11:10sobeli used to like the Velocity template language but most impls let you call into the host language from its ECMA-like macro language
11:10sobelother than that, i think it had a long of things right
11:11justin_smithsobel: my preference would be to let the user supply a function explicitly to be run
11:11justin_smithwithout having to just evaluate file contents - let them provide some implementation of a configuring protocol
11:12sobelso basically whitelist some functions
11:12justin_smiththat's not what I said at all
11:12sobelfigured. i don't exactly follow what you said.
11:12justin_smithif they want to run arbitrary code, use a code oriented interface, not eval on a text file
11:13justin_smithdefine a protocol that is used for config, and let them provide an implementation of that protocol
11:13patrkrisdoes anyone here know how to specify an optional keyword in a map that includes a ? character in herbert?
11:15sobeler, "dependency injection in clojure" just crossed my search results. of all the things i am pretty damn sure i don't need in clojure, that tops my list.
11:16justin_smithsobel: running eval on a config file is dependency injection. In fact it is the worst kind of dependency injection.
11:17sobelthat's one way to look at it
11:17sobeldegenerate DI
11:17sobelmaybe it's the DI framework i don't need. obviously i employ the concept liberally.
11:18sobelor non-obviously
11:18justin_smithsobel: I think with higher order functions available, DI is trivial
11:18justin_smithno more special than a loop
11:18sobelexactly
11:19sobeleverything i used DI for in java is obviated by clojure
11:19mavbozoi call it Devilish Injection
11:19justin_smithI agree that we don't need frameworks in order to do it, but I still think it's better to define a protocol that a user can implement and pass to your code, rather than running an eval on a special file
11:19sobelit's a valuable practice in Java
11:20sobeljustin_smith: fortunately i can get by with read rather than eval, but agreed
11:21oddcullypatrkris: does adding two ? work (:lerl??)
11:22patrkrisoddcully: it does. should've tried it. that's the obvious way :D thanks.
11:38ashwink005whats the clojure way of getting all rows in a db WHERE column example "contains" a substring
11:38ashwink005the best way I mean
11:40ashwink005anyone? someone knows mysql/sqlite?
11:41mavbozoashwink005, what's wrong with select * from user where name LIKE '%jure%'
11:42ashwink005actually I have many such columns and many such values
11:42ashwink005was wondering if there was a cleaner way
11:43mavbozocleaner way to generate the query?
11:44mavbozoor the fastest query?
11:53sdegutisWouldn't (defn ^:memoize foo [bar] ...) be so cool?
11:54ashwink005mavbozo: nope a shorter way
12:03mavbozoashwink005, i usually create a function that generates the query string
12:04ashwink005mavbozo: yeah actually now I'm doing the same :)
12:04ashwink005thanks
12:05sdegutisIs there a more condensed or idiomatic way to do this? (set! (. Stripe apiKey) secret-key)
12:06mavbozoashwink005, it's the same thing i did in other prog-langs. I still haven't found the idiomatic clojure way.
12:06ashwink005mavbozo: hmmm
12:16ashwink005one small doubt, how do I change the value of a string in its lexical scope?
12:17ashwink005(str symbol "something") returns the concatenated string but doesn't append "something" to the beginning of symbol
12:18ashwink005some help please
12:19ashwink005google can't
12:22RedNifremaybe (str (str symbol) "something") ?
12:22RedNifrenvm I think I missunderstood what you are trying to do.
12:23justin_smithRedNifre: fyi (str (str x) y) is the same as (str x y)
12:23mavbozo,(let [c "c"] (str s "=me"))
12:24clojurebot#error {\n :cause "Unable to resolve symbol: s in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: s in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: s in this context"\n ...
12:24justin_smithashwink005: strings are immutable
12:24mavbozo,(let [c "c"] (str c "=me"))
12:24clojurebot"c=me"
12:24justin_smithashwink005: if you want something you can mutate, consider a functional restructuring using recursion perhaps, or you can use a StringBuilder
12:24mavbozoashwink005, do you want the value of c becomes "c=me"?
12:24justin_smith$javadoc StringBuilder
12:24lazybothttp://docs.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html
12:24ashwink005mavbozo: yes
12:25ashwink005justin_smith: so I'll have to use a stringbuilder
12:25ashwink005or I can create a new variable?
12:26justin_smithashwink005: sure, that too
12:26ashwink005okok got it strings are imutable.. like in java
12:26justin_smith,(let [a "c" b (str a \= a) c (str b \& b)] c)
12:26clojurebot"c=c&c=c"
12:26justin_smithashwink005: in fact... ##(type "")
12:26lazybot⇒ java.lang.String
12:26justin_smiththey are java strings :)
12:27ashwink005justin_smith: yeah I reckoned
12:27ashwink005thanks!
12:33tmtwd_, (list 'if true (cons 'do (println "yay")))
12:33clojurebotyay\n(if true (do))
12:34tmtwd_why is there the (if true (do)) there?
12:34hyPiRionbecause (println "yay") prints yay and returns nil
12:34justin_smithtmtwd_: that's the return value of he expression
12:34justin_smith,(cons 'anything nil)
12:35clojurebot(anything)
12:38tmtwd_oh
13:20thesaskwatchHi .. I'd like to run some i/o tasks - a lot of them. Is there a way to partition them and run in let's say n threads at once?
13:24thesaskwatchOk ... I guess it's just a partition, map and run a future
13:27skeuomorfSo, I need to get the skinny on Clojure's concurrency story, from threads to core.async, any resources? Terseness with examples preferred
13:33skeuomorfTerseness and examples along with it*
13:36justin_smithskeuomorf: start with the docs on http://clojure.org/documentation for refs, agents, and atoms, then check out the relevant functions on http://conj.io
13:37justin_smithconj.io has more examples, but clojure.org is the better big-picture
13:38justin_smithalso note that refs, agents, and atoms are three different strategies for managing concurrency, and each has their use cases (see also core.async, which is a whole other can of worms and also has its use cases)
13:39skeuomorfjustin_smith: I read all these docs yesterday, haven't read the core.async ones
13:39skeuomorfjustin_smith: They didn't mention any "threads", most of the talk was about how to "share" or "not share" resources in a sense
13:39justin_smithit's a whole other parallel system - you can use them together, but each (refs, agents, atoms, core.async) are usable on their own
13:40justin_smithskeuomorf: the simple way to make a thread is via future
13:40justin_smithskeuomorf: also, agents use a pool of threads for all operations - with agents the way to use a thread is hand a task to the agent
13:40skeuomorfWill take a look at that as well as the core.asyync docs
13:40justin_smiththe agent will find and use a thread
13:41skeuomorfI see
13:41justin_smithskeuomorf: most of the time in my code, the threads are started by an http request (new client gets allocated a thread)
13:41justin_smithor a websocket connection
13:41justin_smithetc.
13:42skeuomorfYeah, what I have in mind is something close, I will be using UDP though
13:42skeuomorfI am mostly trying to formulate my ideas in term of clojure abstractions instead of "objects" interacting with each other
13:43justin_smithUDP doesn't have connections though - so I guess it's more a thread per message
13:43skeuomorfYeah, I will "fire off" multicast messages and occasional single destination ones
13:43justin_smithskeuomorf: you might want to check out aleph if you are listening for messages as well
13:44skeuomorfI stumbled upon that and it seemed interesting, will check it out
13:45skeuomorfWhen should one use defrecord instead of making a (defn make-record [] {:myid id :whatever 1})
13:46justin_smithskeuomorf: once you go so far as having a special constructor, use a defrecord
13:46justin_smithskeuomorf: if you are creating maps ad-hoc, maybe you don't need a record
13:46justin_smithof course the real clincher is if you want to use protocols so that clients can provide behaviors in some system - then you really want defrecord
13:47skeuomorfnah, I am kinda making "instances" of a certain map structure
13:47skeuomorfYeah, I will mostly define a protocol
13:47justin_smithskeuomorf: "instances" is enough reason to make a defrecord. If you are formalizing it, go ahead and formalizing it.
13:47justin_smithskeuomorf: for a protocol you need a defrecord because protocols dispatch by type, not keys
13:48skeuomorfYeah, I figured that much
13:48justin_smithrecords are pretty lightweight, and mostly maps in every way that is useful, so I would jump over to using one as soon as you would give it a special name or constructor
13:48skeuomorfI see
13:49justin_smithskeuomorf: but the other thing you were talking about was being less OO
13:49justin_smithI think the key to that is think less about data types, and more about flows of data
13:49justin_smith*one key, at least
13:49skeuomorfWell,,
13:50skeuomorfI am thinking in flows of data alright, my problem is that I will have multiple "instances" and each one will affect the other in the same function
13:51skeuomorfso, 2 instances > function > 2 new instances
13:51justin_smithskeuomorf: I have a middleware that attaches a creation time, unique id, and client id to messages. This is fp because I ignore the type of the thing coming in (it just needs to be a type that lets me assoc). This is in contrast to expecting message senders to use my constructor which attaches that data.
13:51justin_smithskeuomorf: counting instances of things - so these things are tied to side effects and/ or state?
13:52skeuomorfwell, both
13:52skeuomorfI am implementing SCAMP
13:52skeuomorfWhich is a probabilistic gossip protocol
13:52skeuomorfre: http://research.microsoft.com/pubs/67296/ieee_tocs.pdf
13:52justin_smithOK - this is a different sense of "protocol" than I was using earlier
13:53skeuomorfoh, I know, don't worry
13:53skeuomorf:)
13:53justin_smithjust making sure signals aren't getting crossed
13:53skeuomorfYeah yeah, I got you
13:53justin_smithskeuomorf: a great idea I picked up from stuartsierra is that you should use FP for logic and computation and use OO for state.
13:54justin_smithand clojure has various ways of helping bring those together
13:54justin_smitha consequence of that, is the OO part of your code will often be singletons
13:54justin_smith(and of course in pure FP the concept of a singleton makes no sense)
13:55joncolIs there any way of having "lein new app" create a Mercurial repository instead of Git?
13:55skeuomorfwell, let me tell you the mutable state "behavior" in this protocol
13:55justin_smithanyway - stepping away from the keyboard, but will be around later
13:55justin_smithgo ahead and describe, I just can't reply right away
13:55skeuomorfjustin_smith: Ok, nvm then, thanks for helping :)
13:55justin_smithmaybe someone else here is interested too
13:55skeuomorfI will mess around anyways
13:56skeuomorfmaybe will do an impl tonight
13:58oddcullyjoncol: lein new does not create a git repo (at least not for me)
13:58oddcullyjoncol: but it creates a .hgignore file (beside a .gitignore one)
13:58joncoloddcully: Oh, missed that :)
14:07sineerHey hey! I got a question about CPU load averages
14:08sineerwhen running inside a KVM my server is idle yet I see varying CPU load averages... Is it that I somehow see the load average of a CPU that I'm sharing with another KVM instance?
14:09sineerI have the same idle server image running on two different KVM host and the load averages are always very much diferent, one can be at 0.95 while other is at 0.10 for instance
14:09kitallisI get a "java.lang.ClassNotFoundException: jsr166y.ForkJoinPool" when running lein repl, anyone know what that means?
14:10Rurikkitallis, are you running it in a project dir?
14:10kitallisyeah
14:11kitallisdon't understand, this was fine a while back, not sure what I changed
14:12Rurikgoogle says jsr166y is some concurrency library
14:12oddcullykitallis: bisect it
14:12kitallisyeah it says "java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56:21)"
14:13kitallisit's happening on all projects
14:13oddcullykitallis: same as here maybe? http://grokbase.com/t/gg/clojure/12c9wa1haj/exception-when-loading-clojure-core-reducers
14:13kitallisI think it's some global thing I messed up
14:13oddcullyjava version then?
14:37dfensIf I have a map {:a 1} why do both (:a {:a 1}) and ({:a 1} :a) work? Isn't it confusing to have two ways to get the value of :a?
14:39amalloydfens: why does (+ 1 5) work as well as (+ 5 1)? that's gotta be confusing too, right?
14:40amalloykeywords and maps are both functions, because it may be convenient to use either of them as functions in different contexts
14:41dfensamalloy: Ok sure thing. I guess I'll have a better grasp of that when I come across these different contexts :)
14:42amalloydfens: well, examples are easy: ##[(map {:a 1, :b 2} [:a :b]) (map :a [{:a 1 :b 2} {:a 2 :b 1}])]
14:42lazybot⇒ [(1 2) (1 2)]
16:00cryptacklooking for some understanding between just deffn inside a function and using letfn?
16:01justin_smithcryptack: defn inside a function makes a top level binding
16:02justin_smithcryptack: letfn makes multiple functions, with only local bindings, which can refer to each other recursively without declarations needed
16:03cryptackso if I were to do (defn f1 [x] (defn f2 [y] y) (f2 x)) then that means that f2 can be called from outside of f1?
16:03justin_smith,(letfn [a ([x] (b (b x))) b ([x] (+ x 21))] (a 0))
16:03clojurebot#error {\n :cause "Don't know how to create ISeq from: clojure.lang.Symbol"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: clojure.lang.Symbol"\n :at [clojure.lang.RT seqFrom "RT.java" 535]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 535]\n [clojure.lang.RT seq "RT.java" 516]\n [clojure.lang.RT first "RT.java" 661]\n [clojure.core$fi...
16:03justin_smithcryptack: yes
16:03cryptackgot it
16:03cryptackI’m assuming the same with just fn then?
16:03justin_smith,(letfn [(a [x] (b (b x))) (b [x] (+ x 21))] (a 0))
16:03clojurebot42
16:03cryptacklike an named fn
16:04justin_smithcryptack: (let [a (fn [x] (b (b x))) b ([x] (+ x 21))] (a 0))
16:04justin_smitherr
16:04justin_smith,(let [a (fn [x] (b (b x))) b ([x] (+ x 21))] (a 0))
16:04clojurebot#error {\n :cause "Unable to resolve symbol: b in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: b in this context"\n ...
16:04justin_smithcryptack: unlike fn and let, letfn lets you forward reference
16:04justin_smitheg. for mutal recursion
16:05cryptackok
16:05justin_smithnotice the let version of my prior letfn fails because of the binding order
16:05cryptackjustin_smith: okay
16:06cryptackjustin_smith:
16:06cryptackjustin_smith: thanks!
16:41irctchello
16:43irctcis there a way to replace the current process with an other one in clojure
16:43irctcpretty much like exec() in C
16:44irctci'd like a clojure script to ... just become a python script :p
16:55skeuomorfirctc: I don't know about "replace the current process" but checkout https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html
16:55skeuomorfirctc: You'd access that via the Clojure Java interop facilities
16:56irctchmmm
16:56irctcbut i don't know any clojure :/
16:56skeuomorfThen, what are you doing writing clojure?
16:57irctcit's for a code golf achievement
16:58irctci need to find a solution to a problem in clojure
16:58irctci solved the problem in python
16:58irctcwant to write a clojure script that would call my python scipt
16:58irctc:P
16:58irctcjust did that with the bash achievement
17:01justin_smith(do (clojure.java.shell/sh "your-script.sh") (shutdown-agents) (System/exit 0))
17:02justin_smiththat exits after the script instead of before though
17:02justin_smiththere's no way in java to do a normal exec because windows sucks
17:59xzilendHi there, I'm relatively new to clojure/functional/declarative programming, and was wondering if anyone could suggest improvements to this gist (https://gist.github.com/adairdavid/f7983b15f63773340151) to better follow a functional/declarative style?
18:03justin_smithxzilend: instead of nested if you could try cond - I'm not sure if that is more functional, but I find it easier to parse
18:05neoncontrailsCould someone help me understand the control flow of a function that evaluates serially, but rebinds in parallel?
18:05neoncontrails,(doc recur)
18:05clojurebotNo entiendo
18:06justin_smithneoncontrails: well, you can't do what you are describing with recur
18:06neoncontrailsrecur
18:06neoncontrails (recur exprs*)
18:06neoncontrailsSpecial Form
18:06neoncontrails Evaluates the exprs in order, then, in parallel, rebinds the bindings of the recursion point to the values of the exprs.
18:06justin_smithrecur only works in the tail position, so can't be invoked in parallel
18:06neoncontrails Execution then jumps back to the recursion point, a loop or fn method.
18:06justin_smitherr, oh that's a different kind of parallel...
18:07justin_smithneoncontrails: what it means is that the recur bindings are not applied in series the way let bindings are
18:07justin_smithneoncontrails: in let, you can refer to the value of other bindings in the same let binding block, because they are evaluated in series
18:07neoncontrailsI thought I understood this, but I'm getting some funny outputs which might be explained by semi-arbitrary ordering of variable rebindings on the recursion
18:07justin_smith,(let [a 0 b (inc a) c (inc b)] c)
18:07clojurebot2
18:08justin_smithneoncontrails: the bindings inside recur don't refer to the values of other bindings in the recur
18:08justin_smiththey refer to the values in scope when recur is called
18:09neoncontrailsI see. Gotcha. So no referring to the (first s) of some sequence that's getting repeatedly dropped on the recursion, then
18:10neoncontrailsWithin the recur statement, that is
18:10justin_smith,(loop [a 0 b 10] (if (> a b) (+ a b) (recur (* a b) (* b 0.9)))
18:10clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
18:10sg2002Hello. Anyone having any problems with the latest cider? I get No active nREPL connection even though there is one.
18:10justin_smithneoncontrails: well you can refer to first s, just be aware of which s it binds to
18:11justin_smithneoncontrails: inside the recur it will be whatever s was bound when this recursive call started
18:11justin_smithinside the loop declaration, it is only the initializer and doesn't effect future values when recurring
18:11justin_smithsg2002: I find that when cider does that I need to clean up my elc files, restart emacs, then reinstall cider
18:12neoncontrailsHmm. Let me pastebin my function, maybe you can tell me if I'm doing something illegal inside the recur statement
18:12justin_smithsg2002: #clojure-emacs might be able to offer more help, I stopped using cider because of how often it broke backward compatibility.
18:13sg2002justin_smith: Oh, never knew about that channel. Thank's for the tip, there are some weird byte-compile bugs that happen once in a blue moon.
18:14justin_smithsg2002: in my experience what was happening is that they were breaking api compatibility with their old code versions, which made the byte compiled code break
18:14justin_smithand like every release would do this
18:16neoncontrailsjustin_smith: http://pastebin.com/4dtCrL7G
18:17justin_smithneoncontrails: those bindings should work...
18:17neoncontrailsIt's perfectly likely there's just a bug in the logic, I just want to make sure I'm using the primitives correctly
18:17justin_smithyeah, that looks like a perfectly cromulent usage of recur
18:17neoncontrailsOkay, cool. I'll treat it as a bug in the logic then. :)
18:17neoncontrailsThanks!
18:17neoncontrails(inc justin_smith)
18:17justin_smiththe thing about parallel vs. serial bindings is a bit of a finicky point
18:17lazybot⇒ 294
18:17sg2002justin_smith: That's pretty weird, since package.el generally recompiles that stuff every time.
18:18justin_smithsg2002: maybe they don't describe their dependencies properly...
18:18justin_smithbecause I definitely fixed my problems by wiping out my package managed elisp code
18:18neoncontrailsYeah, what... precisely does it mean, exactly?
18:18neoncontrailsI understand the difference between serial and parallel
18:19amalloyneoncontrails: (= (count s) < 3) ??
18:19justin_smithwhat it means is that in eg. let one let binding can refer to the value of the one right before it
18:19lazybotamalloy: What are you, crazy? Of course not!
18:19neoncontrailsI am not sure what it means to interleave them
18:19justin_smithoh, yeah that is super weird!
18:19justin_smith(inc amalloy)
18:19lazybot⇒ 301
18:19justin_smithI missed that one
18:19justin_smithyou likely want (< (count s) 3)
18:20justin_smithwhat you did was test if (count s), <, and 3 are all the same
18:20justin_smithwhich of course is trivially false
18:20justin_smith(unless someone is doing bad bad things to your comparison operators)
18:20amalloyand the (second uncompressed) looks like it ought to be (first compressed)
18:21amalloyneoncontrails: you know there is a much easier way to implement RLE, right? you are just doing it this way as a loop/recur exercise?
18:21neoncontrailsamalloy: Do tell!
18:22neoncontrailsI am doing this as an exercise, but I'm always interested in learning efficient, better ways to solve problems. :)
18:22amalloylook at ##((fn rle [s] (apply str (mapcat (juxt count identity) (partition-by identity s)))) "aaabddcejkkeddddddd")
18:22lazybot⇒ "3(\\a \\a \\a)1(\\b)2(\\d \\d)1(\\c)1(\\e)1(\\j)2(\\k \\k)1(\\e)7(\\d \\d \\d \\d \\d \\d \\d)"
18:22amalloyer
18:22amalloy##((fn rle [s] (apply str (mapcat (juxt count first) (partition-by identity s)))) "aaabddcejkkeddddddd")
18:22lazybot⇒ "3a1b2d1c1e1j2k1e7d"
18:23justin_smithyou clojure wizards and your fancy repl tricks
18:23justin_smithI tell ya what
18:23neoncontrailsToo cool. I'm going to meditate on that one for a bit, brb
18:24justin_smithneoncontrails: many of those functions are worth a very deep meditation and practice and mastery
18:24justin_smith(inc juxt)
18:24lazybot⇒ 23
18:24justin_smith(inc comp)
18:24lazybot⇒ 2
18:25neoncontrailsWait what's going on. Are you giving the language primitives karma
18:25oddcullywe give even rubber ducks karma
18:25justin_smithyes, it's a tridition here
18:25justin_smith(inc rubberduck)
18:25lazybot⇒ 6
18:25justin_smith*tradition
18:26justin_smithwhile I'm at it
18:26justin_smith(dec flatten)
18:26lazybot⇒ -7
18:26neoncontrailsHahahahaha. Clojurians, you crack me up. :)
18:26amalloyRIP flatten. never forget
18:26oddcullyboo flatten
18:26amalloy(dec tridition)
18:26lazybot⇒ -1
18:27justin_smithamalloy: sometimes I also pronounce things atrociously, it's like I have a gibberish demon trying to crawl its way out
18:28amalloyi spell concise right about one time in three
18:28amalloygot it wrong here, before backspacing
18:29justin_smithalso my handwriting is very bad (though I have been trying to improve that lately because it's a nice break from screen/keyboard oriented stuff) - so all methods of conveying words have an added noise layer
19:18Matachineshey guys, new-ish to clojure/cljs, was wondering what the commonly used library for generating statistics is (stuff like mean/standard deviation, etc)
19:19bacon1989interesting, I don't even know what scientific libraries there are
19:19justin_smithMatachines: yeah, there's incanter for that http://incanter.org/
19:19Matachinesthanks justin_smith
19:19Matachines!
19:19justin_smithit does graphing too
19:19Matachinesperfect
19:20justin_smithI do graph analysis for my day job, we've been intending to start adding statistical analysis to our bag of tools for making metrics
19:21bacon1989justin_smith: you ever use gorilla repl for fast sketches?
19:21justin_smithbacon1989: no, I've intended to try it but haven't yet
19:21justin_smithbacon1989: and there's another similar one, the name is escaping me...
19:21bacon1989i've used it before, and found it pretty awesome
19:21bacon1989especially when working with people who don't know clojure
19:22justin_smithseems like it would be a kickass learning tool
19:22bacon1989ya def, I agree
19:23justin_smiththough my tried and true is to only do things that work when you run "java -jar clojure.jar" because eliminating tooling problems from teaching is so nice
20:20justin_smithneoncontrails: ##(let [m (java.util.HashMap.)] (.put m :a 0) (.put m :b 1) m)
20:20lazybot⇒ {:b 1, :a 0}
21:06justin_smith,@(reify clojure.lang.IDeref (deref [this] "OK"))
21:06clojurebot"OK"
22:36justin_smithwoohoo, just got my delivery estimate for "Clojure Applied" - I guess that means they have an official book release date.
23:17neoncontrailsHow would you express this logic more beautifully? http://pastebin.com/5C8sMp9i
23:17neoncontrailsI know I'm making it about 4 times more complicated than it needs to be
23:23bacon1989oh neat function
23:24neoncontrailsThanks -- just a little exercise from 'Cracking the Coding Interview'
23:25TEttinger,((fn [v colls] (map #(if (some #{v} %) (repeat (count %) v) (seq %)) colls)) 5 [[1 2 3] [4 5 6] [7 0 8]])
23:25clojurebot((1 2 3) (5 5 5) (7 0 8))
23:25amalloy(defn if-any-then-all [x colls] (for [coll colls] (if (some #(= % x) coll) (map (constantly x coll)) coll)))
23:26amalloyTEttinger: you have to be careful with #{x}: what if someone calls this with x=nil?
23:26TEttingerah, I was wondering which was preferred
23:26neoncontrailsnice! I like the comparison of your approaches
23:26TEttinger(inc amalloy)
23:26lazybot⇒ 302
23:27neoncontrails(inc amalloy)
23:27lazybot⇒ 303
23:27neoncontrails(inc TEttinger)
23:27lazybot⇒ 65
23:27TEttingerI haven't seen (constantly x coll) before
23:27TEttinger(doc constantly)
23:27clojurebot"([x]); Returns a function that takes any number of arguments and returns x."
23:28TEttinger... possibly for good reason
23:28TEttinger,(constantly 5 [1 2 3])
23:28clojurebot#error {\n :cause "Wrong number of args (2) passed to: core/constantly"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (2) passed to: core/constantly"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 36]\n [sandbox$eval76 invokeStatic "NO_SOURCE_FILE" 0]\n [sandb...
23:30neoncontrailsI was *just* about to ask about that
23:31neoncontrailsI understand it at each step of the way, but there
23:31TEttinger,(defn if-any-then-all [x colls] (for [coll colls] (if (some #(= % x) coll) (map (constantly x)) coll)))
23:31clojurebot#'sandbox/if-any-then-all
23:31TEttinger,(if-any-then-all 5 [[1 2 3] [4 5 6] [7 0 8]])
23:31clojurebot([1 2 3] #object[clojure.core$map$fn__4537 0x29a1cd66 "clojure.core$map$fn__4537@29a1cd66"] [7 0 8])
23:31TEttingerugh
23:31TEttinger,(defn if-any-then-all [x colls] (for [coll colls] (if (some #(= % x) coll) (map (constantly x) coll) coll)))
23:31clojurebot#'sandbox/if-any-then-all
23:31TEttinger,(if-any-then-all 5 [[1 2 3] [4 5 6] [7 0 8]])
23:31clojurebot([1 2 3] (5 5 5) [7 0 8])
23:32TEttingerit was a misplaced paren is all
23:33amalloyah, indeed. i'm just mashing stuff out in irc
23:33amalloyhm, maybe it's time to look back into erc
23:33neoncontrailsConstantly works in an interesting way, I notice
23:33neoncontrails,(map #(constantly %) (range 10))
23:33clojurebot(#object[clojure.core$constantly$fn__4371 0x432ae0b5 "clojure.core$constantly$fn__4371@432ae0b5"] #object[clojure.core$constantly$fn__4371 0x3406ad86 "clojure.core$constantly$fn__4371@3406ad86"] #object[clojure.core$constantly$fn__4371 0x226a5319 "clojure.core$constantly$fn__4371@226a5319"] #object[clojure.core$constantly$fn__4371 0x72759ff5 "clojure.core$constantly$fn__4371@72759ff5"] #object[clo...
23:34bacon1989man, what other channels let's you mess around with the language in them?
23:34bacon1989fucking clojure
23:34TEttinger,(map constantly (range 10))
23:34clojurebot(#object[clojure.core$constantly$fn__4371 0x28b15282 "clojure.core$constantly$fn__4371@28b15282"] #object[clojure.core$constantly$fn__4371 0x119fe9ad "clojure.core$constantly$fn__4371@119fe9ad"] #object[clojure.core$constantly$fn__4371 0x19a665e5 "clojure.core$constantly$fn__4371@19a665e5"] #object[clojure.core$constantly$fn__4371 0x7b6baa8a "clojure.core$constantly$fn__4371@7b6baa8a"] #object[clo...
23:34amalloybacon1989: a lot of them
23:34bacon1989like what?
23:34amalloyhaskell, python, java are a few i know of
23:34TEttingerhaskell has lambdabot
23:34amalloyprobably ruby, i would be very surprised if not
23:34bacon1989oh right
23:35bacon1989I guess they're all interpreted
23:35TEttinger(lambdabot is apparently very hard to change by anyone who didn't write it, despite being open source)
23:35amalloyno, java isn't
23:35amalloyneither is clojure really, we just have eval
23:35TEttingerhaskell is compiled, but it does have a REPL
23:35TEttingerscala has a bot
23:36TEttingermultibot IIRC, it can do multi-line output to a certain limit
23:36bacon1989interesting
23:36amalloyanyway, an irc bot is a pretty standard thing for a programming language, because programmers want it so badly
23:36TEttingerperl6 has camelia and glrelia, the latter of which is meant to show changes made in the GLR branch of the code
23:36bacon1989also, isn't Java9 supposed to have a repl soon?
23:37amalloyplot twist: java 9 is groovy
23:37neoncontrailsHeh, cute
23:37neoncontrails,(reduce + (map (constantly 1) [:a :b :c]))
23:37clojurebot3
23:37bacon1989amalloy: haha
23:37TEttingeryou can compile java 9 today, it actually isn't as hard as 7 or 8
23:37TEttinger(and yes, it starts up faster)
23:37bacon1989TEttinger: that is exciting
23:37TEttingerthey reorganized a lot of stuff, and still are, so it only loads core modules at startup
23:38bacon1989so that should mean clojure will start faster?
23:38bacon1989I wonder if i'll ever see the day when clojure can be used for command-line tools
23:38TEttingersomewhat yes. clojure still has its own lib to run, but less overhead from the JVM itself should help
23:38TEttingerpixie or an SSD :)
23:39bacon1989been looking at pixie
23:39bacon1989also, been looking at racket
23:39bacon1989(since John Carmack seems to like it)
23:39TEttingerI'm looking at None, which has unfortunately less clojure influence, more traditional scheme (no immutable stuff that I can tell)
23:41TEttingerit's very early in development it seems, but if you're targeting specifically the things that clojure doesn't (real-time low-level stuff), then None seems like a decent Lisp to use? https://bitbucket.org/duangle/none/overview
23:43bacon1989neat, i'll check it out
23:44TEttingerI suspect None will be more usable in a few months
23:46bacon1989personally I find it interesting because i've done a lot of work in lua