#clojure logs

2015-10-02

02:35loramHi
02:35loramIs there any tips for lowering memory consumption?
02:36loramDoing clojure web dev on my machine is close to impossible
02:36loramdue to the high memory consumption
02:36loramChromium needs ~ 1Gb
02:36loramJvm anotheer ~1gb
02:36loramand the machine only has 4gbs of ram
02:37loramrunning ubuntu 14.04
02:37loramOften I have to reisub things
02:37loramAs the machine just hangs
02:37loramany advice?
02:43dseitzoffload the running to a server
02:43dseitzor get a better machine
02:44loramthat's not practical
02:47dseitzWhat isn't? Renting a more powerful machine which you can test on locally is practical.
03:11amalloyloram is gone now, but the jvm doens't need anything close to 1GB
05:49sveri19test
06:02SysRqquestion about string iteration: what is the fastest way to do this in Clojure?
06:02SysRqI did some tests here: http://pastebin.com/9sjdvdFV
06:03SysRqalso noticed that destructuring somehow made it way slower
06:13SysRqa pure java parsing library will parse the same string in 20 ms, clojure takes 4 times longer at best just going through the string
06:18roelofHello, Is there a way that I can see which value a variable has in lighttable. Then maybe I could figure out how this one works : (let [{x 3 y 8} [12 0 0 -18 44 6 0 0 1]] (+ x y))
06:18clojurebotGabh mo leithscéal?
06:18oddcullySysRq: you want know if the body contains a nil?
06:18roelofsorry. I mean this one : http://lpaste.net/142127
06:19SysRqno I just want to traverse the string character by character
06:19SysRqI built a simple parser but noticed performance issues, and my conclusion is that it's caused by slow iteration on the characters
06:22BronsaSysRq: reduce will be much faster
06:22SysRqthe parser needs context information, for example when parsing a string literal
06:23Bronsayou can hold that context in the reduce accumulator
06:23SysRqthat's true
06:23SysRqI'll look into it
06:27roelofwhen I have this (let [{x 3 y 8} [12 0 0 -18 44 6 0 0 1]] does let { x 3} mean the thirth number of the array ?
06:27lumayes
06:28lumaactually, fourth
06:28oddcullythe fourth
06:29ionthasI'm trying to find a more idiomatic way to do a operation with vectors. https://gist.github.com/marcsolanadal/7d47558dadf90a808e0f Can anyone give me some ideas? Is it possible to do the operation using the -> macro?
06:31roelofoke, so there is a difference between let [ v 1 ] which means the variable v is 1 and let [
06:32roelof{ x 3) which means take the fourth value out of a array
06:32roelofDo I understand this well ?
06:32luma{x 3} is a destructuring which means to take the item with key 3 from the input
06:32TEttinger,[(let [v 1] v) (let [[v][1]] v)]
06:33oddcully~destructuring
06:33clojurebot[1 1]
06:33clojurebotdestructuring is http://clojure.org/special_forms#binding-forms
06:33lumait can be any associative collection, not necessarily a vector
06:33TEttinger,[(let [v 1] v) (let [{k 3}[1 2 3 4]] v)]
06:33clojurebot#error {\n :cause "Unable to resolve symbol: v in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: v 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: v in this context"\n ...
06:33TEttinger,[(let [v 1] v) (let [{v 3}[1 2 3 4]] v)]
06:33clojurebot[1 4]
06:34roelofIM studing the destructering in clojure programming book and this are examples that I first did not understand
06:34TEttingeryeah it can be tricky at first
06:34luma,(let [{x 3} {3 :foo}] x)
06:34clojurebot:foo
06:34TEttingeryou never really NEED destructuring, you can always write equivalent results without it
06:34roelofso (let [v 1] is assining and (let { v 1}) is destructering
06:35TEttingerno
06:35roelof:(
06:35TEttingerlet always has square brackets
06:35TEttingeryou can have {} within the square brackets
06:35TEttingerthen is a destructuring, yes
06:35roelofoke, typed to quick
06:36roelofand without the {} it is assigning
06:36TEttingeryou seem to have gotten this pretty quick, it took me... a while
06:37roelofwhat do you call quick, Im busy with this for 2 days and a lot of questions here and on reddit
06:39TEttingerI didn
06:40TEttingerI didn't notice, was too busy figuring out what the hell these papers on hilbert curves and gray codes are trying to say :P
06:40troydmlet's say I have a function that takes number, how do i create a lazy array of application of that function over a range?
06:40TEttingermap?
06:40clojurebotmap is lazy
06:40troydmI mean sequence not array, sorry sometimes I use both this terms interexchangably
06:41TEttinger,(take 20 (map inc (range)))
06:41clojurebot(1 2 3 4 5 ...)
06:41Bronsa,(map inc (range 10))
06:41clojurebot(1 2 3 4 5 ...)
06:41TEttinger,(count (take 20 (map inc (range)))) ;; so you know it is calculating 20 only
06:41clojurebot20
06:41troydm,(take 3 (map (fn [x] (* x 2)) (range 10)))
06:41clojurebot(0 2 4)
06:42troydmic
06:42troydmthx
06:42TEttingertroydm: if you do (map inc (range)) in a REPL it will run infinitely, or until it runs out of room
06:42TEttingertake stops it from evaluating all of it
06:43TEttinger(range 10) is not lazy
06:43TEttingerit's a regular seq of 0 -9
06:43TEttinger0 to 9
06:44lumait most certainly is lazy
06:44TEttingeroh sorry, not infinite
06:44lumathe reason it will run infinitely is that your REPL tries to print the whole sequence for you
06:44lumaboth map and range return lazy sequences
06:45TEttingerluma: (range 10) won't return an infinite seq
06:46troydmic, thank you everybody
06:46lumaright
06:54roelofAlso thanks frome. It's lunch time here
08:22trissso why is this nil then?
08:22triss,(vals [])
08:22clojurebotnil
08:22trisswhen this goes boom
08:22triss,(vals [10])
08:22clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
08:23snowellBecause nil/nothing CAN be cast to a MapEntry?
08:23trissoh...
08:24trisshmmm. why would you do that?
08:26snowellActually, looks like vals just returns nil if (empty? arg) returns true
08:26snowell,(vals "")
08:26clojurebotnil
08:26snowell,(vals #{})
08:26clojurebotnil
08:27trissis that desired behaviour? throwing feels nicer to me today...
08:27trissbeing as thats what happens for other invalid inputs.
08:27trissor am i missing something?
08:32snowellvals coerces a seq out of its arg
08:32snowellThen attempts to get a Map from that
08:33snowellIf the seq is empty, there aren't any entries in the "map," so you get nil
08:43sveriHi, I have java application which offers REST services via Jersey and I wonder if it would be possible to combine existing services with compojure routing, all in one code base (java and clojure mixed). In the end that stuff is put into a war file and then exposed on an application server. Did someone ever try that and succeed?
09:29troydmlet's say I've defined some type using deftype
09:29troydmhow do I check if object is of that type?
09:29troydmdoes Clojure automaticly defines function called typename?
09:30troydm,(do (deftype foo [bar]) (foo? (foo. "bar")))
09:30clojurebot#error {\n :cause "Unable to resolve symbol: foo? in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: foo? 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: foo? in this co...
09:30troydmseems no
09:46roelofhello, for a exercise of 4clojure I have to implement max but Im not allowed to use the function max. So I thought it could be done by using loop. But how can I tell loop to end when a list is empty ?
09:47snowellAs one of the args to loop, pass the list, then recur with (rest list)
09:47snowellOnce you can't take the first element from it, you're done, and return your value
09:48roelofsnowell: sorry , I do not fully understand what you mean . just do loop( ?? list)
09:49snowell,(loop [myList [1 2 3] myAnswer 0] (if-let [f (first myList)] (recur (rest myList) f) myAnswer)
09:49clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:49snowell,(loop [myList [1 2 3] myAnswer 0] (if-let [f (first myList)] (recur (rest myList) f) myAnswer))
09:49clojurebot3
09:50snowellYou pass the list into loop, then when you recur you do so with (rest list)
09:50fehrenbach,(do (deftype foo [bar]) (instance? foo (foo. "bar")))
09:50clojurebottrue
09:50fehrenbachtroydm: ^
09:52snowellroelof: So you keep your max as another loop/recur parameter, and once the list is empty (i.e., the if-let [f (first list)] fails), return it, otherwise recur with (rest list) and logic to pass in the current max
09:54roelofsnowell: oke, so loop(if-let [f (first list)] ........ recur ( (rest list) max) ??
09:54oddcullyroelof: i'd go with a reduce here
09:54snowelloddcully: That would be more elegant, but roelof specifically asked how to use loop
09:55snowellSo I'm saying it can be done :)
09:55oddcullyi wanted to push in that direction ;)
09:55snowellBut now you have me second guessing all my uses of loop/recur in this way :D
09:55roelofsnowell: I thougt that loop - recur could solve it.
09:55snowellroelof: loop/recur absolutely can solve it. oddcully is saying that reduce would solve it even better :)
09:56roelofI thought reduce can be used to sum or multiply a complete list
09:57oddcullyroelof: reduce calls the function for the prev/init value and the next one of the passed list
09:57sveriI think it is useful to learn how loop / recur works, as this can basically solve anything. From my point of view things like reduce and map are built around the loop / recur thinking
10:01troydmfehrenbach: ah, ic, thx
10:01troydmwhat's the most effective way to get element out of vector?
10:01troydmnth?
10:01troydmor is there more vector specific function?
10:02snowellBy index, nth is the way to go
10:02roelofoddcully: oke, now trying to find out how to find the max with reduce without using max Im thinking about something like this reduce %1 > %2 ( 1 2 3)
10:03lumayou can also use get or just call the vector as a function
10:05roelofnope, not working %1 is not known :(
10:06oddcullyroelof: reduce takes a function there
10:08roelofhmm, I thought so but I cannot use max or map-max
10:08snowellroelof: So you need a function that takes 2 args and returns the greater value
10:09roelofI see it, I found this one at brave book : http://lpaste.net/142133
10:10roelofI have a idea , I wil experiment with it for the next few hours
10:11snowelloddcully: Thanks, you just made the code I was working on today better :D
10:12snowellI never remember reduce
10:17roelofpff , this one gives a unsported binding form : http://lpaste.net/8569532114364530688
10:18lumayou can't put "(first list)" in the function parameter vector
10:18snowellroelof: You're mixing my loop/recur solution in there
10:19roelofluma I saw it but only list gives this one: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentList$1 RT.java:528 clojure.lang.RT.seqFrom RT.java:509 clojure.lang.RT.seq RT.java:654 clojure.lang.RT.first core.clj:55 clojure.core/first C:\Users\rwobb\Downloads\fourclojure\src\fourclojure\core.clj:6 fourclojure.core/eval6248 Comp
10:19snowellroelof: Start by writing a function that takes 2 args and returns whichever one is higher
10:20roelofsnowell: I try to make that
10:20lumaroelof, the reducing function's parameters are the last returned value, and the next item from the list
10:20snowellThen you can (reduce thatFunction someList) and declare victory
10:20lumathe reducing function doesn't take the complete list as a parameter
10:20roelofsnowell: oke, so step back you mean
10:20roelofmoment
10:27SysRqis it possible for Clojure code to be as fast as java?
10:28Bronsaroelof: the compare function should return an integer
10:28SysRqhttp://pastebin.com/SAic7pkS
10:28Bronsaroelof: also you have some wrong wrapping there, (fn [x y]) .. instead of (fn [x y] ..)
10:29SysRqthe json parse library cheshire is about 4 times faster in parsing json than clojure is at doing a simple check for every character
10:29SysRqlooking at the implementation I see it uses some java library https://github.com/dakrone/cheshire/blob/master/src/cheshire/core.clj#L142
10:29roelofBronsa: yep, I see it , back to the ( hell :(
10:29SysRqdoes that mean if you really want something to be fast you need to do it in java?
10:31pbxSysRq, this is heading toward pointlessness. do you have a use case you need to optimize? otherwise this is like "does rails scale better than django" et al
10:31Bronsaroelof: wrong wrapping should be evident by indentation
10:32BronsaSysRq: you're timing different operations
10:32SysRqI want to write a custom parser for a serialization format that's more compact than JSON, only to find out the custom parser is very slow
10:32SysRqso I might as well end up using the more verbose JSON with a faster parser
10:32BronsaSysRq: the reduce version is also wrong
10:33SysRqhow so?
10:33oddcullySysRq: (= ...) in line 12?
10:33Bronsalook at the if
10:33SysRqoh yeah
10:34roelofBronsa: I tried that one. I have now this : http://lpaste.net/142134 and this error : clojure.lang.Compiler$CompilerException: clojure.lang.ArityException: Wrong number of args (1) passed to: core/compare--inliner--4233, compiling:(C:\Users\rwobb\Downloads\fourclojure\src\fourclojure\core.clj:5:1)
10:34Bronsaroelof: you're not passing any argument to compare
10:34roelofclojure is more difficult then I thought. This one has costed me the whole afternoon
10:34Bronsaalso that's really not how you indent clojure
10:34snowellroelof: Are you trying to define a new function called compare? If so you want (defn compare [number1 number2] …)
10:35Bronsaroelof: I'd suggest picking a book or a guide to understand the basics of clojure syntax before trying to write code
10:35SysRqthe fixed version takes 2 times longer
10:35roelofBronsa: Im reading now the clojure programming book and read the first 2 chapters
10:36SysRqso conclusion: really low level stuff with high performance requirements is better implemented directly in java?
10:37roelofsnowell: that did the trick
10:37snowellNow in practise, you shouldn't overwrite compare. I'd have called it my-max or something
10:38Bronsaroelof: I'd suggest staring over and making sure you understood everything before moving to the next chapter. It's very obvious you don't really understand what you're doing yet
10:38snowellBut once you have my-max, you can (reduce my-max someList) to get the max of that list
10:38oddcullyroelof: compare is a clojure.core function. it takes two arguments (doc compare). your first version compared an basically empty function with min or nr1/2
10:38roelofI notices also. So more practice in this sort things
10:38oddcullyroelof: your second attempt just passed down one argument (the anon fn with more body this time) and so your got the arity error
10:39BronsaSysRq: your benchmarks are pointless. you are comparing different operations
10:39SysRqI'm comparing a full parse to a more primitive check
10:39Bronsa`time` is also no good for microbenchmarks like this one
10:39BronsaSysRq: you don't know what json-parser/parse-string does
10:40SysRqby all means the primitive check should've been faster
10:42roelofoke, this one works : http://lpaste.net/142137
10:43roelofBronsa: I can read a lot but I learn the best by doing it. My problem of live is that I can read a lot of books but doing it is then the biggest problem
10:44SysRqwhat do you mean with that Bronsa ?
10:44roelofyour experts happy with the solution or can it be improved ?
10:44SysRqthat I don't know what it does or how it accomplishes what it does?
10:45BronsaSysRq: what it does internally and whether it actually does anything at all
10:45SysRqI know it does something because it returns a Clojure EDN datastructure that I can traverse
10:45SysRqvectors for json arrays, maps for json objects
10:46SysRqalso I know it's not due to laziness because I force it to be parsed completely
10:46SysRqit must've parsed the actual string, or is there any other explanation?
10:49SysRqthere might be caching involved because when I time it on a fresh REPL it takes 6 times longer..
10:50Bronsaas I said, unless you make sure you're benchmarking the same stuff those measurements are useless.
10:50Bronsatime is also completely unreliable, you should use criterium to get meaningless benchmarks
10:51Bronsaand if you still find out that the reduce version is slower than whatever json library method (and I doubt it), there are ways to make the clojure code faster
10:54xemdetia"you should use criterium to get meaningless benchmarks" <-- is this a feature :)
10:54Bronsaerr, meaningful*
10:54Bronsa:)
10:59BronsaSysRq: for example, if you're using clojure >=1.7, this will be much faster (into [] (filter (fn [ch] (= ^char ch \space))) (:body json-qry)))
11:02SysRqthat is indeed significantly faster
11:07BobSchackBronsa: Is there a good Clojure profiling tool or should I look at the Java based ones?
11:07BronsaBobSchack: criterium is a good clojure lib for benchmarks (https://github.com/hugoduncan/criterium), as far as profiling goes any jvm profiler will do
11:08BronsaI've been using YourKit for a while for my OSS projects
11:09BobSchackAre there good docs for hooking up yourkit to a running JVM process?
11:17justin_smithBobSchack: with visualvm it shows a list of processes you can double click to connect to, I would be surprised if yourkit did not offer that feature
11:18SysRqwhy is (into [] (filter ...)) faster than (filter ...) ?
11:19BronsaSysRq: http://clojure.org/transducers
11:19Bronsait's a quite advanced new abstraction introduced in 1.7
11:19justin_smithBobSchack: the hilarious thing, I was working on a tool that connects to the debug port on a running vm, and wanted that "list vms to connect to feature" so I looked at the visualvm source to see how they did it - they literally knock on every port on your box, trying to connect as if it was a jvm debug port, then it returns the ones that answered nicely, LOL
11:20BronsaSysRq: you don't really need to use/know transducers for your usecase to get the same performance, you can do with plain reduce+transients
11:20Bronsausing into + a transducers automatically uses transients internally, that's the only reason I did it that way
11:22BobSchack justin_smith: Wow I thought it would be a bit more sophisticated then that.
11:23Bronsajustin_smith: yeah it does
11:24BronsaBobSchack: there's plently of docs on how to profile jvm apps on the internet
11:24Bronsaeverything that works for profiling java applications also applies for clojure
11:32fuuduCoderour team uses visualvm a lot.
11:33fuuduCoderto profile our clojure applications.
11:34justin_smiththe one thing with profiling heap usage with clojure, is I often wish I had more direct access to which specific parts of the code were creating / using this heap, and the fact that it's all arrays inside persistenthashmaps and persistentvectors doesn't really provide any info. It's made me want to switch more things to records just for the extra profiling info sometimes.
11:35justin_smithor maybe there's a secret sauce to figuring out which blocks of code are doing the allocating that I just don't know about yet
11:35SysRqis there a way to make this faster http://pastebin.com/hmtVfTrm
11:36Bronsajustin_smith: yeah I have the same issue
11:36BronsaSysRq: (case ^char ch (\newline \tab \space \return) true false) might be faster
11:37justin_smithSysRq: I would think a whitespace regex would be faster
11:37Bronsaor that
11:37Bronsait kind of sucks that clojure functions can't pass around unboxed chars
11:37justin_smithyeah, the case would definitely be faster than the set operation - I wonder how it would compare to the regex though
11:38justin_smithoh you need to create a string for the regex though...
11:38justin_smithor not isolate the char in the first place
11:39SysRq^char means to have java interpret the value as a character so it doesn't get boxed right?
11:39SysRqit's a character anyway
11:39Bronsano
11:39justin_smithSysRq: it prevents reflection, but not boxing
11:39Bronsait unboxes the char out of a Character
11:39Bronsaand does primitive ops
11:39Bronsaif possible
11:40Bronsaboxing/unboxing always happens with chars unfortunately
11:41oddcullyno clue on the performance, but there is alos Character/isWhitespace
11:42justin_smithoddcully: that's another one to compare for sure
11:44justin_smithoddcully: a hair faster than Bronsa 's version, according to criterium.core/quick-bench
11:45justin_smithand the regex match is slower than the set lookup
11:45justin_smith(!)
12:29noncomwhere can i specify jvm-opts for a lein plugin in project.clj?
12:29justin_smith:jvm-opts should do it? or is this a plugin that gets its own jvm?
12:30noncomyes, jvm-opts. you mean that the global jvm-opts for the project.clj will affect, say, "lein figwheel" ?
12:31justin_smithhmm, I think? you may need to set the jvm-opts for the figwheel profile? but it should.
12:32noncomokay, i'll try that
12:34roelofwhat is wrong here : (reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) list)
12:35noncomroelof: does not seem wrong. why?
12:36noncom,(reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) [1 -2 -3 4 -5])
12:36clojurebot4
12:36noncomisn't this what you want?
12:39roelofnoncom : wierd, when I do (reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) list) I see this error message : java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentList$1
12:39roelofor is my error that I have to put it into a function ?
12:40noncomroelof: umm
12:40noncom,list
12:40clojurebot#object[clojure.lang.PersistentList$Primordial 0x323fcc03 "clojure.lang.PersistentList$Primordial@323fcc03"]
12:40noncom,(reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) list)
12:40clojurebot#error {\n :cause "Don't know how to create ISeq from: clojure.lang.PersistentList$Primordial"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: clojure.lang.PersistentList$Primordial"\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.core$seq__...
12:40noncomyour problem is that you're passing it the function "list"
12:40noncominstad of something sequable
12:41noncom,(reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) +)
12:41clojurebot#error {\n :cause "Don't know how to create ISeq from: clojure.core$_PLUS_"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: clojure.core$_PLUS_"\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.core$seq__4116 invokeStatic "core.clj" 137]\n [...
12:41noncomsee
12:41noncomyou can redefine "list" but it is likely that you didn't
12:41roelofoke, I mean the variable list instead of a function. I try to solve this one : https://www.4clojure.com/problem/38
12:42noncomin your case 'list refers to the function from clojure.core
12:42noncom,list
12:42clojurebot#object[clojure.lang.PersistentList$Primordial 0x323fcc03 "clojure.lang.PersistentList$Primordial@323fcc03"]
12:42noncom,(def list [1 2 3 4 ])
12:42clojurebot#error {\n :cause "denied"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojureb...
12:42noncomoh
12:42roelofoke, how can I solve this ?
12:43noncomwell, it says that you have to "write a function". you did not yet write it
12:43noncom(reduce ..) is a call to reduce
12:43noncoma function would be (fn [... )
12:44roelofI know
12:44roelofBRB, dinner is ready
12:44noncomso if you write (fn [list] (reduce ...) it will likely work
12:45oddcully[& list] ?
12:45noncommaybe. idk. i never went through 4clojure :(
12:45Bronsaroelof: btw that's just (reduce max your-list)
12:46oddcullyBronsa: max is not allowed for this
12:47Bronsaah ok
12:48dzhus`I've just enabled log4j using clj-logging-config.log4j for my code and now it produces lots of debugging output to the console: http://dpaste.com/0H61T2A.txt. Does anybody know how to switch these off?
12:57rlb`Is there a way I can set up a lein fixture that wraps the entire test run? i.e. to start up a DB at the beginning and tear it down at the end of *all* of the tests in the current "lein test" run?
12:57rlb`across all the namspaces, etc.
13:11roelofnoncom: for as far I know reduce works like this ( reduce function list) , This is right ?
13:12oddcullyroelof: yes
13:12noncomroelof: (reduce f acc seq)
13:12noncomacc is optional
13:12roelofcan list then not be a variable ?
13:12noncombut in generall, as oddcully says, this is right
13:12noncomroelof: it can, but you have to define it first
13:12oddcullyroelof: list can be a variable, but first of all its a core function
13:13noncomby default "list" is defined to the core function "list"
13:13noncom,(list 1 2 3)
13:13oddcullyroelof: you are shadowing it by having your own
13:13clojurebot(1 2 3)
13:13roelofoke, when I change list to lijst which is not in core. I see that the symbol lijst is not found
13:13noncomtrue
13:14roelofso how can I do (reduce function x) where x is a variable ?
13:14oddcullyroelof: the _ in that function takes all that numbers as params. so you have to deal with this
13:15roelofoddcully: where does the _ come from ?
13:16oddcullyroelof: the _ from the 4clojure problem
13:16roelofI know. that is what I try to find. This afternoon we have made a version with a helper function but def is also not allowed on 4clojure
13:17roelofso I try to find a way to work around it
13:18oddcullyyou got the reduce part already right. now you have to turn it into a function itself, that takes any amount of params
13:18noncomroelof: 4clojure expects that your function be placed instead of the _
13:18noncom(_ 1 2 3) => (your-fn 1 2 3)
13:19noncomroelof: soooo, ((fn *magic*) 1 2 3) is what required from you..
13:20roelofoke, that is this part : (fn [number1 number2] (if (< number1 number2) number2 number1))
13:20noncomroelof: nope
13:20roelof:(
13:21noncomas oddcully said, you got it correctly with reduce
13:21oddcullythis is the function you pass down to reduce. everything about the reduce is already right
13:21noncomnow you only have to wrap your reduce form into a fn
13:21thsig_Hey guys, this question is a bit general, but here goes: How would you rate the maturity of the library/tooling ecosystem for web development in Clojure as of now?
13:21roelofoke, back to the books (clojure progremming how to do so
13:22thsig_Are there significant bald spots in comparison with e.g. Python or Ruby, or is it quite robust these days?
13:22noncomthsig_: robust, very. and continues to be even better
13:22thsig_Do you often wish you had a library that solved your problem where you'd be able to easily find a library in Python or Ruby?
13:22noncomthsig_: never
13:22thsig_noncom: That's the feeling I get.
13:23noncomwe have all the java libs and all js libs at our disposal
13:23noncomand all clojure libs and all cljs libs
13:23thsig_I'm about to start a new project and am pushing hard for Clojure as it would be a perfect fit (concurrency and efficient use of severs are a big plus).
13:23noncomroelof: hey, that's not what hard
13:23sverithsig_ I have been doing REST for the last two weeks in java with jersey and jax-rs. Men, I really wish I could use clojure I would be don already, compared to java where I am not even half way through. I say this coding Java every day at my job
13:24thsig_sveri: Yeah, I can imagine.
13:24noncomroelof: just wrap what you showed us into an (fn) form!
13:24noncomroelof: you have to make a callable function out of your code
13:24thsig_Are people still mostly using a minimalist base (Ring, and then cherry-picking libraries together)?
13:25noncomthsig_: well, i use luminus as a base, but there are more solid things like pedestal or hoplon
13:25sverithsig_ I put my own template together providing component integration and a basic user management out of the box, but in the end it's all put together from small libs
13:25thsig_I'd be interested in any relatively up-to-date links that cover what the industry-standard libraries are that are used in almost all web projects.
13:26thsig_(I've been Googling, of course - just thought I'd ask directly as well)
13:26noncomthsig_: try looking at what libs are mentioned in luminus docs
13:26noncom(for starters)
13:26sverithsig_ https://github.com/sveri/closp it's based on luminus, but currently, when you create a new template, you have to fix one namespace. However, I also integrated transit for cljs workflow and cljs-ajax for instance
13:27thsig_noncom, sveri: Ah, I remember that one. Was poking around with it the other day.
13:28noncomsveri: luminus now has transit and cljs-ajax integrated too :)
13:28sverithsig_ its comprehensive, but this is what I came out with after over a year figuring out which libs to use
13:28thsig_Thanks! I'll look through this.
13:28noncomthsig_: take a look at hoplon and pedestal too
13:28sverinoncom nice to hear, I also read lately that he thinks about integrating components too
13:28thsig_I've been aware of those too, but wasn't sure how much adoption they had.
13:29thsig_I know the Cognitect guys are using Pedestal in production.
13:29noncomi'd start my current project in hoplon if i had some previous exp with it, but i had to start quick so i chose luminus since i'm pretty familiar with its stack. and it sets up figwheel for you too
13:30yazirianWe're using Pedestal in production here too and are pretty big fans of it.
13:30sverinoncom closp has figwheel support too ;-) and all compiles to an uberjar with advanced compilation ;-)
13:30noncomsveri: then you've got the spot i'm still missing
13:30sveriyazirian did you evaluate against compojure / ring? What are the pros in your opinion?
13:30noncomwhen i uberjar my app, it does not work :/
13:30thsig_I don't think we'll be using Clojurescript for this project as the frontend will be mostly native mobile. I'd love to, though.
13:31thsig_yarizan: I'd be interested in your answer as well.
13:31yaziriansveri: I just completed migrating a medium sized microservice from compojure to pedestal, specifically because it's better.
13:31noncomthsig_: you can use clojure for native mobile (if its not c++ ofc)
13:31thsig_... yazirian, sorry :)
13:31yazirianThe primary drivers are:
13:31noncompedestal is nextgen comparing to compojure
13:31thsig_noncom: iOS and Android is the plan.
13:31yazirian1. interceptors are sweet, not that middleware doesn't cover the 90/10 case but interceptors are very flexible
13:31noncomthsig_: yes, you can do it clojure
13:32yazirian2. pedestal's route definitions are both more easy to work with and more 'correct' and strict in disallowing things that compojure can 'accidentally allow' such as non-unique routes with bound vars in the pth
13:32yazirianpath*
13:32yazirian3. compojure's macros, just holy... have you looked at them closely? they're in cronenberg territory :)
13:33yazirianrelated: it's really easy on a team developing over a period of time to end up with scattered route definitions that are difficult to piece together once you have a lot of endpoints, pedestal has a defined best practice that keeps the full URL structure together
13:33rhg135I use bidi
13:33noncomsveri: so, closp is a template, originally based on luminus, but currently improved?
13:33yazirianthat CAN result in a really big defroutes structure
13:33sveriyazirian 3. striked me too from time to time and I never really liked them
13:33thsig_noncom: I've seen a few libraries around Obj C and Android development, but do you know of anyone who's using those in production? I seem to recall there being performance problems with this method on Android, but that info may be out of date.
13:34yazirianbut the tradeoff is worth it IMO
13:34noncomthsig_: there's actually a bunch of apps made with clojure in android play market
13:34thsig_yazirian: How lightweight/heavyweight is it with respect to resource consumption etc. in comparison to the smaller frameworks?
13:34noncomthsig_: iOS part is done with help of robovm.
13:35noncomthsig_: maybe you could find it worth researching or maybe not, but they are there
13:35yazirianWith the caveat that we've had no need to look closely since we're running on normal EC2 instances and not in teeny environments or anything, it's totally fine
13:35yazirian0.4.x in particular included new work to speed up routing as well
13:36yazirianit's ring under the hood anyway
13:36noncomthsig_: theres also #clojure-android
13:36thsig_noncom: Interesting. Definitely sounds tempting to write the thing in Clojure. I'd have to find some direct experience reports on it first.
13:36sverinoncom Yea, that was the idea behind. Little things like restarting the server when I change my routes (solved by integrating components, so I can just call the reset function and "restart" in like 0.5s instead of 20)
13:36thsig_noncom: Ah, cool! I'll ask around there.
13:36thsig_yazirian: Sounds good!
13:37noncomthsig_: https://github.com/oakes/lein-fruit - so this is made by zach oakes too. zach has much experience with android clojure and probably iOS clojure since he's rolling out lein-fruit. you could pm/mail him
13:38noncomthsig_: maybe you won't find many reports right away (although i remember there were some in the net)
13:39noncomsveri: that's very interesting
13:39roelofsorry for the late respons. Daugther needs attention. So I have to put the whole part (reduce (fn [number1 number2] (if (< number1 number2) number2 number1) into a fn ?
13:39sverinoncom I spent a lot of time optimizing development experience, I find it a pain to have to wait during restarts and things
13:39noncomroelof: sure! you have to make a callable function out of your piece of code, just as any other language
13:40oddcullyroelof: yes, you have to turn it into a function that takes any amount of params
13:40noncom... and passes it into your reduce thing
13:40noncomas the list
13:40yazirianActually that is one thing to be aware of with pedestal, if you want i.e. cider recompiles to take notice of changes to your handlers you have to define your service with ::bootstrap/routes #(deref #'routes)
13:40yaziriannotice the deref there
13:40yazirianand recompile the ns with the defroutes macro in it
13:40noncomsveri: true :/
13:40yazirianif you take those steps though it works fine
13:42roelof??? now im confused . I think that noncom and oddcully says something different
13:42oddcullyno we are saying the same
13:43noncomyes
13:43noncomsame
13:43noncomlisten, you wrap your piece of code into a fn that accepts arg(s) and just use these args in your piece of code
13:43noncomrather basic thing..
13:43noncomi'm sure you know that
13:43noncomsame as in C or Java
13:45roelofoke , so (fn [(number1, number2] (if (< number1 number2) number2 number1) ) ??
13:45noncomroelof: nooooope :)
13:45noncomeh
13:45noncomok
13:45clojurebotHuh?
13:46noncom(fn [lst] (your-code lst)) makes sense? :)
13:46noncomwhy you replace reduce with fn? you should not
13:46noncomreduce is there for a reason
13:47noncom(some code x) -> wrap into fn -> (fn [x] (some code x))
13:47noncomthis way you shadow x
13:47noncomand "shadow x" sounds cool
13:48roelofoke, this will have no errors : (fn[list] (reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) list))
13:48thsig_yazirian: Would you generally recommend Pedestal for new projects? This won't be a huge architecture, but it will need to handle lots of requests, connect to several databases, pass along lots of file IO etc.
13:48noncomroelof: is that clear to you now?
13:48thsig_Or is your recommendation more specific for certain shapes of project?
13:48roelofyes, now I see it , it is clear
13:49noncomgood :)
13:50noncomroelof: and because fn creates a function object, and you place it in the first position of the list, it automatically turns into the function to accept the list
13:50noncomroelof: but remember, as oddcully said, you must have a varargs fn in this current occasion
13:50roelofpfff, I did enter this into 4clojure : (fn[list] (reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) list)) and see this error : clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox4852$eval522084$fn
13:50noncomexactly
13:50noncomread above ^
13:51roelofoke, the book was talking about varargs
13:51noncom(f [1 2 3]) and (f 1 2 3) - the first one takes 1 arg. the second one takes 3 args OR varags
13:51yazirianthsig_: I would use it myself, so I guess "yes" :)
13:53roelofsolved it , finnaly with (fn[ & list] (reduce (fn [number1 number2] (if (< number1 number2) number2 number1)) list))
13:53sveriyazirian how about authentication / authorization, what are you using and are there docs on it?
13:53noncomroelof: congratulations! :)
13:54roelofit took me thw whole day but learned a lot
13:54noncomroelof: yeah, that's really useful. soon you will know and understand it all.
13:56roelofnoncom: I hope so, I try to follow the clojure programming book with 4 clojure
13:57roelofso im still busy the next few weeks
13:57noncomroelof: i'm sure as you go through this, the speed will increase
13:58noncomi wish there was a clojure version of scheme bricks....
13:59roelofI think so, I now have seen how things are done so 4 clojure accepts it
14:01yaziriansveri: I can't answer that, we aren't using anything at that layer -- we have a whole proxy auth service and load balancing layer above it that's separate
14:09roeloflast question before I call it a day : I have this problem : (= (__ (map inc (take 3 (drop 2 [2 5 4 1 3 6])))) (->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (__)) 11)
14:10noncomok, what's with it?
14:10roelofaccording to me the solution is '(5 2 4 ) but when I enter it into 4clojure I see this messsage : java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
14:11noncomroelof: yes
14:11noncombecause a list is not a function
14:11noncom,((list 1 2) 1 2)
14:11clojurebot#error {\n :cause "clojure.lang.PersistentList cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler ...
14:11roelofcorrect , that is why I put a ' before it ,
14:12noncomroelof: that does not change much
14:12roelof'( 1 2 3 )
14:12noncom,(type '(1 2 3))
14:12clojurebotclojure.lang.PersistentList
14:12roelof, '( 1 2 3 )
14:12clojurebot(1 2 3)
14:12noncomit did not became a fn
14:12roelofoke, the same probllem as before
14:12noncomno
14:13noncomwell, somewhat alike
14:13noncombut different
14:13roelof:(
14:13noncomlet's follow
14:13noncom(->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (__))
14:13noncombecomes:
14:13noncom[4 1 3 6]
14:13noncom[4 1 3]
14:13noncom[5 2 4]
14:14noncomand then something happens that it becomes 11
14:14roelofyes, I figured that out
14:14noncom(+ 5 2 4)
14:14clojurebot*suffusion of yellow*
14:14noncom,(+ 5 2 4)
14:14clojurebot11
14:14roelofoke, I missed that part. So it had to add up
14:14noncomyes, but here's again arg/vararg thing
14:15roelofso (reduce + ( 5 2 4)
14:15noncom,(reduce = [5 2 4])
14:15clojurebotfalse
14:15noncom,(reduce + [5 2 4])
14:15clojurebot11
14:15noncomyep :)
14:16noncomroelof: fyo, (apply + [5 2 4]) would also work, ut idk if this is allowed in this 4clojure task
14:16snowell,(apply + [5 2 4]) ; This totally works too
14:16clojurebot11
14:16snowellgrrrr
14:16noncom:D
14:16noncombut it was simultaneous :D
14:16snowellI was debating whether or not to say it
14:17noncomfor 2 seconds :)
14:17roelof(apply + [5 2 4]) gives this error message : java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
14:18oddcullyroelof: if you enter it like that, then it will result in 11, and next will be called as a function
14:19roelof???
14:19oddcully,((apply + [1 2 3]) 42)
14:19clojurebot#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$eval283 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval283 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval283 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69...
14:19noncomyes, like:
14:20noncom,(11 42)
14:20clojurebot#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$eval307 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval307 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval307 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69...
14:20noncom11 is not a function
14:20roelofnope, it a value
14:20snowellNot with that attitude it's not
14:20roelofsnowell: ?
14:21roelofwhat attirude ?
14:21snowellJust me trying to be funny :)
14:21noncomit could be a function with some other attitude :)
14:21snowellImplying that 11 could be a function if you tried hard enough
14:21noncom,(symbol 11)
14:21clojurebot#error {\n :cause "java.lang.Long cannot be cast to java.lang.String"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to java.lang.String"\n :at [clojure.core$symbol invokeStatic "core.clj" 555]}]\n :trace\n [[clojure.core$symbol invokeStatic "core.clj" 555]\n [clojure.core$symbol invoke "core.clj" -1]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]...
14:22noncom,(symbol "11")
14:22clojurebot11
14:22noncomcould be a start for a nice macro!
14:22noncom,11
14:22clojurebot11
14:22noncom,(type 11)
14:22clojurebotjava.lang.Long
14:22roelofbut what has this to do with my problem ?
14:23noncomroelof: nothing related to your problem, except that in this particular case 11 is strictly not a function
14:23noncomwe're just making some fun out of math flexibility :)
14:24roelofoke, can then someone help me how to fix this ?
14:24noncomroelof: fix the thing with apply?
14:25noncom,(->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (apply +))
14:25clojurebot11
14:25noncom,(->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (reduce +))
14:25clojurebot11
14:29justin_smithapply + is basically reduce + anyway if you look at the source of +
14:31roelofvery confusing what 4clojure expecting apply + without a argument
14:33noncomroelof: how you say so? there is the argument
14:33noncomroelof: ->> ensures that what was computed before is the 2nd argment for the apply
14:33noncomand in the left part, the.. umm.. argumentation is explici
14:33noncomt
14:34roelofoke, so the outcome of drop take is passed on to the apply function. Time to read the chapter about macros I think
14:34noncomso in the right part you get (apply + [what-was-computed-before])
14:35noncomroelof: ->> is a very simple macro that places each result to the LAST position in the next form, evaluates it, and goes on like that until the end
14:35roelofnoncom: thanks
14:35noncomroelof: it effectively unwraps the whole thing into what this task has on the left side
14:35noncomnp
14:39roelofAll thanks for the lessons and patience with me and have a nice day
14:39noncomroelof: you too!
14:42juanjohi there
14:42juanjoi'm learning clojure
14:42juanjoi'm getting this error when trying to use the 'is' function
14:42juanjouser=> (is 1 2)
14:42juanjoCompilerException java.lang.RuntimeException: Unable to resolve symbol: is in this context, compiling:(NO_SOURCE_PATH:1:1)
14:44justin_smithjuanjo: is is from clojure.test
14:44fuuduCoder,(is 1 2)
14:44clojurebot#error {\n :cause "Unable to resolve symbol: is in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: is 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: is in this context"...
14:44justin_smithjuanjo: fuuduCoder: you need to use or require / refer clojure.test or is will not work
14:44juanjohow do i do that?
14:45justin_smith,(use 'clojure.test)
14:45clojurebotnil
14:45justin_smith,(is 1 2)
14:45clojurebot1
14:45fuuduCoderNO_SOURCE_PATH:0:0) this should be your hint
14:45justin_smithalso, that's the wrong way to call is
14:45justin_smith,(is true false)
14:45clojurebottrue
14:45justin_smith,(is (= true false))
14:45clojurebotfalse
14:45justin_smiththat's the right way ^
14:46juanjook justin_smith
14:46juanjothanks
15:10sveriyazirian ok, thank you
16:43rasmustoshould I include my clojure (ring) and clojurescript in the same project? The ring stuff should be generic enough that it's not 1:1 coupled with the UI
16:43rasmustothis is mostly just a style question
17:25akkadshould you?
17:35irctcHi everyone.
17:36irctcHas anyone had experience with OAuth?
17:37irctcI am trying to pull a list of user's friends from Goodreads and it requires OAuth but I have no idea how to configure it as I am completely new to it.
17:37rhg135not positive ones
17:38rippy
17:38rhg135I used python though
17:39irctcI found this question/answer and am trying to use the answer as a template to configure my OAuth access to Goodreads but I can't seem to get anything back from Goodreads: http://stackoverflow.com/questions/32107730/oauth1-in-clojure
17:41rhg135in my experiance, OAuth us about as standaraized as "rest"
17:42irctcBtw, I don't even know if I can get the list of friends back to my application at localhost.
17:42irctcI mean will OAuth even work with localhost?
17:42rhg135or "the cloud"
17:43rhg135I thin so
17:44irctcWell I put everything in my application from that answer and replaced the key with my key and the secret with my secret from Goodreads and tried to put in the address to get the info back but it does nothing.
17:44rhg135How else do desktop apps work?
17:45rhg135unless you host a server
17:45irctcWell that's why I was still hoping that it will work, so it seems that I just don't know how to configure this OAuth access then.
17:46{blake}Is Java in the browser still a thing? I've never heard a Clojure guy talk about it. And I keep hearing it's going to be killed. But it seems like it could be really useful.
17:46lumait hasn't been a thing for years
17:46rhg135It's also really insecure
17:47{blake}Bummer. I could get a lot of mileage out of it if it were a thing.
17:47rhg135without a whitelist
17:48rhg135Imagine, java based popups
17:49irctcI'm off to bed. Take care everyone.
17:49rhg135peace
17:50{blake}Well, I'm using POI. Having that in the browser would be amazing. If it worked.
17:52rhg135for every 100 good users there is one abuser
17:57rhg135at least on linux writing to /dev/mem is forbidden, unless the kernel is buggy, or you run your browser as root
17:59rhg135`File("/home/user/important").remove()
18:19{blake}rhg135: You say that like it's a bad thing.
18:19{blake}Heh. No, I'd do all the disk stuff as server calls, but the calculations being done in browser would be cool.
18:21rhg135It's a good idea, but someone always ruins it
18:21{blake}Right? This is why we can't have nice things.
18:21{blake}And also why we get ants.
18:21rhg135yup
18:22lumacould we just get leiningens instead of ants
20:57trissis there a nicer way of saying #(%2 %1)?
20:57rhg135I don't think so
20:58trissas in apply second arg to first? I'm forever (condp #(%2 %1)....)'ing
20:58trissis there not a built in fn for this?
20:58trissah okies rhg135
20:59rhg135luckily #() is so nice
20:59trissi guess multimethods + dispatch or something.
21:00trissrhg135 i think they're kinda ugly
21:00trisspull out partial/comp all over the place
21:01trisswhich can be kinda ugly too...
21:02rhg135(fn ...) is worse imo
22:43triss,(apply list [1 2 3])
22:43clojurebot(1 2 3)
22:43triss,(apply list nil)
22:43clojurebot()
22:44triss,(apply list 1)
22:44clojurebot#error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\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.core$seq__4116 invokeStatic "core.clj" 137]\n [clojure.co...
22:44triss,(list 1)
22:44clojurebot(1)
22:44trissWhy the whopping great error message when I apply list with 1 argument?
22:45hiredman,(doc apply)
22:45clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
22:46trissok...
22:47amalloytriss: because 1 isn't a sequence
22:47triss,(apply list 1 nil)
22:47clojurebot(1)
22:47amalloyand apply takes a sequence of args
22:47amalloy,(apply list '(1))
22:47clojurebot(1)
22:47trissso i can (map #(apply list % nil) boom)!!!!!
22:48hiredmanyou don't need apply
22:48trissi do today
22:48hiredman(map list boom)
22:49hiredmanif you always have the same number of arguments you don't need apply
22:49triss1 sec. I want to treat everything in a list of collections and values as a list of seqs
22:50hiredman(although, with a large number of fixed arguments it can be less of a pain to use apply)
22:50trissidea is to go (1 (2 3) 4) -> ((1) (2) (3) (4))
22:51hiredmanyou don't need apply, you need if
22:51trisswell -> 1 2 3 4 eventually
22:51hiredman(if (coll? x) x (list x))
22:55rhg135,(mapcat #(if (coll? %) % [%]) '(1 (2 3) 4))
22:55clojurebot(1 2 3 4)
23:22tehgeekmeisteris there a way to set environment variables for projects you run in cider mode?
23:37justin_smithtehgeekmeister: I'm not sure if there is a config, but there is M-x setenv for setting the emacs env, C-u M-x cider to specify a command, followed by using env VAR=VALUE lein repl as the command, and finally you can start a lein repl in a terminal, then use M-x cider-connect to connect to the port it opens
23:37tehgeekmeisterwhooo! options.
23:37tehgeekmeisterI figured out the M-x setenv thing
23:37tehgeekmeisterbut those others are news
23:37tehgeekmeisterthanks!
23:37justin_smithnp