#clojure log - Aug 04 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

2:04 sveri: Hi, I just tried lein kibit and it says I should use (clojure.string/join s instead of (apply str s Can someone enlighten me why it is better to use string/join?

2:06 dee5: if you run `(source clojure.string/join)` you can see it actually dispatches to (apply str ...) if you don't provide a separator

2:08 sveri: dee5: then it even makes less sense for me

2:09 pyrtsa: I think readability has been the motivation behind that recommendation but I'm not sure I agree with it.

2:10 dee5: I'd agree with readability, and it also might have room for future optimizations

2:11 ambrosebs: sveri: perhaps it's intended to suggest alternatives to (map #(apply str %) c)

2:20 sveri: ambrosebs: sounds reasonable, I will leave it as it is, using apply str looks better to me

2:20 amalloy: i don't generally use join if i don't have a separator

3:29 meingbg: I'm trying to use a local java maven library with clojure, but 'lein run' gives this error: Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate android__init.class or android.clj on classpath:

3:30 It seems to be true there is no *__init.class, nor do I believe there should be.

5:17 visof: hi guys

5:17 i can't understand what's going on this code https://www.refheap.com/88870

5:18 ,(class {"hello" "world"})

5:18 clojurebot: clojure.lang.PersistentArrayMap

5:18 visof: (let [h {"hello" "world"}] (class h))

5:18 ,(let [h {"hello" "world"}] (class h))

5:18 clojurebot: clojure.lang.PersistentArrayMap

5:18 visof: ,(def h {"hello" "world"})

5:18 clojurebot: #'sandbox/h

5:18 visof: ,(class h)

5:18 clojurebot: clojure.lang.PersistentHashMap

5:19 visof: in the first case the class is Array

5:19 when use def it's a Hash

5:19 both the same though

5:20 clgv: visof: doesnt matter. that's just an implementation detail

5:20 visof: clgv: how can check if the value suppplied is a hash in both cases?

5:20 clgv: visof: PersistenArrayMap is a performance improvement for small hash maps

5:20 ,(doc map?)

5:20 clojurebot: "([x]); Return true if x implements IPersistentMap"

5:21 visof: ,(map? [1])

5:21 clojurebot: false

5:21 visof: ,(map? {})

5:21 clojurebot: true

5:21 clgv: well that doc string could be better ^^

5:21 locks: they're both maps

5:21 visof: ,(map? "")

5:21 clojurebot: false

5:21 clgv: ,(map? h)

5:21 clojurebot: true

5:21 visof: thanks clgv

5:21 clgv: it checks whether something is a persistent map^^

5:22 visof: for multimethods you can use IPersistentMap I guess

5:22 visof: if you dispatch by class/type

6:18 master_op: hello, is there any clojure certification ?

6:18 AeroNotix: I hope not

6:18 ucb: heh

6:19 master_op: why, i think is a best thing to offer certifications for dev.

6:22 nathan7: I just laughed for a solid minute, thank you

6:25 TEttinger: master_op, I think the general consensus is that java certification is a moneymaking venture for companies that offer certification, not a real measure of proficiency

6:25 clgv: master_op: you can do paid trainings with the cognitect people - they usually had several events per year

6:26 master_op: thanks for responses, clgv, i dan't want a training, i just want to be certified, thanks again,

6:26 nathan7: you don't want to gain proficiency, you just want a worthless piece of paper?

6:26 I think you've just succeeded at proving why certifications are useless.

6:27 clgv: :P

6:28 master_op: well than your possibility is to show off some of your projects you built in clojure to "certify yourself" ;)

6:29 those clojure job offerings often ask for fromer interesting projects, e.g. on your github account

6:30 master_op: nathan7, i'ma already clojure developer, i read many books and have done multiple projects, the certification is a challenge for me

6:30 H4ns: master_op: nobody offers clojure certification because there is no market for that.

6:30 irctc: Hello, dear community. Is it ok to ask on this channel some "functional way" questions? I need a bit of a code review.

6:30 nathan7: There's a pretty high overlap between people smart enough to do Clojure and people smart enough to figure out certifications are pointless.

6:31 master_op: clgv, thank you again, i think my account in github is the best certification

6:31 clgv: master_op: great :)

6:31 nathan7: I have a highly-certified cofounder, and I often get to school him on the subjects he's certified in.

6:32 (bloody Cisco certifications, spreading lies on how networking works)

6:32 clgv: nathan7: that badly?

6:32 nathan7: clgv: Certain network configurations I run in production were, according to him, entirely impossible.

6:33 clgv: nathan7: nice. so you are a network magician :D

6:33 nathan7: clgv: At the time I was figuring out how to set those up

6:33 clgv: He claimed it was impossible — I had it functioning the next day

6:34 clgv: I derive much of my knowledge of networking from implementation — when I was younger I wrote a full networking stack in Python

6:34 clgv: He'd been told certain configurations were impossible, while they were in fact merely unsupported by Cisco

6:36 clgv: nathan7: ha well, they only train what they want to sell? who could blame them for that? :P

6:36 nathan7: clgv: Sure, but they could've told the truth: "we don't support that, and recommend against it"

6:37 master_op: i think cisco are selling an academic skills

6:37 clgv: nathan7: yeah true.

6:38 nathan7: clgv: We were given a loose IP by our provider for a failover configuration, and my cofounder claimed that it was impossible to configure it

6:38 clgv: Even though it'd be rather unlikely for that configuration to be impossible if they sold it

6:38 clgv: but he persevered in believing the Cisco trainings first, almost religiously

6:39 clgv: nathan7: that's never a good idea - good judgment should always be used ;)

6:39 nathan7: clgv: Yep

6:39 clgv: The religious zeal is what worries me most — the incorrect knowledge is secondary

6:39 clgv: different topic: is there a better function available to format clojure code for debugging macroexpansions than "pprint"?

6:41 hyPiRion: clgv: clojure.walk/macroexpand-all, macroexpand-1 or macroexpand?

6:42 nathan7: hyPiRion: pprint does /formatting/

6:42 it converts it to a string

6:42 You'd use it after one of the macroexpand functions

6:43 clgv: hyPiRion: I want to format the output of one of these in a human readable way ;)

6:45 ah well "fipp" has an easy way to provide params...

6:45 hyPiRion: clgv: I don't understand then. What do you mean by better? Can you give an example on what you actally want?

6:45 nathan7: I keep wanting to just write an editor that displays data structures

6:46 clgv: hyPiRion: better formatting than pprint. Even "fipp" puts let binding in two lines of output :(

6:47 hyPiRion: clgv: What do you mean by better? And actual example would help

6:49 clgv: hyPiRion: did you never try to debug a macro expanding to more than 10 lines? with a compact human readable formatting that gets a lot easier

6:53 hyPiRion: clgv: I have, but I'm not sure what you mean by "compact human readable" formatting, which is why I ask.

6:55 clgv: hyPiRion: at a certain number of ident characters pprint just print almost everything on a new line

6:55 hyPiRion: As you mentioned, Fipp with some configuration could probably (?) help you with it.

6:55 clgv: yeah, it helps a little

6:56 but although I adjusted width, there are still several unnecessary linebreaks as in let bindings

6:56 hyPiRion: clgv: right, so something which still does (let [a something-long *newline* b something-else] ...)

6:57 clgv: hyPiRion: yeah, or maybe only "symbol value" on one line but not "symbol\nvalue" for every binding no matter how much :width is used

6:58 hyPiRion: right. Fipp is EDN-only for now, so it cannot handle special forms correctly.

6:59 hrm.

7:01 clgv: hyPiRion: that problem should be the same for all those clojure GUIs/IDEs, but seems none of them made a separte library for it, right?

7:01 hyPiRion: right, noone's made a variant of gofmt for clojure afaik

7:03 clgv: but I think I found my error meanwhile ;)

7:03 hyPiRion: heh, that would be an interesting yak shave

7:04 "implemented clojurefmt because I couldn't debug my macro"

7:05 clgv: hyPiRion: well that's about the only time you desparately want a function for that available on the REPL, right? ;)

7:10 hyPiRion: it's not as epic yak shaving as Knuth with Tex ;)

7:10 LauJensen: Gents - Cider is pretty much working, but a few things are lacking, like C-c M-n calls cider-repl-set-ns, but it doesn't change the namespace in the nREPL. Is this a common thing?

7:14 hyPiRion: clgv: heh, yeah :p

7:15 vijaykiran: LauJensen: Not sure what the problem is - it works for me with 0.6.0alpha

7:16 clgv: hyPiRion: maybe I should ask laurent to make a lib. I think he did that for paredit already

7:16 hyPiRion: clgv: I almost wrote a bugfix for a postscript driver because the printer at my university didn't handle my LaTeX pdf properly

7:16 clgv: I wouldn't be surprised :p

7:16 clgv: hyPiRion: hehe. I couldnt print a pdf of a student last year ;)

7:17 hyPiRion: that's stupid when you need to correct it ^^

7:17 hyPiRion: yeah, it's a pain

8:27 SagiCZ1: ,(print "Hello")

8:27 clojurebot: Hello

8:28 TEttinger: ,"Hi"

8:28 clojurebot: "Hi"

8:36 clgv: ,(pr "Hello")

8:36 clojurebot: "Hello"

8:36 SagiCZ1: ,(= pr print)

8:36 clojurebot: false

8:37 SagiCZ1: (doc pr)

8:37 clojurebot: "([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"

8:37 clgv: no `pr` can beused for serializing clojure data to string

8:37 SagiCZ1: unlike print?

8:37 clgv: yes

8:37 SagiCZ1: clgv: is serializing data to string this way common in clojure as much as in other lisps?

8:38 clgv: ,(type (read-string (pr-str "Hello")))

8:38 clojurebot: java.lang.String

8:38 clgv: ,(type (read-string (with-out-str (print "Hello"))))

8:38 clojurebot: clojure.lang.Symbol

8:38 SagiCZ1: ,(type (read-string "{:a 0 :b 1}"))

8:38 clojurebot: clojure.lang.PersistentArrayMap

8:39 clgv: SagiCZ1: depends on your use case, I'd say. but it's mentioned pretty often

8:39 SagiCZ1: clgv: i see

8:44 does anyone remember the name of the guy who writes the Cursive plugin for IntelliJ?

8:45 got it.. cfleming

8:46 cfleming: SagiCZ1: that's me :-)

8:47 systemfault: Haha, cool.

9:00 mpenet: is there a project out there that turns prismatic schema ValidationError into someting readable for end users?

9:00 Glenjamin: schema-humanize is a thing iirc

9:01 this is what i was thinking of https://github.com/cddr/integrity#integrityhuman

9:01 mpenet: I spotted this one too, wondering if there are others

9:56 Mandar: hi!

9:57 I'm stuck with something basic: how can I make use of for with a higher-order function?

9:57 https://www.refheap.com/e703d9f35dee7c4ea41b2df21

9:57 I would like to have a function die-combination [n]

9:57 instead of writing different functions everytime

9:58 (the code is copy pasted from a REPL, die is just (range 1 7) for now

9:58 justin_smith: Mandar: what is "die"

9:59 wink: singular of dice? :P

9:59 justin_smith: and why does that code need a list comprehension?

9:59 Mandar: yeah, or plural I don't know :)

9:59 * TimMc wishes for a find-in

9:59 justin_smith: wink: I asked because die would be a function, not a function call

9:59 Mandar: justin_smith, because I couldn't think of anything better? :)

10:00 justin_smith: Mandar: for expects the input to be a sequence (or sequences) with a name binding each result

10:00 Mandar: justin_smith, I'm sure there is a better approach!

10:00 TimMc: (find-in {:a :b} [:a]) => [[:a] :b]

10:00 wink: I am mostly unsire where all the variables come from

10:00 justin_smith: Mandar: there is, I just need to know what you are actually trying to do

10:01 so you want three combinations of three dice?

10:01 Mandar: I'm trying to generate a set of unsorted dice results with n die

10:01 SagiCZ1: i vote for renaming all dice to "gambling cubes"

10:01 Mandar: for instance, with 2 dice, there are 21 unique combinations

10:02 when there's no order

10:03 (three-die-combinations) returns the set containing the 56 possible results

10:03 #{(2 4 4) (2 2 4) (1 5 5) (2 4 6) (5 6 6) (2 4 5) (2 3 5) (1 1 3) (2 2 6) (1 3 4) ...}

10:04 clgv: wink: the storks are to blame ;)

10:04 justin_smith: Mandar: ahh, ok, so die is [1 2 3 4 5 6]

10:04 Mandar: yes I got too tired of typing it in the REPL :)

10:05 justin_smith: so you want something that generalizes three-die-combinations and four-die-combinations to N-die-combinations

10:05 wink: SagiCZ1: permission granted

10:05 Mandar: justin_smith, exactly

10:06 sorry for my english

10:06 clgv: Mandar: you want a cartesian product of a set with itself in a given number of dimensions?

10:06 justin_smith: clgv: kind of, but the base element is not a set

10:06 [1 1 1] would be valid

10:06 SagiCZ1: wink: :wink

10:06 Mandar: justin_smith, yes

10:07 edw: I can't figure out why I'm getting "java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.Var$Unbound" while compiling this core.logic-using procedure: https://www.refheap.com/88877

10:07 clgv: justin_smith: yeah well same code, the user is to blame if they are not different ;)

10:07 hellofunk: does anyone know the Om syntax for the build-all function for passing a sequence that is nested inside another cursor?

10:08 clgv: Mandar: one way is to build all vectors with one element, then build all vectors with two elements from that, and so on ...

10:08 teslanick: hellofunk: How do you mean? What's the data structure look like?

10:08 hellofunk: teslanick unless you use Om it might be hard to explain

10:09 teslanick: I do, which is why I asked.

10:09 Mandar: clgv, so there's just no way to use the function I have and make it work with a higher number of elements?

10:09 I could do it with a macro, but it would not be pretty

10:09 clgv: Mandar: no, that's because `for` is a macro

10:09 hellofunk: teslanick if app state is (atom {:a {:b [1 2 3]}}) how to I pass the [1 2 3] to build-all?

10:10 clgv: Mandar: that's probably not a good idea ;)

10:10 teslanick: hellofunk: I'm assuming that your component holds a cursor that's a deref of the atom, yes?

10:10 Mandar: clgv, good

10:10 wink: clgv: i got sidetracked in reading, but as they are alternating can't you work with that?

10:11 hellofunk: teslanick the component which calls build-all has a cursor to the root app-state yes

10:11 teslanick: Pretty sure you can just do: (build-all child-component (get-in data [:a :b ]))

10:12 hellofunk: teslanick i get tons of error when i try that, i will hunt them and see if they are due to that

10:12 clgv: Mandar: you can easily build the desired set recursively as I outlined above

10:12 edw: Answer: too many brackets.

10:13 Mandar: clgv, yes, I just need to think a little about it

10:13 I thought there might be a function I don't know

10:13 (I'm still a beginner, of course)

10:13 teslanick: hellofunk: Om cursors implement PersistentMap and PersistentVector, so it may be a problem with your data format rather than the manipulation of that data.

10:14 What's the error, anyway?

10:15 hellofunk: teslanick ok, i think i found the problem. it's not clear to me in which circumstances inside an IRender render fn you should deref a cursor with @ vs use it without the defer

10:15 teslanick: Inside a render function you can always treat a cursor like a map

10:15 Outside the render function you have to deref it

10:15 See: https://github.com/swannodette/om/wiki/Cursors

10:16 hellofunk: teslanick what if you call a function inside your render fn and pass the cursor? do you deref it in the called fn?

10:16 teslanick: No. As long as the fn is executed synchronously, it's still part of the render cycle.

10:17 clgv: Mandar: you could use `iterate` for a sequence of results of the desired sets for arbitrary many dice rolls

10:18 teslanick: A good rule of thumb about cursors: treat them like a map until Om complains about accessing a cursor outside the render cycle. ;)

10:18 hellofunk: teslanic ok, cool i got it working. is there a way to pass multiple cursors to build-all as you can to om/build? i'm guessing not

10:20 teslanick: You should be able to map over a cursor to get sub-cursors. I could see some possible gotchas there.

10:20 *get a list of sub-cursors.

10:21 hellofunk: teslanick but a cursor will never know data from its parent or siblings in the global map, right? so you'd have to be able to pass multiple cursors if you wanted to do so, but build-all requires a specific sequence of cursors so i'm guessing this is not possible

10:24 teslanick: I think you're worrying too much about stumbling into something you can't do than trying something to see what happens.

10:25 justin_smith: Mandar: https://www.refheap.com/88878 not guaranteed perfect, but I think it is about right

10:25 teslanick: In the "Using multiple cursors" example, if you had lots of courses and classes, you could do something like (om/build-all course-class-list (map (fn [courses classes] { :rows courses, :cols classes }) (:course-list state) (:class-list state))

10:25 (at least, I see no reason why you couldn't)

10:26 Mandar: justin_smith,clgv, thank you

10:28 justin_smith, I don't get the base argument, it looks like an accumulator

10:28 hellofunk: teslanick that's interesting. i thought the "sequence" had to actually be defined in the app state wholly itself, i guess not

10:28 justin_smith: Mandar: yes, I named it badly, it is an accumulator

10:29 sq is actually that basis, sorry

10:30 Mandar: my hunch when writing it this way was the inverse corrolary of the fact that for was a cleaner way to do nested map calls

10:30 Mandar: which means of course that you can do arbitrary recursion by turning it back into map again

10:31 (and arbitrary recursion being a way to get N iterations of cartesian expanseion)

10:32 teslanick: hellofunk: Maybe it helps to understand a little bit of how Om works under the hood. A cursor is only different from a clojure data structure in that it supports transact!-ing against it (I think there are other things it does, but I haven't needed to use them).

10:34 justin_smith: Mandar: updated with better names, and using recur instead of self call https://www.refheap.com/88878

10:34 teslanick: A cursor holds a reference to the parent atom (either directly or indirectly, I don't remember). Then there's a global queue that takes changes (queued with transact!). At intervals, the queue is flushed and the view is re-rendered using React's virtual dom. There's a separate listener for changes made to the atom itself (using clojure's add-watch fn), which similarly queues a re-render.

10:34 I'm sure there are wrong details that dnolen will note, but that's the high-level.

10:35 Mandar: justin_smith, thank you, I'm trying to add a call to sort the list to only get unique items

10:35 helps me understand it better

10:36 hellofunk: teslanick thanks i'll give it all a try and see what happens.

10:36 justin_smith: Mandar: so you would consider [1 1 0] and [0 1 1] the same?

10:36 Mandar: yes

10:37 justin_smith: so you are not interested per se in the relative probability of a given sum, but rather in the variety of sums possible

10:37 or s/sum/combination even

10:37 Mandar: justin_smith yes exactly

10:37 teslanick: The point of all that is that you shouldn't have to worry too much about how Om is implementing things under the hood, you should just be able to write a function that returns as UI, with some concise bindings for interactivity.

10:38 justin_smith: Mandar: best of both worlds: (group-by sort (cartesian [1 2 3 4 5 6] 3))

10:39 the keys of that map tell you all possible triples

10:39 the count of each val tells you it's relative probability

10:40 Mandar: thanks, it's really impressive

10:41 I think that's the harder part for me: understanding exactly where I am in the collection when not iterating explicitely

11:27 arrdem: (let [{:keys [ox/static?]} {:ox/static? true}] ox/static?)

11:28 oops. #clojure is not a repl.

11:28 Glenjamin: i think you can drop the namespace in some bits of that

11:28 ,(let [{:keys [ox/static?]} {:ox/static? true}] static?)

11:28 clojurebot: true

11:30 gfredericks: ,(let [{:keys [:foo]} {:foo 12}] foo)

11:30 clojurebot: 12

12:04 blunte: Given a function ->MyRec, is there a way to get the class from that? ultimately I need to do (MyRec/getBasis) to get the list of fields, but I only have a function that belongs to MyRec

12:06 justin_smith: blunte: so given the constructor function, get the class it constructs?

12:06 gfredericks: ,(defrecord HooHa [])

12:06 clojurebot: sandbox.HooHa

12:06 gfredericks: ,->HooHa

12:06 clojurebot: #<sandbox$eval26$__GT_HooHa__35 sandbox$eval26$__GT_HooHa__35@1882760>

12:07 gfredericks: you'd have to unmunge something eh; much easier if you have the var

12:07 ,#'->HooHa

12:07 clojurebot: #'sandbox/->HooHa

12:07 blunte: I don't have a var yet. I'm reading from a file, and I want to know in advance how many fields I need to pull (or stub with nil) in order to create the record.

12:08 (defn read-and-make-rec [line fn-create-rec] ...)

12:09 I could pass the field count in, but I was hoping to avoid more parameters than I need

12:09 (tethered to phone on train, so if I go absent thanks for the replies)

12:10 scottj: ,(doc ->HooHa)

12:10 clojurebot: "([]); Positional factory function for class sandbox.HooHa."

12:13 justin_smith: blunte: I had thought that you could do (apply ->MyRec (repeat nil)) and then count its keys, but that locks up sadly

12:13 blunte: whoops!

12:13 justin_smith: ahh!

12:13 Glenjamin: ,(count (map->HooHa {}))

12:13 clojurebot: 0

12:13 Glenjamin: ,(defrecord Stuff [a b])

12:13 clojurebot: sandbox.Stuff

12:14 Glenjamin: ,(count (map->Stuff {}))

12:14 clojurebot: 2

12:14 justin_smith: ,(:arglists #'map->HooHa)

12:14 blunte: ohh

12:14 clojurebot: nil

12:14 justin_smith: ,(:arglists (meta #'map->HooHa))

12:14 clojurebot: ([m__5869__auto__])

12:14 Glenjamin: just count keys on an empty one :)

12:14 justin_smith: or check the arglists - then you don't even have to make one

12:15 ,(:arglists (meta #'->Stuff))

12:15 clojurebot: ([a b])

12:15 TimMc: justin_smith: THen you need the var.

12:15 justin_smith: ahh, yeah

12:15 good point

12:15 blunte: the issue is, I don't know my Record in the function. I just have a create function ->R

12:15 justin_smith: right, and you don't have the function's var so you can't check the arglist

12:16 mmitchel_: does anyone know how to have "lein ring server" listen on a host other than "localhost"?

12:16 TimMc: Reflection?

12:16 blunte: while I would like to know the answer to this, I could solve my real issue by knowing how to populate a new record with -> when I don't have a complete arg list... so non-supplied fields get nil as value by default

12:16 justin_smith: blunte: so if you took map->MyRec instead of ->MyRec as an arg, you could count the keys of the result of applying to {}

12:16 blunte: justin_smith: I see, I could probably get away with that

12:17 justin_smith: that would also do the automatic nils for non-supplied keys

12:17 blunte: well then!

12:17 super, thanks as always

12:18 justin_smith: (inc Glenjamin)

12:18 blunte: ahh indeed, sorry :)

12:18 justin_smith: for the idea of using the map->MyRec version

12:18 seems lazybot is so lazy he is not even logged in

12:19 blunte: hehe. ok, disconnecting. I was so desperate I used my limited phone data to get on here ;)

12:20 TimMc: (count (:params (first (filter #(= (:name %) "invoke") (org.timmc.handy.reflect/methods (class ->Foo)))))) ;;= 2

12:20 (this is not guaranteed to work against future Clojure versions since more invoke methods could be added)

12:32 michaelr525: hmm

12:33 so I'd like to create an om component which should let me edit a form and this component should be displayed in a modal dialog when a user clicks a button

12:34 call (om/build) from the onClick handler of the button doesn't seem to work

12:34 how should approach this correctly with Om?

12:34 I

12:35 I'd like to use that component for creating a new item and editing existing items

12:35 The usual CRUD stuff

12:38 hum hum

12:38 hellofunk: michaelr525 use the onClick to set state somewhere appropraite, either component local state or actual app state, and then use that state as a check for om/build in a render function.

12:38 and better if use a async chan in onClick to queue up the state change, even better in most cases

12:38 michaelr525: hum hum

12:40 hellofunk: ok, how about the data which should be displayed in this dialog. should I designate an entry in the app state for that and when a user attempts to edit some item I'd just assoc it at that place in the app state where the modal editing dialog expects to find it?

12:41 or I think I get it, I'll pass the data in the conditional build call

12:41 right?

12:58 edw: Is there an idiomatic way to create a sequence of windows for another sequence e.g. (windows [:a :b :c]) ==> ((nil :a :b) (:a :b :c) (:b :c :nil))

13:01 stuartsierra: ,(partition 3 1 [:a :b :c :d :e :f])

13:01 clojurebot: ((:a :b :c) (:b :c :d) (:c :d :e) (:d :e :f))

13:04 edw: stuartsierra: That's not quite what I was thinking. More like this: https://www.refheap.com/88882

13:04 stuartsierra: Your solution would work by wrapping the col with a couple nils.

13:15 justin_smith: edw: wouldn't the most logically consistent behavior be to put n-1 nils on each end of a sequence taken in chunks of n?

13:16 one on each end seems arbitrary to me I guess

13:16 edw: justin_smith: Perhaps. I'm working on a constraint satisfaction problem and I'm using nil to denote a boundary; the idea of two boundaries doesn't make sense in that case.

13:17 justin_smith: edw: ahh, ok

13:17 if it were dsp style windowing, it would make sense to have n-1 empty inputs to define a window

13:17 or, padding to fit a fixed width

13:17 stuartsierra: edw: adding the Nils might work better as a separate step then, then you can use partition.

13:19 edw: justin_smith: Good feedback. I am, of all things, a graph paper layout app.

13:21 justin_smith: One other thing I was thinking of is this: should the procedure return a) zero or b) one elements if the input sequence is empty. I came down on the size of zero.

13:22 Which gets me thinking about this: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

13:25 TimMc: edw: For a graph papr layout app you speak pretty good English.

13:25 edw: TimMc: Verbs, who them?

13:26 justin_smith: (inc TimMc)

13:40 jazzit: Is weasel broken? I setup an om-weasel project in Leinigen and when I update core.cljs Chrome doesn't see the changes. I started weasel via Emacs Cider with (run) and (browser-repl)

13:45 ToBeReplaced: i'm toying with writing my next project in an aspect-oriented style, using robert-hooke for logging, exception handling (dire), and caching -> any thoughts or experience reports on doing that?

13:46 dnolen_: jazzit: weasel has stale declared dependencies - esp. if you are using a newer release of ClojureScript

13:47 jazzit: dnolen_: Jeez, Clojure I'm finding the whole Leiningen/JVM/Emacs/Cider/weasel toolchain very fragile and does not give me the feeling of a reliable development environment.

13:47 dnolen_: (New to Clojure)

13:47 dnolen_: jazzit: I don't use weasel so I can't say anything about it

13:48 jazzit: dnolen_: OK. What's a good alternative for a browser repl?

13:49 dnolen_: jazzit: I just use the standard one if I really need it, works well enough for me - honestly I've given up on Emacs as my main Clojure interactive dev environment

13:49 hiredman: given up on?

13:49 jazzit: dnolen_: Really. I got the impression Emacs was the Holy Grail of Lisp/Clojure development.

13:50 hiredman: dnolen_: that implies you were waiting for something and got tired of waiting, so I am curious as to what that was?

13:50 dnolen_: jazzit: I use Cursive for actual interactive dev now - I'm tired of the Emacs stuff changing

13:51 hiredman: I still use Emacs mostly - just not for REPL driven Clojure stuff.

13:51 jazzit: dnolen_: Is Cursive an editor?

13:51 dnolen_: debug REPL is also a big draw

13:51 jazzit: plugin for IntelliJ

13:52 jazzit: and I can make it work mostly like Emacs, lots of small annoyances but whatever the overall experience is better

13:52 AeroNotix: dnolen_: what do you mean "emacs stuff changing" ?

13:52 jazzit: dnolen_> jazzit: and I can make it work mostly like Emacs, lots of small annoyances but whatever the overall experience is better

13:53 dnolen_: AeroNotix: cider randomly breaking, cider dev dependency

13:53 AeroNotix: dnolen_: I'm not sure I follow. Do you update often?

13:53 dnolen_: which isn't to say I don't appreciate all the work going on in cider

13:53 AeroNotix: yes and I expect it to not break

13:53 jazzit: dnolen_: So the whole Emacs live editing thing is just hype?

13:53 ToBeReplaced: mdrogalis: have you worked on anything substantial using robert-hooke for purposes other than exception handling (ex. logging, caching)? how'd it go?

13:53 dnolen_: just don't want to fiddle w/ it anymore

13:53 AeroNotix: dnolen_: What are you upgrading for?

13:53 dnolen_: honest question

13:53 hiredman: basically, since the change of "owenership" of nrepl.el, it has been going down hill, the only people that still use it are people who don't upgrade obsessively, so they are fine using years old or six month old versions

13:53 dnolen_: AeroNotix: I just keep my packages up to date, I like enhancements

13:54 mdrogalis: ToBeReplaced: Logging - yes.

13:54 AeroNotix: dnolen_: sure, but CIDER isn't 1.0 software yet, afaik

13:54 dnolen_: AeroNotix: neither is Cursive

13:54 mdrogalis: I have a layer of logging over an API that 100% separates logging from API calls

13:54 hiredman: dnolen_: upgrading is a mistake :)

13:54 dnolen_: anyways, use what works for you :)

13:54 jazzit: hiredman: Quite an eye-opener.

13:54 dnolen_: jazzit: Emacs live editing isn't hype

13:54 AeroNotix: dnolen_: sure, I'm just saying that I don't have those problems ( and I update once a week as well )

13:54 dnolen_: jazzit: live editing period is good stuff

13:55 AeroNotix: dnolen_: btw are you on a mac?

13:55 jazzit: dnolen_> jazzit: Emacs live editing isn't hype

13:55 dnolen_: AeroNotix: yes

13:55 AeroNotix: dnolen_: I've had co-workers have trouble initially setting CIDER up on a mac

13:55 hiredman: jazzit: it is unfortunate, because it was decent for a while, right after the first breakages after the change in ownership I locked to a sha that works for me and haven't ugpraded since

13:55 ToBeReplaced: mdrogalis: anything hidden or interesting to share after using it for a while? considering an aspect-oriented approach on next project, but i've never done it before

13:55 jazzit: dnolen_: OK, I meant not so good for Clojure

13:55 Bronsa: swank-clojure still works like a charm.

13:56 hiredman: Bronsa: with a new versions of slime?

13:56 Bronsa: hiredman: no, I'm using a 2009 version

13:56 mdrogalis: ToBeReplaced: Hm. Beware of accidentally adding Dire hooks more than once. I actually got an email this morning from someone working on adding idempotent hooks. But for the mean time, do something like this: https://github.com/MichaelDrogalis/dire-with-component

13:56 ToBeReplaced: You'll have a pretty good time I think. I have been, anyway.

13:56 ToBeReplaced: mdrogalis: and in your blog you use dire.core to add pre/post hooks... wondering if just prepend/append from robert hooke is sufficient or if there's more to it

13:57 dnolen_: jazzit: in general it's probably fine for Clojure

13:57 ToBeReplaced: ah cool, thanks for the help; i'll peek around

13:57 mdrogalis: ToBeReplaced: I dont recall off the top of my head, but I think I added it because it bought something extra. Maybe it was runtime access to the params and return value.

13:57 ToBeReplaced: Sure thing.

13:57 dnolen_: jazzit: but REPL support for ClojureScript is still subpar all around - hopefully this will change - weasel seems like a good start

13:57 jazzit: hiredman: dnolen_: Sorry, I meant Clojurescript

13:58 dnolen_: I had weasel working a few days ago but some upgrade must have borked it.

13:58 dnolen_: It was very nice to work with.

13:59 dnolen_: jazzit: then I recommend pinging the maintainer, I can't imagine that it would be tough to bump the dependencies

13:59 jazzit: dnolen_: OK, will do.

14:01 itruslove: jazzit: I was messing around with piggieback and austin for a while too, and also never quite felt like it was stable. I just forked a fork of an old emacs "clojurescript-mode" which just fires up a `lein trampoline cljsbuild repl-listen` in emacs. It's way simpler than Austin, but I have had luck for at least the last few hours of working using it

14:01 jazzit: https://github.com/iantruslove/clojurescript-mode

14:18 justin_smith: I just found this email from the lead ocaml dev describing why avl trees are faster than red/black for set operations like union / intersection etc. - I wonder if that means data.avl sets would be faster than clojure.core sets for those sorts of ops

14:18 https://sympa.inria.fr/sympa/arc/caml-list/2014-08/msg00012.html

14:22 hiredman: I don't think clojure's sets are red-black trees

14:22 the sorted ones might be

14:24 justin_smith: oh, ok

14:25 hiredman: just glancing at the email it sort of looks like it may discuss some implementation details from some specific implementations

14:25 hyPiRion: yeah, they are hash sets

14:25 amalloy: the sorted ones are

14:26 justin_smith: the regular set delegates to persistenthashmap

14:29 hiredman: which is not to say that data.avl isn't faster (I don't know) I just don't think that meila can be used as evid

14:29 bah, bad connection

14:29 I just don't think that email can be used as evidence

14:29 justin_smith: hiredman: sure, it's just that it makes me curious - I may try some benchmarking, and I figured some of you guys may have interesting input

14:36 hiredman:

14:40 the feature expression stuff makes me so sad

14:41 everyone is so eager for something lifted from common lisp, completely ignoring the downsides to doing that stuff in the reader

14:42 solussd: hiredman: what are the downsides?

14:42 hiredman: I get that it is easy to do in the reader, but it makes the reader much less useful for analysis

14:43 solussd: by resolving them in the reader I cannot write a tool based on the reader that can inspect/analyze them

14:43 solussd: ah

14:43 I hadn’t considered that.

14:44 turbofail: i like scheme's cond-expand construct

14:44 for this purpose

14:45 justin_smith: hiredman: would a tool that split a repo into the combinatorial expansion of all possible feature-expression result so that each could be analyzed by absurd?

14:45 turbofail: i think i implemented a version of it at some point for clojure

14:45 justin_smith: *be absurd

14:45 hiredman: justin_smith: yes

14:45 a terrible hack to get around a wrong headed feature

14:45 technomancy: I'm not sure how I feel about disqualifying things based on their being absurd

14:45 hiredman: with some slight amount of foresite that could be completely avoided

14:46 technomancy: embracing absurdity is part of what makes us human

14:46 hiredman: if you have ever tried to do tooling for language where the official parser throws data way or does partial evaluation it is terrible

14:47 resolving stuff like this at read time in the reader is equivalent

14:56 meingbg: So what's up with forward definitions? Isn't that a little bit 1970's style?

14:57 justin_smith: hell, sexps are kinda '50s style

14:57 hiredman: it makes the compiler simpler and helps unify the experience loading code in a repl and loading it from a file

14:58 and given the dynamic typing it helps catch things like defined names faster

14:58 undefined

14:59 meingbg: hiredman: So do you think it's on purpose, or just because the compiler implementor didn't get around it yet?

14:59 hiredman: it is on purpose

15:00 if you typo the name of a function that is called in function F, would you prefer the typo to be caught when F is compiled or when F is run?

15:01 stuartsierra: meingbg: some background from Rich Hickey on compilation units here https://news.ycombinator.com/item?id=2467359

15:01 meingbg: I can accept it makes the compiler simpler, but it's a hassle to do forward definitions. I mean, technically you could do a reader macro that greps the function names from it's own file and forward defines all of them. That would still allow for catching undefined functions at compile time, which is what I would prefer.

15:03 llasram: meingbg: I find that in practice pure top-to-bottom and pure bottom-to-top are equally easy to read, and both are generally easier to read than an arbitrary mix

15:03 meingbg: So my experience is that you get completely used to it and you stop even thinking about it

15:04 hiredman: Has there been some recent secret discussion of feature expressions I'd missed?

15:04 amalloy: (inc llasram)

15:04 c'mon lazybot

15:04 * llasram mourns lazibot

15:04 llasram: er, lazybot even

15:05 hiredman: llasram: puredanger added a patch or something that made it show up in my rss reader and triggered me

15:06 puredanger: I am working on a consistent set of patches for evaluation right now

15:06 meingbg: llasram: I agree, but my current project is an exception. For me, the easiest order to read would be in the same order as the 120 page ISO standard I'm implementing.

15:07 justin_smith: meingbg: one thing that reduces the pain for me is the fact that declare is multi-arity

15:07 (declare a b c d e ...)

15:07 hiredman: puredanger: common lisp's mechanism is such a wart, and makes the reader much less useful for tooling

15:07 puredanger: I understand your concerns

15:07 meingbg: justin_smith: Right, I just have a declare form at the top and add any names I get in compilation errors. It's not a big hassle, just made me think why I'm still doing this after leaving C/C++.

15:08 hiredman: puredanger: so do you think it isn't an issue? is there some overriding plus to doing it in the reader?

15:08 llasram: meingbg: You could write a wrapper macro enclosing all of the definitions which first forward-declares them

15:09 puredanger: hiredman: I'm just trying to get a consistent set of patches to evaluate

15:09 llasram: Since you have specific reason for putting them in a non-standard order, it doesn't seem like an entirely insane idea :-)

15:09 puredanger: hiredman: I'm not magically blessing anything

15:09 meingbg: llasram: True. Unless that interferes with my editor, when there is suddenly only one top-level form.

15:10 * llasram envisions puredanger making the sign of the lambda over this patch.

15:10 puredanger: hiredman: I think cljx has demonstrated utility in the approach. there are also unresolved issues.

15:10 sveri: Hi, How can I make marginalia work with my clojurescript sources? Adding src-cljs to the :src option in leiningen was not enough

15:11 hiredman: meingbg: I'd suggest modeling things more abstractly rather than directly translating the iso, which I've found helps a lot when implementing that kind of thing (not just forward declaration)

15:12 the sort of modeling layer between the language and the spec/paper/etc gives you a lot of flexibility

15:12 meingbg: llasram: You're probably right. I should just appreciate the ability to bend lisp in special cases like this.

15:12 Bronsa: hiredman: I honestly don't see how an approach that doesn't operate at read-time could work given macros

15:13 michaelr525: hey

15:15 meingbg: hiredman: Yeah, you're probably right. I don't really translate the spec directly, I just like to have the reference links to what spec section triggered the need for a certain function. But there will be abstractions; the very reason I'm doing this is so I can do symbolic operations and feed the output to an equation solver, effectively executing half the spec backwards.

15:15 hiredman: Bronsa: http://srfi.schemers.org/srfi-0/srfi-0.html seems pretty reasonable

15:16 Bronsa: another possiblity would be to add feature-expression expansion as a stage before macroexpansion

15:17 (which would mean macros could not emit feature-expressions, which I am fine with)

15:21 Bronsa: hiredman: ok I see how a phase between read-time and macroexpansion-time could work even though it'd require walking the args to the macro call, reading the link now, thanks

15:23 hiredman: I hadn't seen cond-expand until turbofail mentioned it

15:24 cond-expand seems to have the additional restriction that it can only be used as a toplevel form, which I like, but I am not sure if that kind of restriction would be embraced

15:27 Bronsa: hiredman: if that means that I can't do (deftype x [] (cond-whatever "clj" clojure.lang.PersistentVector "cljs" cljs.core/PersistentVector) ..) then IMHO it's not good enough

15:27 hiredman: Bronsa: sure

15:40 SagiCZ1: .

15:52 jdkealy: how can i make "or" queries in datomic ?

15:53 puredanger: rules

15:55 jdkealy: see http://docs.datomic.com/query.html and search for the "social-media" rule for an example

15:55 jdkealy: thanks!

15:58 can you make "rules" inline or do you have to reference them like this ?

15:58 puredanger: not inline

15:59 jdkealy: so in clojure i make a rule as a function ? defn rule[p1 p2 p3 p4] ?

16:02 jgt: so… Did I find a bug in Clojure? Or am I just stupid?

16:02 http://stackoverflow.com/questions/25126368/seemingly-magical-behaviour-in-my-clojure-repl

16:04 amalloy: jgt: your ref contains the class PersistentQueue, not an instance of that class

16:04 stuartsierra: jgt: and `concat` returns a lazy sequence, it doesn't work on queues the way you think

16:04 amalloy: all the stuff you do after that is just a big pile of undefined behavior, probably

16:06 jgt: that shit cray

16:10 stuartsierra: jgt: laziness, errors, and undefined behavior; http://stackoverflow.com/questions/25126368/seemingly-magical-behaviour-in-my-clojure-repl/25126712#25126712

16:12 Garbage in, garbage out.

16:21 zoldar_: Hi. I've prepared a template for Om application development with continuous testing setup. It's mostly working as expected, however, with source map enabled, intial and incremental builds take much longer (actually the overhead for both types of builds is the same - 10 seconds in my case for clean project). If anybody would be willing to take a look, here's a github page: https://github.com/zoldar/om-with-tests-template . Template is deployed

16:31 dnolen_: zoldar: it appears you are using advanced compilation as the default - that's always going to be slow

16:32 amalloy: i'd like to call the error jgt was getting "the result of undefined behavior", but in a spec-less language like clojure is there any such thing?

16:32 dnolen_: zoldar: for the best performance I would figure out how to make :none work for you

16:37 zoldar: dnolen_: :whitespace equals to advanced? please have a look at profiles.clj

16:38 dnolen_: :dev profile merged with base from project.clj is default, effective one

16:40 jgt: Puh

16:41 now I get “parameter declaration do should be a vector”

16:41 on line 24

16:41 dnolen_: zoldar: even whitespace is slow w/ source maps

16:41 zoldar: the only thing that is fast w/ source maps is :none

16:42 jgt: anyone see the problem? https://gist.github.com/jezen/33550ae8fac8df1eb2e4

16:42 zoldar: dnolen_: just noticed, switched to none and it's blazingly fast again. thanks for pointer

16:43 dnolen_: zoldar: the problem with the concatenated modes is that we need to merge 2 source maps - no way to speed that up

16:44 iwillig: jgt: you are missing the function vector args on 24

16:44 after open-for-business you should have []

16:44 jgt: ahhh

16:44 iwillig: like this

16:44 https://gist.github.com/iwillig/864bcf3c93a9815ef3d2#file-gistfile1-clj-L26

16:44 jgt: but that’s on line 26

16:45 iwillig: err sorry yeah line 26

16:45 jgt: no no, you only said 24 because *I* said 24

16:45 and I said 24 because that’s what the compiler told me

16:46 I wish the compiler weren’t so misleading

16:47 dnolen_: jgt: what environment are you using and did you use incremental eval or did you compile the whole file?

16:47 jgt: dnolen_: Just doing `lein run`

16:47 there isn’t much literature out there that holds your hand while doing Clojure

16:47 or rather, Clojure workflow

16:48 I missed the brackets because I was thinking of doing something like (def open-for-business #((do …)))

16:48 though I’m not sure if Clojure works like that

16:48 dnolen_: jgt: hrm usually the line numbers are pretty accurate

16:48 jgt: that won't work

16:49 jgt: dnolen_: I guess I haven’t understood the anonymous function macro

16:49 zoldar: oh crap, austin seems not playing well with :none optimisations mode :(

16:50 dnolen_: zoldar: yeah sorry can't helper there, I know nothing about austin

16:51 zoldar: dnolen_: thanks for clarifying though

16:51 jgt: I fixed the vector args syntax error

16:52 and also fixed line 15 where I’m trying to count a reference

16:52 but now when I do `lein run` it just sits and does nothing

16:52 maybe it compiled and is just running endlessly

16:52 I don’t know

16:53 dnolen_: jgt: you are in an infinite loop at the bottom at line 41

16:53 you will never reach lines 46 and on

16:53 jgt: ah…

16:53 right you are

16:55 I think I have to start my loops after the shop has opened

16:55 amalloy: so i learned something interesting last week, guys. i'll present it as a puzzle first: would you expect either of these to be substantially faster than the other? (doall (list* 0 1 2 3 4 (concat '(5) '(6)))) (doall (concat (list* 0 1 2 3 4 '(5)) '(6)))

16:57 SagiCZ1: ,(time (doall (list* 0 1 2 3 4 (concat '(5) '(6)))))

16:57 clojurebot: "Elapsed time: 0.085463 msecs"\n(0 1 2 3 4 ...)

16:57 SagiCZ1: ,(time (doall (concat (list* 0 1 2 3 4 '(5)) '(6))))

16:57 clojurebot: "Elapsed time: 0.07163 msecs"\n(0 1 2 3 4 ...)

16:58 SagiCZ1: not really

16:58 amalloy: SagiCZ1: if you run a more credible benchmark (irc bots are terrible for this), you'll find that one of them is about twice as fast as the other

17:01 anyway, spoiler alert for anyone who was interested in figuring it out: the version starting with concat is slower, because needs one more layer of indirection than the other, in order to read the first five elements: with list* there's no intervening lazy sequence to delegate to list*, you just have a bunch of conses

17:05 michaelr525: om stuff beginning to work (a tear of happiness ;)

17:06 hehe

17:06 jgt: I have been shuffling things around

17:06 tried to stick my loops in functions

17:07 something is still looping infinitely

17:07 https://gist.github.com/jezen/22f23e394a90c4dc56d8

17:07 can anyone spot it?

17:09 justin_smith: jgt: you have two loops that check @shop-is-open, and you run both synchronously before you set shop-is-open false

17:09 maybe you want to run monitor-waiting-room and send-customers-from-street in threads?

17:09 jgt: yeah maybe

17:09 do I stick them in futures? Excuse my noobiness

17:09 justin_smith: otherwise, the first one you run is just going to run infinitely

17:10 a future is the easy way, yeah

17:10 also, monitor-waiting-room is going to sit there and eat CPU when you don't have anything in @waiting-customers

17:11 and because you do the cut-hair outside the dosync, one customer could get two haircuts

17:11 jgt: IT WORKS

17:11 ahhh, I don’t care

17:11 it’ll do for now

17:12 I can come back and learn Clojure a bit harder

17:12 one day

17:12 justin_smith: OK, just saying, since the point of refs is coordination that prevents such conditions :)

17:12 jgt: thanks for your help :)

17:12 pandeiro: anyone working with h2? does it really not give you back a proper record from jdbc/insert! or am i missing something?

17:13 justin_smith: jgt: also, your usages of do outside if are redundant (all of them unless I missed any)

17:13 jgt: justin_smith: I don’t think I have any?

17:13 unless (dosync) counts as a do

17:14 justin_smith: inside your defns

17:14 cut-hair

17:14 send-customers-from-street

17:14 open-for-business

17:14 all have unneeded do blocks

17:14 defn and while have implicit do already

17:14 jgt: ah, ok

17:15 justin_smith: though it is needed in if (since the second line with become an else otherwise

17:15 )

17:15 jgt: yeah, I understood that

17:15 now it’s a bit clearer

17:15 thanks

17:15 turbofail: that said in both of those cases you could replace if with when

17:15 justin_smith: and then eliminate do entirely, nice

17:16 turbofail: er, that one case i mean

17:16 gfredericks: technomancy: do you object in principle to `lein vcs tag` having some way to opt-out of signing the tag?

17:21 technomancy: gfredericks: no, it just hadn't occured to me

17:21 occurred

17:24 someone had an xargs trick the other day to let you grep all your deps

17:24 AeroNotix: grep yo' deps baby

17:25 amalloy: i think it was alandipert, technomancy

17:26 gfredericks: I'm assuming that xargs comment was unrelated

17:26 amalloy: yeah. <alandipert> amalloy, lein cp | tr : '\n' | grep 'jar$' | xargs grep -R 'System/exit'

17:26 technomancy: amalloy: thanks!

17:27 gfredericks: if I knew 10% more bash stuff I could do 2x more things

17:30 technomancy: huh... that doesn't actually work for me

17:32 amalloy: i'm surprised `tr : '\n'` works - i would have expected to need $'\n'

17:32 hiredman: you may need to use zgrep

17:33 technomancy: hiredman: that's what I thought too, but no dice

17:33 hiredman: oh

17:33 technomancy: oh, zgrep is for gz, not regular zip

17:33 hiredman: right

17:33 and for single files

17:34 not an archive of multiple files

17:34 gfredericks: technomancy: keeping backwards compatibility on the tagging thing is tricky though :/

17:35 arohner: is there anything around cljsbuild for sha1'ing compiled files, so they can be easily served with long cache-control headers?

17:51 ticking: dnolen_: is providing multiple namespaces within the same vector to cljs.closure/build ok or a big no no? It seems to work.

17:51 dnolen_: ticking: supposed to work far as I know

17:52 ticking: dnolen_: great :D thanks!

18:11 technomancy: paging gfredericks http://davidmalki.tumblr.com/post/93643917408/sometimes-you-have-an-idea-in-the-shower-and-you

18:13 TeslaNick: When creating a map from a sequence of (:key value) should I use array-map, hash-map, or something else that I haven't found yet?

18:13 amalloy: TeslaNick: usually ##(doc into)

18:13 TeslaNick: (into {} key-values) perhaps?

18:13 lazybot: ⇒ "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

18:13 amalloy: &(into {} (for [x (range 5)] [x :default]))

18:13 lazybot: ⇒ {0 :default, 1 :default, 2 :default, 3 :default, 4 :default}

18:15 TeslaNick: Would I not then need to partition the list into vecs first?

18:16 It doesn't like &(into {} '(:a 10 :b 20))

18:17 nor (into {} '((:a 10) (:b 20)))

18:18 amalloy: TeslaNick: right, if you have the latter you can (map vec ...). the former is kinda a gross thing to have (why are these loose keyvals instead of nicely packaged pairs?), but you can (apply hashmap kvlist)

18:19 or i suppose ##(reduce (partial apply assoc) {} '((a 10) (b 20))) works too, but seems tacky

18:19 lazybot: ⇒ {b 20, a 10}

18:19 TeslaNick: I'm trying to write a function in the style of assoc. So (assoc m :key val :key2 val2)

18:20 justin_smith: TeslaNick: isn't that basically hash-map?

18:20 TeslaNick: Yes. My original question is, should I use hash-map, array-map, or something else I haven't found?

18:21 I'm not sure what the difference between those to fns are aside from internal representation

18:21 justin_smith: array-map is what {} uses for smaller key counts

18:21 it gets promoted to hash-map automatically at larger sizes

18:21 puredanger: <= 8 map entries

18:22 dnolen_: TeslaNick: there's little reason to use array-map directly

18:23 TeslaNick: Exactly what I wanted to know

19:08 s2ky: , youtube.com/skywayinc

19:08 clojurebot: #<CompilerException java.lang.ClassNotFoundException: youtube.com, compiling:(NO_SOURCE_PATH:0:0)>

19:11 tuft: i always find that odd. there's this great map adt, but the only abstract constructor is (into {})

19:20 amalloy: that spam url looks remarkably clojurey

19:20 justin_smith: hah, I didn't even recognize it as a spam url at first

19:21 amalloy: clojurebot was even more duped than you were

19:34 schmee: I'm using Enlive to scrape a site, (html/select page [:a.similar-artist]) results in a vector of things like this ({:tag :a, :attrs {:class "similar-artist", :href "/music/Return+To+Base"}, :content (" ")}

19:34 how can I extract the links?

19:35 (html/select page [:a.similar-artist :href]) doesn't do the trick, and I tried a bunch of variations on that theme...

19:36 hiredman: :href there is an attribute

19:36 ben_vulpes: hey has anyone done any work to integrate clojure type hinting into emacs?

19:36 hiredman: [:a.foo] is the tag a with the css class foo

19:36 ben_vulpes: (that is to say cider/nrepl/swank...)

19:37 hiredman: I would just tack on a map of (comp :href :attrs)

19:39 schmee: hiredman: ahh, so there's no better way to write the select thing to get the result directly?

19:40 the comp thing worked beautifully btw, thanks!

19:41 hiredman: schmee: I think of a select as a tool to grab the tags I care about, I've never looked in to it beyond that

19:42 amalloy: ben_vulpes: integrate it? what would that mean?

19:46 ben_vulpes: amalloy: you're familiar with the emacs area (i'm not certain what it's called...) that displays a functions signature? i was idly pondering how nice it'd be to have the argument types in there too.

19:47 amalloy: ben_vulpes: those often won't be in the arglist; they might be hinted inline instead. but you can always (set! *print-meta* true) and see if you like what you get

19:48 also, it's called the minibuffer

19:49 ben_vulpes: hm, i don't see any difference after (set *print-meta* true)

19:49 hiredman: !

19:50 amalloy: who knows what works in latest cider. it works in my four-year-old swank/slime setup

19:52 ben_vulpes: *sigh* cider *sigh*

19:52 <-- emacs noob

19:52 amalloy: i mean, odds are it works in cider too and ben_vulpes is just doing something wrong - it's a feature that would be hard to mess up

19:52 mgaare: schmee: look at html/attr-values

19:53 hiredman: amalloy: you say that...

19:53 amalloy: if optimism is wrong i don't wanna be right

19:55 hiredman: well, cider may be using a different session or something for printing args, which I think in nrepl means you get a new set of thread locals

20:06 tsantos: ClojureScript question: I’m calling a function in node that returns a JavaScript function. How can I then call that function from ClojureScript? The line of JavaScript is: var stripe = require(“stripe”)(“sk_test_iedoworpdjpdjsqooej”);

20:06 ((node/require “stripe”) “sk_test_iedoworpdjpdjsqooej”) doesn’t work.

20:09 gfredericks: tsantos: looks fine to me

20:09 tsantos: I get this:

20:09 (function (exports, require, module, __filename, __dirname) {

20:09 ^

20:09 RangeError: Maximum call stack size exceeded

20:11 hlship: I'm having a bit of "hair on fire" with Lein w/ uberjar vs. other profiles

20:11 I have a single code base

20:12 I want to generate Uberjars for different entry points

20:12 lets call them "client" and "server"

20:12 Everything works *except* that lein uberjar

20:12 doesn't seem to recompile .class files if they are present

20:12 only after a clean

20:13 SegFaultAX: Have the underlying clj files changed?

20:13 hlship: yes

20:13 working on a gist ..

20:13 gfredericks: technomancy: thxman

20:13 technomancy: I believe his selection to be artificial

20:14 hlship: https://gist.github.com/hlship/96e6d6b8dc4a5e752028

20:15 hiredman: hlship: why do you think it should recompile .class files?

20:15 hlship: I've tried a lot of variations w/ the :aot field, and where it goes (top level, inside :uberjar pofile, inside :client profile)

20:15 @hiredman - because I've changed the .clj source files

20:15 then `lein with-profile client uberjar`

20:15 SegFaultAX: hlship: So to be clear, this has nothing to do with the different entry points, right?

20:15 hiredman: hlship: well, that gist doesn't show that

20:15 SegFaultAX: You're just seeing some weirdness with the build?

20:16 hlship: Looks like the problem is that I'm AOT compiling but also :omit-source true

20:16 I get the correct behavior when I remove that line

20:16 so it feels like if you omit source, it is defeating the check to see if compilation should occur?

20:17 hiredman: hlship: well, what you may be seeing is the runtime choosing to load the source instead of the compiled class

20:17 (which it does in some cases)

20:17 hlship: very true

20:18 Though I'm not sure

20:18 since I'm checking results using

20:18 "java -jar target/client-0.1.0-standalone.jar"

20:18 hiredman: sure

20:18 hlship: which is a :gen-class

20:18 which is a :gen-class

20:18 hiredman: but if the sources are in the jar, clojure might choose to load the sources instead of the generated classes that are also in the jar

20:19 hlship: that's true and hard to check

20:19 hiredman: yep

20:19 SegFaultAX: I suppose you could manually unpack, change, and repack the jar.

20:19 Since it's just a zip file.

20:19 justin_smith: hlship: why not use an environment variable or system property on the target machine to dispatch the main function to run?

20:19 hiredman: hlship: but it is still not clear to me why you expect the class files to be regenerated when you use different profiles

20:20 SegFaultAX: Or even just a command line option.

20:20 hiredman: I think the question about multiple entry points was a red herring.

20:20 hiredman: hlship: are you generating with one profile, changing source, then generating with another? project.clj doesn't count as source

20:20 hlship: @hiredman I don't follow. I'm building an AOT compiled Ubjerjar. And my source .clj has changed. So of course I expect AOT compilation to occur, and the updated .classes to be packaged.

20:20 Nope, I'm chaning my client.main source file, changing the -main function there.

20:21 SegFaultAX: So you create an uberjar, then edit the source, then create another uberjar, and the second uberjar doesn't reflect your changes?

20:23 hiredman: well the first thing to do try and rule out anything environmentally, the easiest way to start doing that is see if you can reproduce in a fresh checkout

20:24 lein uberjar && touch src/whatever && lein uberjar

20:24 hlship: @SegFaultAX - yes I make an edit then `lein with-profile client uberjar ; java -jar target/client...jar` and I'm not seeing the change

20:25 it is confused by :omit-source, when I turned that on, it reverted to several iterations back when I ran the client

20:25 meaning, I think, that it reverted back to a much older version of the .class file

20:25 SegFaultAX: hlship: Then you agree this has nothing to do with the multiple entry-points thing? I just want to remove that from the disucssion if it isn't relevant to the bug you're trying to diagnose.

20:25 hlship: that was obscured, as @hiredman said, by the packaging of newer source

20:26 SegFaultAX: hlship: Also, most IRC clients don't highlight with the @ prefixed to the nick. Just SegFaultAX or hiredman should suffice. It's probable that typing "segf<tab>" will complete my name for you appropriately.

20:26 hiredman: hlship: do you have any kind of circular maven dependencies or something?

20:26 hlship: not that I know of

20:27 I'm very careful with my dependencies

20:27 hiredman: hlship: or if you aot everything regularly, you may be getting old transitively aot'ed code in the jar

20:28 SegFaultAX: hlship: Cleaning before uberjaring fixes the issue? What version of lein are you running?

20:28 hlship: 2.3.4

20:28 SegFaultAX: And cleaning fixes it?

20:29 hlship: SegFaultAX: checking ...

20:30 I've been thrashing on my project.clj, here's where it currently stands:

20:30 https://gist.github.com/hlship/60d3cc37bb7766f62146

20:30 I removed the profile stuff,

20:30 1st execution: https://gist.github.com/hlship/419e9ca3c7de27641dd1

20:31 change fan.auth.main

20:31 Second execution: https://gist.github.com/hlship/aee6dd5ef047962c364e

20:32 no sign of AOT compilation, old behavior holds (should print ""Startup 6")

20:32 SegFaultAX: And what did you do in the middle?

20:32 Touched the -main fn to prn something new?

20:32 hlship: yes

20:33 Nothing tricky: https://gist.github.com/hlship/93908ea3ed11aab54d91

20:34 hiredman: it seems like such a bug could easily exist, masked by the fact that most people don't use :omit-source, so they get the newer code loaded from the source file

20:35 hlship: I'm used to Gradle, where it can convince it to tell me what it does in painful detail when I need it

20:36 Lein is more opaque

20:41 I need to take off

20:41 I'll create an empty shell of a project

20:41 so I can share it

20:42 TEttinger: that's an odd error, hlship

20:42 hlship: and see if I can track down where the error lies

22:29 SeaK: I'm trying to make a function that is similar to map (without using map). It needs to take two arguments (first one being the function, second one being the list) and apply the function to the list. Here's what I have: (defn my-map ([func lst] cons(func (rest lst)))) Any pointers, please

22:31 TeslaNick: What's the impetus for not using map?

22:31 mgaare: "prove that you can implement map" probably ;)

22:31 SeaK: you have the right idea, but you have made a number of syntax errors

22:32 justin_smith: SeaK: I assume you mean to apply func, but syntactically you have not

22:32 sorry, cons

22:32 you don't apply cons (func is being applied, to the tail of the list, in just one go)

22:33 SeaK: TelsaNick, for a learning experience. mgaare, I've been trying to use a vim plugin, that assists with the parenthesis, but it's been a nightmare, so just using nano :'(

22:33 mgaare: you also need parens around every expression

22:34 gotta wrap the call to cons in parens

22:34 justin_smith: ,((fn [x] cons (rest x)) [1 2 3]) ; syntactically valid, but probably a mistake

22:34 clojurebot: (2 3)

22:35 justin_smith: in that code, cons is a no-op

22:35 it could be anything

22:35 or not even be there

22:35 ,((fn [x] (rest x)) [1 2 3])

22:35 clojurebot: (2 3)

22:35 mgaare: it's evaluated as itself and then ignored

22:36 this is a right answer: (defn my-map [f xs] (when (seq xs) (cons (f (first xs)) (my-map f (rest xs)))))

22:37 catern: mgaare: aaaah! so cruel!

22:37 mgaare: SeaK: some things you were doing wrong - you were never actually applying f to the first element in the list, and you weren't making the recursive call to the function

22:37 catern: why would you give that away?

22:37 justin_smith: (inc catern)

22:37 lazybot: ⇒ 1

22:37 SeaK: Thanks for help, trying to fix it up atm.

22:38 mgaare: also you need a base case - what happens when there are no more xs left

22:40 catern: (my very first inc, how wonderful)

22:40 mgaare: you're welcome ;)

22:40 justin_smith: mgaare: be glad that wasn't a dec instead

22:41 mgaare: justin_smith: not a dec! that's worth like 100 Schrute Bucks

22:43 justin_smith: since you obviously don't care anyway, may as well

22:43 (dec mgaare)

22:43 lazybot: ⇒ -1

22:44 justin_smith: $karma so

22:44 lazybot: so has karma -32.

22:44 justin_smith: $karma juxt

22:44 lazybot: juxt has karma 12.

22:45 abaranosky: what's new in the Clojure world?

22:45 catern: $karma clojure

22:45 lazybot: clojure has karma 16.

22:45 justin_smith: well, really now

22:45 (inc clojure)

22:45 lazybot: ⇒ 17

22:45 justin_smith: abaranosky: just handing out fiat judgement left and right, mostly

22:46 TEttinger: I wrote a tile connector for someone's tile-based game, he had 160 lines of java and I replaced it with 22

22:46 of clojure

22:47 justin_smith: sounds about right

22:50 abaranosky: justin_smith: what is fiat judgment? sounds fun

22:51 justin_smith: abaranosky: I guess it's the wrong term - I basically just meant casting judgement capreciously about

22:51 *capriciously ... I should stop trying

22:52 abaranosky: trippy

22:53 TEttinger: (inc mgaare)

22:53 lazybot: ⇒ 0

22:54 justin_smith: I have joins and parts hidden, he left?

22:55 TEttinger: mgaare is here

22:56 justin_smith: oh the ) interferes with my client highlighting

23:09 mgaare: I left my job at the clojure startup, and now people are talking about me like I'm not here... this is not my month

23:12 justin_smith: sorry to hear that

23:12 and sorry for the third person talk

23:13 mgaare: scala now, could be worse

23:14 abaranosky: mgaare: what is "the clojrue startup"?

23:15 mgaare: I was at a startup that was primarily working in clojure called clickscape

23:16 swgillespie: mgaare: atlanta?

23:16 * swgillespie is from there

23:16 mgaare: yep

23:24 munderwo: Hi all, is there a better room for clojurescript?

23:25 justin_smith: well, there is #clojurescript, but it is a frequent topic here too

23:26 munderwo: ok cool. i'll ask there first and see if I get any help. thanks!

23:34 Hi all. Im having a bit of trouble getting a clojurescript build to run using om and phantomjs… project.clj here https://www.refheap.com/88902 … the issue is that the test cant find the react symbol when it goes to run tests. Any ideas would be great!

23:36 arohner: munderwo: are you serving react.js in the files that run your tests?

23:39 munderwo: arohner: you mean in some html? or compiled into the final js?

23:40 arohner: munderwo: that part is up to you. But just like your normal app has to deliver react somehow, so do your tests

23:41 it's late here, so I should get off the computer

23:41 night

23:44 munderwo: arohner: night

Logging service provided by n01se.net