#clojure logs

2016-02-28

01:12joker_Newbie question: Do I have include/require any ns to use 'source' and 'find-doc' functions in a nREPL (counterclockwise eclipse IDE) ?
04:53rinatHi. Sorry for noob question in advance. I'm trying to learn Clojure, building a small API with a bunch of components (using component lib). However, I can't figure out how to make Liberator work nicely with Component. Are they a good fit for each other?
05:27john222222I’ve just started with emacs and cider. does cider use something differnt to provide expand-region functionallity?
09:05justin_smiththe answer to joker_'s question above is clojure.repl, but seems joker_ is not around
10:23renlhi im having some trouble using leinigen, it says Failed to resolve version for play-clj:lein-template:jar:RELEASE: Could not find metadata play-clj:lein-template/maven-metadata.xml in local
10:24renlthis is while using linux in my vmware
10:24justin_smithrenl: that's while trying to do "lein new play-clj foo" right?
10:26renlyeah
10:26justin_smithinteresting, what lein version?
10:26renlLeiningen 2.6.1 on Java 1.8.0_66-internal OpenJDK 64-Bit Server VM
10:27justin_smithinteresting
10:27justin_smithbrb
10:27renlthanks! :D
10:31ridcullyyour network is fine in your vm? e.g. a curl call into the world works?
10:31renlnetwork is fine with vm, this irc client is currently connected from my vm
10:33justin_smithrenl: could be clojars was down for a moment - I was just able to run that just fine
10:33ridcullydito
10:34renli tried it yesterday and today both times didnt work, trying it now again
10:35renlnope still not working
10:36renloh when i just add it as a dependency in the project.clj i get this
10:36renlCould not transfer artifact org.clojure:clojure:pom:1.8.0 from/to central (https://repo1.maven.org/maven2/): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
10:36justin_smithcan you ping clojars.org?
10:36justin_smithrenl: aha!
10:36renlping works
10:36justin_smiththis is the bullshit java on ubuntu trustdb bug
10:36renloh?
10:36renllet me google that mmm
10:36justin_smithrenl: http://askubuntu.com/a/635395
10:37justin_smithit's a simple fix
10:37justin_smithstupid bug
10:37justin_smith(swap! ubuntu dec)
10:37renlcool thanks! :D
10:38renlwoo works :D
10:39gfredericksjustin_smith: yeah it definitely has some sort of size threshold, same for maps
10:39gfrederickseven though it's the same underlying type
10:40justin_smithgfredericks: oh yeah, when I take the first of my two hash-sets and increase the size, then the problem kicks in, even on the first call
10:41jgertmis it normal that cljr-move-to-let only moves the current occurance of the form, not all of them?
10:42justin_smithgfredericks: the threshold, with a bit of trial and error, is at 8
10:42justin_smith8 or less is fine, adding the ninth item makes the bug happen
10:42justin_smithjgertm: what does "occurance of a form" mean?
10:45jgertmjustin_smith: identical expressions
10:45justin_smithaha
10:45justin_smithyeah, I bet it doesn't do that because the tool doesn't know that it's safe - I mean what if the expression has a side effect?
10:46justin_smithI don't know that, just a guess
10:46jgertmi just watched this video (https://youtu.be/mOSUE3czp9w) and thats what happens there
10:47jgertmjustin_smith: but maybe they realized that since. what youre saying makes sense
10:47benjyz1what's the easiest way to store clojure data structures? key-value store?
10:47benjyz1instead of just edn files
10:48jgertmthough they should still leave it to the user. its not cljr-refactor's job to enforce saftety after all
10:48justin_smithbenjyz1: datomic actually supports most of the clojure data types. But the translation to json is often good enough too (and a few different dbs support json)
10:49LauJensenGents, fun hobby task. I have 7 guests who has to be seated at 2 tables. 3 guests @ each table (the spare goes wherever). The trick is, noone must be seated with guests they have previously been seated with, unless thats impossible to avoid. Can anyone think of a good algorithm for sorting out the seating arrangements?
10:49benjyz1justin_smith: I'm considering datomic. I'm wondering whether I need to handle schemas at all
10:49justin_smithLauJensen: core.logic would handle that easily - once you figure out core.logic of course
10:50LauJensenjustin_smith, i'll go have a look
10:50justin_smithbenjyz1: depending on your correctness needs, the translation to/from monger is very simple also
10:50benjyz1i.e. rather than key-value store or schema-less .. monger.. right
10:50justin_smithmonger being a mongo lib
10:50benjyz1I've never used key-value store like redis
10:51justin_smiththat's not even a db
10:51justin_smiththat's a cache
10:51justin_smithI mean mongo is arguably in a similar position (more durable, maybe less reliable)
10:53benjyz1thx, I'll go with datomic. I want to avoid SQL for sure
11:55kungiIs (get-in m [:foo :bar]) or (-> m :foo :bar) more idiomatic?
11:55TimMcjustin_smith: Redis styles itself as a DB.
11:56TimMc(You don't have to set an eviction policy, IIRC.)
11:57justin_smithTimMc: fascinating ... https://muut.com/blog/technology/redis-as-primary-datastore-wtf.html
12:02justin_smithTimMc: redis also has distsys data loss bugs, as exposed by our friend aphyr
12:04TimMc"You have to be able to fit all your data in memory, and If your server fails between disk syncs you lose anything that was sitting in memory."
12:04TimMcwelp
12:04justin_smithhaha, yeah
12:05TimMcforgot about that part
12:05justin_smithTimMc: it's like the anti-kafka
12:05justin_smithin that kafka is meant to be a message queue, but almost accidentally has very reliable persistence
12:06justin_smith(because the fastest queue turns out to be the disk, used in strict sequential sectors)
12:13edmondo1984hello, is there anyone who can help a newbie to re-write assoc-in?
12:16TimMcedmondo1984: ...what needs rewriting about it?
12:20edmondo1984TimMc I am learning clojure, one of the exercises of Clojure for the brave and the true is to rewrite that funciton
12:21edmondo1984maybe to prove you understand recursion, in fact I didn't understand it because I can't rewrite it
12:27justin_smithedmondo1984: cool idea for that exercise is make it prefer to create a vector if they key is 0 and the parent is nil
12:28TimMc,(assoc-in nil [0] :probe)
12:28clojurebot{0 :probe}
12:28TimMcinteresting ambiguous case
12:29justin_smithI mean it makes the logic more complex for sure, but it would be a nifty behavior
12:32edmondo1984justin_smith are you
12:33justin_smithedmondo1984: I'm glad to provide feedback or suggestions if you have questions, or you can show what you've tried
12:34edmondo1984thanks
12:34edmondo1984so
12:34edmondo1984this is my first try
12:34edmondo1984http://paste.ofcode.org/?edit=WdwLuA3cgBdaegQgzPzAg
12:34luxbockI'd like to wrap a long-running process that communicates in via stdin and stdout into a REPL that I can then embed in a Clojure program
12:34edmondo1984I am missing the recursive branch
12:35luxbockdoes anyone here happen to have any resources on doing something like this? examples, blog posts, experiences etc.
12:35justin_smithedmondo1984: for starters, you have way too many parens
12:35justin_smithedmondo1984: in clojure, (f) is like f() in another language
12:35justin_smithwhat you are doing is effectively f()() (in a few places) which is almost always wrong
12:35justin_smithand in your case, recur doesn't even allow that
12:37edmondo1984ok
12:37edmondo1984so...
12:37edmondo1984where is the exceeding parenthesis?
12:38justin_smithedmondo1984: pretty much everywhere you have ((
12:38justin_smithwhat you are doing is ((f)) instead of (f), and these are very different in clojure
12:39edmondo1984I see, are you saying around the if?
12:39justin_smithno, if doesn't have ((
12:39edmondo1984I thought because the if it's a special form I should do (if (f) (f1) (f2) )
12:39justin_smithbut your loop and recur are both broken because they are wrapped in ((
12:39justin_smithedmondo1984: no
12:39justin_smiththe if has nothing to do with this
12:39TimMcjustin_smith: "f()()", that's a good way of explaining that.
12:40justin_smithTimMc: thanks, but the correct form might be something terrible like (f())() but we can pretend it's a non-terrible algol family language I invented
12:40justin_smith(due to precedence of ())
12:40jonathanjcan one do the equivalent of passing `-Dsomething=x` to java from an application already running in the JVM?
12:41justin_smithjonathanj: (System/setProperty "something" "x")
12:41jonathanjfantastic, thank you
12:41edmondo1984so justin, the first parenthesis is the one that wrap the body of the function
12:41justin_smithno!
12:41edmondo1984I thought this was mandatory by syntax?
12:41edmondo1984AH!
12:41justin_smithedmondo1984: that isn't even a thing!
12:41justin_smiththere's no such thing
12:42edmondo1984so the parenthesis before the loop
12:42edmondo1984is not needed
12:42justin_smith,((fn []))
12:42clojurebotnil
12:42justin_smithedmondo1984: not only is it "not needed", it is an error
12:42edmondo1984got it
12:42justin_smithedmondo1984: there is no such thing as free parens in clojure
12:42edmondo1984because it would treat the loop block as a function
12:42justin_smiththey always do something, unlike in math class
12:42justin_smithexactly
12:43TimMcedmondo1984: Take a look at these three evaluations:
12:43edmondo1984which constructs are not function? loop, if, let?
12:43TimMc,(let [f (fn [] 3)] (f))
12:43clojurebot3
12:43TimMc,(3)
12:43clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval77 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval77 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval77 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6927]...
12:43justin_smithedmondo1984: it doesn't matter - those things are all callable, thus they all need to be wrapped in parens
12:43TimMc,(let [f (fn [] 3)] ((f)))
12:43clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval101 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval101 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval101 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69...
12:43edmondo1984,(constant 3)
12:43clojurebot#error {\n :cause "Unable to resolve symbol: constant in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: constant in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: constan...
12:43edmondo1984,(constantly 3)
12:43clojurebot#object[clojure.core$constantly$fn__4614 0x4c760aaa "clojure.core$constantly$fn__4614@4c760aaa"]
12:43justin_smithedmondo1984: whether they are functions or not comes up later
12:43edmondo1984,((constantly 3))
12:44clojurebot3
12:44edmondo1984got it
12:44edmondo1984the () resolve the function execution
12:44edmondo1984cool
12:44justin_smithwe use "resolve" to mean "look up a value in a namespace" but yes, (f) calls f (or attempts to), with very few exceptions
12:44justin_smithone of those exceptions being case
12:44edmondo1984cool
12:44justin_smithI forget the other one right now
12:45TimMc(...) is a list, and evaluating a list in Clojure means calling the first item
12:45justin_smith,(case 1 (1 2) :this (3 4) :that)
12:45clojurebot:this
12:45edmondo1984but look in this example
12:45edmondo1984https://clojuredocs.org/clojure.core/recur
12:45edmondo1984the first loop is wrapped by ()
12:45justin_smithedmondo1984: sure - loop is something you call
12:46justin_smithedmondo1984: but notice you don't wrap that in yet another pair of parens
12:46justin_smithedmondo1984: as I said before, we don't need to worry about what's a function vs. macro vs. special form yet, the rules are the same - wrap it in parens to invoke it
12:47edmondo1984ok so why in my example is an error?
12:48edmondo1984It's really difficult to understand clojure from a non lisp background :)
12:49rhg135Cuz f() is easier than (f)
12:49justin_smithedmondo1984: ((loop)) in clojure is like loop()() in js
12:49justin_smithsee what's wrong there?
12:50justin_smithsimilarly ((recur)) is recur()()
12:51justin_smith((loop)) is usually an error - unless you expect your loop to return something you call
12:51edmondo1984oh right there's an additional parenthesis around loop
12:52justin_smith((recur)) is always an error, because recur must be in tail position, and the extra parens mean it is not in the tail position
12:52edmondo1984http://paste.ofcode.org/JRWWTmfP9vcejmQe87zU3Y
12:53justin_smithmuch better
12:53edmondo1984now the question is I don't know how to recurse
12:53justin_smithrecur takes half as many args as you put in your loop binding block
12:53justin_smithso it sends a new value for each binding
12:54edmondo1984that's what I don't know how to express in clojure
12:54justin_smithedmondo1984: two more problems - your recur is outside the loop body, and the if is a noop
12:54edmondo1984so I think first of all that my bindings need to have the keys
12:55justin_smithedmondo1984: right now your second binding has the keys
12:55edmondo1984oh yeah I corrected it already
12:55edmondo1984I forgot that improvement
12:56justin_smithedmondo1984: this is much harder to do with loop/recur, and much easier to do with primitive recursion
12:56justin_smith(this particular assignment, that is)
12:56edmondo1984right
12:57edmondo1984what's the difference?
12:57justin_smithin order to do this with loop/recur you would need to pass an accumulator that represents each step of the work, and be able to move forward only using the data in the next call
12:57justin_smithwith primitive recursion you can use the value of the recursive call after it returns
12:57edmondo1984so I imagine loop recur result in a tail call optimization which prevents stackoverflow
12:57justin_smithright
12:57justin_smiththat's exactly the point
12:59edmondo1984so with primitive recursion
13:00justin_smithyou'd end up with something like (assoc-in (get m k) (rest keys) v)
13:00justin_smithas your recursive call
13:00justin_smithand you'd be associng that back into m
13:00edmondo1984yes
13:00edmondo1984it's obvious
13:00edmondo1984wait
13:00justin_smithbut you can't do that with recur
13:00clojurebotExcuse me?
13:00justin_smithbecause of the assoc-back-in step
13:02edmondo1984I didn't know the assoc-in has this syntax
13:03justin_smithwhat syntax?
13:04justin_smithit's a function, it has the same syntax all functions have
13:08edmondo1984sorry that's fool of me
13:08edmondo1984I was looking to the assoc-in in the documentation
13:08edmondo1984can you explain me the first parameter? why get m k?
13:09justin_smith,(get {:a {:b {}}} :a)
13:09clojurebot{:b {}}
13:10justin_smithedmondo1984: because if the keys had :a as their first item, the value under :a needs to be passed to the recursive call
13:14edmondo1984sorry maybe my signature is wrong
13:14justin_smithno, it's fine
13:14edmondo1984the first element in my signature is the map
13:14edmondo1984so probably my call would be
13:14justin_smithmaybe you are misunderstanding destructuring?
13:14justin_smithright, it should be!
13:14edmondo1984(assoc-in v (rest keys) (get m k) )
13:15justin_smithNO
13:15justin_smitherr...
13:15justin_smithno
13:15justin_smithedmondo1984: why would the first arg be the value to assoc?
13:16edmondo1984so v is the value to the assoc
13:16justin_smithright, v is the last arg
13:16justin_smithnever the first
13:16edmondo1984, (get {:a {: b {} } } :c)
13:16clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
13:16edmondo1984, (get {:a {: b {} } :c)
13:16clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
13:16justin_smith: b is invalid
13:16justin_smithperhaps you mean :b
13:16edmondo1984, (get {:a {:b {} } :c)
13:16clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
13:16edmondo1984, (get {:a {:b {} }} :c)
13:16clojurebotnil
13:16edmondo1984right
13:17edmondo1984I imagine assoc-in nil returns a map
13:17justin_smith,(assoc nil :c :v)
13:17clojurebot{:c :v}
13:17justin_smithsure, it works
13:17edmondo1984that's what I didn't know
13:17justin_smiththe assoc fixes it up
13:17justin_smithedmondo1984: the other option:
13:17edmondo1984what if returns a value?
13:17justin_smith,(get {:b {}} :a {}) ; if assoc was not magic
13:17clojurebot{}
13:17justin_smithedmondo1984: then you pass the value of course
13:18justin_smithedmondo1984: because that value is the thing you are doing further associng into
13:18justin_smithif it is not associative, that's a bug and it's your caller's fault
13:18edmondo1984, (assoc (get {:a 3} :a) "hello" "world")
13:18clojurebot#error {\n :cause "java.lang.Long cannot be cast to clojure.lang.Associative"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.Associative"\n :at [clojure.lang.RT assoc "RT.java" 792]}]\n :trace\n [[clojure.lang.RT assoc "RT.java" 792]\n [clojure.core$assoc__4371 invokeStatic "core.clj" 191]\n [clojure.core$assoc__4371 invoke "core.clj" ...
13:18justin_smithedmondo1984: right, that's your caller's fault if they try that
13:18edmondo1984got you
13:20edmondo1984 it works
13:20edmondo1984brilliant
13:21edmondo1984 (if (empty ks) (assoc map k v)) (assoc-in (get map k) ks v) )
13:21justin_smiththat looks right, yeah
13:22justin_smiththat's limited to ks being less than stack size, but that's probably reasonable and is likely a restriction in the original
13:22justin_smithedmondo1984: so as I was saying at the start, what about making it so that if the key is the integer 0 and the m is nil, making m a vector instead of map?
13:22justin_smithmaybe a silly feature
13:22justin_smith,(assoc [] 0 :a)
13:22clojurebot[:a]
13:23edmondo1984how would I do that? no idea
13:30edmondo1984justin can I ask you also a question about macros?
13:30justin_smithsure
13:30william-sjoin #haskell
13:30edmondo1984I am trying to write a macro that when evaluated prints hello world, but the following doesn't work
13:31edmondo1984, (read-string "'(clojure.string/join ["Hello ","World "])'")
13:31clojurebot#error {\n :cause "Unable to resolve symbol: Hello in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: Hello in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: Hello in this...
13:31justin_smithedmondo1984: what does ' do?
13:31edmondo1984so this should ealuate to a list (clojure.string.join, ["Hello", "World"]))
13:31justin_smithedmondo1984: you are using ' wrong
13:32edmondo1984, (clojure.string/join, ["Hello", "World"])
13:32clojurebot"HelloWorld"
13:32edmondo1984ahaha
13:32edmondo1984actually the bot evaluates the list
13:32justin_smithright, function calls are just lists
13:33edmondo1984so how do I use the '
13:33justin_smith,(read-string "(clojure.string/join ["hello" "world"])")
13:33clojurebot#error {\n :cause "Unable to resolve symbol: hello in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: hello in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: hello in this...
13:33justin_smithergh!
13:33justin_smith,(read-string "(clojure.string/join [\"hello\" \"world\"])")
13:33clojurebot(clojure.string/join ["hello" "world"])
13:33justin_smithedmondo1984: in this case, you simply don't
13:33edmondo1984well
13:33justin_smith' is not a string operation
13:33edmondo1984wait
13:33justin_smith,'foo
13:33clojurebotfoo
13:33justin_smiththat's what ' does
13:33edmondo1984I am reading in clojure from the impatient
13:33edmondo1984sorry
13:33edmondo1984clojure from the brave and the true
13:34edmondo1984Use the list function, quoting, and read-string to create a list that, when evaluated, prints your first name and your favorite sci-fi movie.
13:34justin_smithclojure from the impatient and misleading
13:34edmondo1984(Exercise number 1
13:34justin_smithedmondo1984: OK, your version just uses read-string, so there's no place for quoting
13:34justin_smithand it also doesn't use the list function yet
13:36edmondo1984so how would that be?
13:37justin_smithwell, there are lots of ways to do macros. The key is that you need to end up with the right list of symbols, right?
13:37edmondo1984yes
13:38justin_smithread-string easily turns "(list of symbols)" into one, ' can turn what would otherwise be a function call into a literal list, and list can be used to construct lists as well
13:38justin_smith' can also be used to get a symbol instead of its value
13:38justin_smith,(defmacro silly-double [x] (list '+ x x))
13:38clojurebot#'sandbox/silly-double
13:38justin_smith,(silly-double 4)
13:38clojurebot8
13:39justin_smithedmondo1984: the secret to all macros is that they return the list that you want to see compiled
13:40justin_smithafter that it's all just tricks for constructing lists
13:41edmondo1984, (read-string "'(clojure.string/join ["Hello ","World "])")
13:41clojurebot#error {\n :cause "Unable to resolve symbol: Hello in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: Hello in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: Hello in this...
13:41edmondo1984, (read-string "'(clojure.string/join ['"Hello ",'"World "])")
13:41clojurebot#error {\n :cause "Unable to resolve symbol: Hello in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: Hello in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: Hello in this...
13:42justin_smithedmondo1984: you need to escape your " inside the string
13:42edmondo1984, (read-string "'(clojure.string/join '["Hello ",'"World "])")
13:42clojurebot#error {\n :cause "Unable to resolve symbol: Hello in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: Hello in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: Hello in this...
13:42justin_smith' does not help with that at all
13:42justin_smithedmondo1984: clojure uses the same string escaping rules as most languages. ' does not escape things in strings
13:42justin_smith,"\""
13:42clojurebot"\""
13:43justin_smith,(print "\"")
13:43clojurebot"
13:43edmondo1984got it
13:44edmondo1984, (read-string "'(clojure.string/join '[\"Hello \",'"World "])")
13:44clojurebot#error {\n :cause "Unable to resolve symbol: World in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: World in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: World in this...
13:44edmondo1984, (read-string "'(clojure.string/join '[\"Hello \",\"World \"])")
13:44clojurebot(quote (clojure.string/join (quote ["Hello " "World "])))
13:44edmondo1984, (read-string "'(clojure.string/join [\"Hello \",\"World \"])")
13:44clojurebot(quote (clojure.string/join ["Hello " "World "]))
13:44edmondo1984, (eval (read-string "'(clojure.string/join [\"Hello \",\"World \"])") )
13:44clojurebot(clojure.string/join ["Hello " "World "])
13:44edmondo1984, (eval (eval (read-string "'(clojure.string/join [\"Hello \",\"World \"])") ) )
13:44clojurebot"Hello World "
13:44justin_smithedmondo1984: read string already returns an unevaluated result
13:44edmondo1984aha!
13:45justin_smithedmondo1984: since the result is already unevaluated, you don't need the quote or the second eval
13:45edmondo1984, (eval (read-string "(clojure.string/join [\"Hello \",\"World \"])") )
13:45clojurebot"Hello World "
13:45edmondo1984excellent
13:45justin_smithalso, in that case, you could replace clojure.string/join with apply str
13:45edmondo1984what's apply str?
13:45justin_smith,(apply str ["hello" "world"])
13:45clojurebot"helloworld"
13:46justin_smithapply is a function, and str is a function
13:46justin_smith,(apply + [1 2 3])
13:46clojurebot6
13:46justin_smith,(apply str [1 2 3])
13:46clojurebot"123"
13:46justin_smith,(str 1 2 3)
13:46edmondo1984str makes a string of an array of element
13:46clojurebot"123"
13:46edmondo1984why apply then?
13:46edmondo1984ah it vectorize
13:46edmondo1984the arguments
13:46edmondo1984got it
13:47justin_smithedmondo1984: apply is for when arguments are in a collection
13:47edmondo1984Create an infix function that takes a list like (1 + 3 * 4 - 5) and transforms it into the lists that Clojure needs in order to correctly evaluate the expression using operator precedence rules.
13:49edmondo1984ok
14:33benjyz1does anyone know about authentication in Ring?
14:50Kamuelado you find that Clojure is more like an enabler of domain specific languages than its own language properly
14:51sineerHi, how do I (seq my-map) then drop all the keys and keep only the values ?
14:52sineerI want to count the # of keys in a nested map.
14:54clintmIs it that I'm doing something else wrong, or does the `(package/~@thing) not work by design in (defmacro x [thing & args] `(package/~@thing ...))
14:57TMA,(defn foo [] [])
14:57clojurebot#'sandbox/foo
14:57TMA,'sandbox/~@bar
14:57clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: sandbox/>
14:57TMA,'`sandbox/~@bar
14:57clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: sandbox/>
14:58TMAclintm: ~@thing splices the value of thing -- but it splices a form, not part of a token
14:59TMA,'sandbox/quux
14:59clojurebotsandbox/quux
15:00clintmTMA - ok, that's probably for the best. Looking at what I was trying to do, I think I might have been trying to add too much magic from the beginning.
15:01clintmI was trying to turn (mypkg/make-request method ..) into (http.client/get or (http.client/post depending on the value of :param, but maybe that's not keeping with the clojure style to begin with.
15:02TMAclintm: it is certainly possible to achieve what would seem the logical meaning of package/~@thing, I just do not know how just now ;)
15:02clintmTMA - thanks for poking at it just the same :)
15:03coventryAnyone have trouble with spacemacs hanging when loading cljs files?
15:04coventryOops, I'll ask in #clojurescript first.
15:13max3why are names in closure always so long? spelled out all the way?
15:17clintmmax3 - I assume so that their meaning isn't ambiguous.
16:16kungimax3: I find clojure names rather short which long ones do you mean?
16:26notostracakungi: map is so much typing :)
16:26notostracaI guess sorted-map-by is one
16:27notostracastill wouldn't consider it an Apache Commons name
16:33kunginotostraca: I still prefer initWithTimeIntervalSinceReferenceDate from the Obejective C DateTime library
16:34notostracaaaaaagh
16:34notostracaPHP still wins worst naming conventions, since it doesn't have any
16:35kunginotostraca: And using \ as the namespace separator is ... meh
16:35notostracaagh
16:35kunginotostraca: And especially when you have to pass namespace names in strings it gets funny
16:35notostracaI can see why clojure uses \c for what Java calls 'c', since 'c is a different type than a char
16:54justin_smithyeah the lisps had a parallel evolution alongside the algol family, and clojure often goes for the lisp convention for the basic stuff
19:46tolstoyHm. "lein repl -- arg" gives me "Unknown subcommand --'. Is there no setting CLI args for some tasks?
19:47tolstoyI guess only "run" supports it. Hm.
20:02justin_smithtolstoy: what args would you want to give the repl?
20:02tolstoyPointer to a config file. ;)
20:02justin_smithwhat would a repl do with a config file?
20:02tolstoyCONFIG="secrets.edn" lein repl ;; is good enough.
20:02justin_smithahh, OK
20:02tolstoyYeah, the reloaded workflow thing.
20:04tolstoyIn my user.clj, I have (app/make-system (app/load-config ...)) and sometimes I'm in a situation where there's no way "sensible defaults" can work.
20:07tolstoyBecause lein run supports cli args, I overgeneralized. ;)
20:22justin_smithwe're programmers, overgeneralizing is what we do
20:26amalloyyou undergeneralized there, justin_smith. humans overgeneralize
22:35tolstoyReminds me of how children, learning a language, make syntax mistakes that are the result of a too-regular application of the rules.