#clojure logs

2014-08-04

02:04sveriHi, 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?
02:06dee5if you run `(source clojure.string/join)` you can see it actually dispatches to (apply str ...) if you don't provide a separator
02:08sveridee5: then it even makes less sense for me
02:09pyrtsaI think readability has been the motivation behind that recommendation but I'm not sure I agree with it.
02:10dee5I'd agree with readability, and it also might have room for future optimizations
02:11ambrosebssveri: perhaps it's intended to suggest alternatives to (map #(apply str %) c)
02:20sveriambrosebs: sounds reasonable, I will leave it as it is, using apply str looks better to me
02:20amalloyi don't generally use join if i don't have a separator
03:29meingbgI'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:
03:30meingbgIt seems to be true there is no *__init.class, nor do I believe there should be.
05:17visofhi guys
05:17visofi can't understand what's going on this code https://www.refheap.com/88870
05:18visof,(class {"hello" "world"})
05:18clojurebotclojure.lang.PersistentArrayMap
05:18visof(let [h {"hello" "world"}] (class h))
05:18visof,(let [h {"hello" "world"}] (class h))
05:18clojurebotclojure.lang.PersistentArrayMap
05:18visof,(def h {"hello" "world"})
05:18clojurebot#'sandbox/h
05:18visof,(class h)
05:18clojurebotclojure.lang.PersistentHashMap
05:19visofin the first case the class is Array
05:19visofwhen use def it's a Hash
05:19visofboth the same though
05:20clgvvisof: doesnt matter. that's just an implementation detail
05:20visofclgv: how can check if the value suppplied is a hash in both cases?
05:20clgvvisof: PersistenArrayMap is a performance improvement for small hash maps
05:20clgv,(doc map?)
05:20clojurebot"([x]); Return true if x implements IPersistentMap"
05:21visof,(map? [1])
05:21clojurebotfalse
05:21visof,(map? {})
05:21clojurebottrue
05:21clgvwell that doc string could be better ^^
05:21locksthey're both maps
05:21visof,(map? "")
05:21clojurebotfalse
05:21clgv,(map? h)
05:21clojurebottrue
05:21visofthanks clgv
05:21clgvit checks whether something is a persistent map^^
05:22clgvvisof: for multimethods you can use IPersistentMap I guess
05:22clgvvisof: if you dispatch by class/type
06:18master_ophello, is there any clojure certification ?
06:18AeroNotixI hope not
06:18ucbheh
06:19master_opwhy, i think is a best thing to offer certifications for dev.
06:22nathan7I just laughed for a solid minute, thank you
06:25TEttingermaster_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
06:25clgvmaster_op: you can do paid trainings with the cognitect people - they usually had several events per year
06:26master_opthanks for responses, clgv, i dan't want a training, i just want to be certified, thanks again,
06:26nathan7you don't want to gain proficiency, you just want a worthless piece of paper?
06:26nathan7I think you've just succeeded at proving why certifications are useless.
06:27clgv:P
06:28clgvmaster_op: well than your possibility is to show off some of your projects you built in clojure to "certify yourself" ;)
06:29clgvthose clojure job offerings often ask for fromer interesting projects, e.g. on your github account
06:30master_opnathan7, i'ma already clojure developer, i read many books and have done multiple projects, the certification is a challenge for me
06:30H4nsmaster_op: nobody offers clojure certification because there is no market for that.
06:30irctcHello, dear community. Is it ok to ask on this channel some "functional way" questions? I need a bit of a code review.
06:30nathan7There's a pretty high overlap between people smart enough to do Clojure and people smart enough to figure out certifications are pointless.
06:31master_opclgv, thank you again, i think my account in github is the best certification
06:31clgvmaster_op: great :)
06:31nathan7I have a highly-certified cofounder, and I often get to school him on the subjects he's certified in.
06:32nathan7(bloody Cisco certifications, spreading lies on how networking works)
06:32clgvnathan7: that badly?
06:32nathan7clgv: Certain network configurations I run in production were, according to him, entirely impossible.
06:33clgvnathan7: nice. so you are a network magician :D
06:33nathan7clgv: At the time I was figuring out how to set those up
06:33nathan7clgv: He claimed it was impossible — I had it functioning the next day
06:34nathan7clgv: I derive much of my knowledge of networking from implementation — when I was younger I wrote a full networking stack in Python
06:34nathan7clgv: He'd been told certain configurations were impossible, while they were in fact merely unsupported by Cisco
06:36clgvnathan7: ha well, they only train what they want to sell? who could blame them for that? :P
06:36nathan7clgv: Sure, but they could've told the truth: "we don't support that, and recommend against it"
06:37master_opi think cisco are selling an academic skills
06:37clgvnathan7: yeah true.
06:38nathan7clgv: We were given a loose IP by our provider for a failover configuration, and my cofounder claimed that it was impossible to configure it
06:38nathan7clgv: Even though it'd be rather unlikely for that configuration to be impossible if they sold it
06:38nathan7clgv: but he persevered in believing the Cisco trainings first, almost religiously
06:39clgvnathan7: that's never a good idea - good judgment should always be used ;)
06:39nathan7clgv: Yep
06:39nathan7clgv: The religious zeal is what worries me most — the incorrect knowledge is secondary
06:39clgvdifferent topic: is there a better function available to format clojure code for debugging macroexpansions than "pprint"?
06:41hyPiRionclgv: clojure.walk/macroexpand-all, macroexpand-1 or macroexpand?
06:42nathan7hyPiRion: pprint does /formatting/
06:42nathan7it converts it to a string
06:42nathan7You'd use it after one of the macroexpand functions
06:43clgvhyPiRion: I want to format the output of one of these in a human readable way ;)
06:45clgvah well "fipp" has an easy way to provide params...
06:45hyPiRionclgv: I don't understand then. What do you mean by better? Can you give an example on what you actally want?
06:45nathan7I keep wanting to just write an editor that displays data structures
06:46clgvhyPiRion: better formatting than pprint. Even "fipp" puts let binding in two lines of output :(
06:47hyPiRionclgv: What do you mean by better? And actual example would help
06:49clgvhyPiRion: 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
06:53hyPiRionclgv: I have, but I'm not sure what you mean by "compact human readable" formatting, which is why I ask.
06:55clgvhyPiRion: at a certain number of ident characters pprint just print almost everything on a new line
06:55hyPiRionAs you mentioned, Fipp with some configuration could probably (?) help you with it.
06:55clgvyeah, it helps a little
06:56clgvbut although I adjusted width, there are still several unnecessary linebreaks as in let bindings
06:56hyPiRionclgv: right, so something which still does (let [a something-long *newline* b something-else] ...)
06:57clgvhyPiRion: yeah, or maybe only "symbol value" on one line but not "symbol\nvalue" for every binding no matter how much :width is used
06:58hyPiRionright. Fipp is EDN-only for now, so it cannot handle special forms correctly.
06:59hyPiRionhrm.
07:01clgvhyPiRion: that problem should be the same for all those clojure GUIs/IDEs, but seems none of them made a separte library for it, right?
07:01hyPiRionright, noone's made a variant of gofmt for clojure afaik
07:03clgvbut I think I found my error meanwhile ;)
07:03hyPiRionheh, that would be an interesting yak shave
07:04hyPiRion"implemented clojurefmt because I couldn't debug my macro"
07:05clgvhyPiRion: well that's about the only time you desparately want a function for that available on the REPL, right? ;)
07:10clgvhyPiRion: it's not as epic yak shaving as Knuth with Tex ;)
07:10LauJensenGents - 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?
07:14hyPiRionclgv: heh, yeah :p
07:15vijaykiranLauJensen: Not sure what the problem is - it works for me with 0.6.0alpha
07:16clgvhyPiRion: maybe I should ask laurent to make a lib. I think he did that for paredit already
07:16hyPiRionclgv: I almost wrote a bugfix for a postscript driver because the printer at my university didn't handle my LaTeX pdf properly
07:16hyPiRionclgv: I wouldn't be surprised :p
07:16clgvhyPiRion: hehe. I couldnt print a pdf of a student last year ;)
07:17clgvhyPiRion: that's stupid when you need to correct it ^^
07:17hyPiRionyeah, it's a pain
08:27SagiCZ1,(print "Hello")
08:27clojurebotHello
08:28TEttinger,"Hi"
08:28clojurebot"Hi"
08:36clgv,(pr "Hello")
08:36clojurebot"Hello"
08:36SagiCZ1,(= pr print)
08:36clojurebotfalse
08:37SagiCZ1(doc pr)
08:37clojurebot"([] [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"
08:37clgvno `pr` can beused for serializing clojure data to string
08:37SagiCZ1unlike print?
08:37clgvyes
08:37SagiCZ1clgv: is serializing data to string this way common in clojure as much as in other lisps?
08:38clgv,(type (read-string (pr-str "Hello")))
08:38clojurebotjava.lang.String
08:38clgv,(type (read-string (with-out-str (print "Hello"))))
08:38clojurebotclojure.lang.Symbol
08:38SagiCZ1,(type (read-string "{:a 0 :b 1}"))
08:38clojurebotclojure.lang.PersistentArrayMap
08:39clgvSagiCZ1: depends on your use case, I'd say. but it's mentioned pretty often
08:39SagiCZ1clgv: i see
08:44SagiCZ1does anyone remember the name of the guy who writes the Cursive plugin for IntelliJ?
08:45SagiCZ1got it.. cfleming
08:46cflemingSagiCZ1: that's me :-)
08:47systemfaultHaha, cool.
09:00mpenetis there a project out there that turns prismatic schema ValidationError into someting readable for end users?
09:00Glenjaminschema-humanize is a thing iirc
09:01Glenjaminthis is what i was thinking of https://github.com/cddr/integrity#integrityhuman
09:01mpenetI spotted this one too, wondering if there are others
09:56Mandarhi!
09:57MandarI'm stuck with something basic: how can I make use of for with a higher-order function?
09:57Mandarhttps://www.refheap.com/e703d9f35dee7c4ea41b2df21
09:57MandarI would like to have a function die-combination [n]
09:57Mandarinstead of writing different functions everytime
09:58Mandar(the code is copy pasted from a REPL, die is just (range 1 7) for now
09:58justin_smithMandar: what is "die"
09:59winksingular of dice? :P
09:59justin_smithand why does that code need a list comprehension?
09:59Mandaryeah, or plural I don't know :)
09:59justin_smithwink: I asked because die would be a function, not a function call
09:59Mandarjustin_smith, because I couldn't think of anything better? :)
10:00justin_smithMandar: for expects the input to be a sequence (or sequences) with a name binding each result
10:00Mandarjustin_smith, I'm sure there is a better approach!
10:00TimMc(find-in {:a :b} [:a]) => [[:a] :b]
10:00winkI am mostly unsire where all the variables come from
10:00justin_smithMandar: there is, I just need to know what you are actually trying to do
10:01justin_smithso you want three combinations of three dice?
10:01MandarI'm trying to generate a set of unsorted dice results with n die
10:01SagiCZ1i vote for renaming all dice to "gambling cubes"
10:01Mandarfor instance, with 2 dice, there are 21 unique combinations
10:02Mandarwhen there's no order
10:03Mandar(three-die-combinations) returns the set containing the 56 possible results
10:03Mandar#{(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:04clgvwink: the storks are to blame ;)
10:04justin_smithMandar: ahh, ok, so die is [1 2 3 4 5 6]
10:04Mandaryes I got too tired of typing it in the REPL :)
10:05justin_smithso you want something that generalizes three-die-combinations and four-die-combinations to N-die-combinations
10:05winkSagiCZ1: permission granted
10:05Mandarjustin_smith, exactly
10:06Mandarsorry for my english
10:06clgvMandar: you want a cartesian product of a set with itself in a given number of dimensions?
10:06justin_smithclgv: kind of, but the base element is not a set
10:06justin_smith[1 1 1] would be valid
10:06SagiCZ1wink: :wink
10:06Mandarjustin_smith, yes
10:07edwI 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:07clgvjustin_smith: yeah well same code, the user is to blame if they are not different ;)
10:07hellofunkdoes anyone know the Om syntax for the build-all function for passing a sequence that is nested inside another cursor?
10:08clgvMandar: one way is to build all vectors with one element, then build all vectors with two elements from that, and so on ...
10:08teslanickhellofunk: How do you mean? What's the data structure look like?
10:08hellofunkteslanick unless you use Om it might be hard to explain
10:09teslanickI do, which is why I asked.
10:09Mandarclgv, so there's just no way to use the function I have and make it work with a higher number of elements?
10:09MandarI could do it with a macro, but it would not be pretty
10:09clgvMandar: no, that's because `for` is a macro
10:09hellofunkteslanick if app state is (atom {:a {:b [1 2 3]}}) how to I pass the [1 2 3] to build-all?
10:10clgvMandar: that's probably not a good idea ;)
10:10teslanickhellofunk: I'm assuming that your component holds a cursor that's a deref of the atom, yes?
10:10Mandarclgv, good
10:10winkclgv: i got sidetracked in reading, but as they are alternating can't you work with that?
10:11hellofunkteslanick the component which calls build-all has a cursor to the root app-state yes
10:11teslanickPretty sure you can just do: (build-all child-component (get-in data [:a :b ]))
10:12hellofunkteslanick i get tons of error when i try that, i will hunt them and see if they are due to that
10:12clgvMandar: you can easily build the desired set recursively as I outlined above
10:12edwAnswer: too many brackets.
10:13Mandarclgv, yes, I just need to think a little about it
10:13MandarI thought there might be a function I don't know
10:13Mandar(I'm still a beginner, of course)
10:13teslanickhellofunk: Om cursors implement PersistentMap and PersistentVector, so it may be a problem with your data format rather than the manipulation of that data.
10:14teslanickWhat's the error, anyway?
10:15hellofunkteslanick 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:15teslanickInside a render function you can always treat a cursor like a map
10:15teslanickOutside the render function you have to deref it
10:15teslanickSee: https://github.com/swannodette/om/wiki/Cursors
10:16hellofunkteslanick what if you call a function inside your render fn and pass the cursor? do you deref it in the called fn?
10:16teslanickNo. As long as the fn is executed synchronously, it's still part of the render cycle.
10:17clgvMandar: you could use `iterate` for a sequence of results of the desired sets for arbitrary many dice rolls
10:18teslanickA good rule of thumb about cursors: treat them like a map until Om complains about accessing a cursor outside the render cycle. ;)
10:18hellofunkteslanic 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:20teslanickYou should be able to map over a cursor to get sub-cursors. I could see some possible gotchas there.
10:20teslanick*get a list of sub-cursors.
10:21hellofunkteslanick 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:24teslanickI think you're worrying too much about stumbling into something you can't do than trying something to see what happens.
10:25justin_smithMandar: https://www.refheap.com/88878 not guaranteed perfect, but I think it is about right
10:25teslanickIn 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:25teslanick(at least, I see no reason why you couldn't)
10:26Mandarjustin_smith,clgv, thank you
10:28Mandarjustin_smith, I don't get the base argument, it looks like an accumulator
10:28hellofunkteslanick that's interesting. i thought the "sequence" had to actually be defined in the app state wholly itself, i guess not
10:28justin_smithMandar: yes, I named it badly, it is an accumulator
10:29justin_smithsq is actually that basis, sorry
10:30justin_smithMandar: 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:30justin_smithMandar: which means of course that you can do arbitrary recursion by turning it back into map again
10:31justin_smith(and arbitrary recursion being a way to get N iterations of cartesian expanseion)
10:32teslanickhellofunk: 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:34justin_smithMandar: updated with better names, and using recur instead of self call https://www.refheap.com/88878
10:34teslanickA 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:34teslanickI'm sure there are wrong details that dnolen will note, but that's the high-level.
10:35Mandarjustin_smith, thank you, I'm trying to add a call to sort the list to only get unique items
10:35Mandarhelps me understand it better
10:36hellofunkteslanick thanks i'll give it all a try and see what happens.
10:36justin_smithMandar: so you would consider [1 1 0] and [0 1 1] the same?
10:36Mandaryes
10:37justin_smithso you are not interested per se in the relative probability of a given sum, but rather in the variety of sums possible
10:37justin_smithor s/sum/combination even
10:37Mandarjustin_smith yes exactly
10:37teslanickThe 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:38justin_smithMandar: best of both worlds: (group-by sort (cartesian [1 2 3 4 5 6] 3))
10:39justin_smiththe keys of that map tell you all possible triples
10:39justin_smiththe count of each val tells you it's relative probability
10:40Mandarthanks, it's really impressive
10:41MandarI think that's the harder part for me: understanding exactly where I am in the collection when not iterating explicitely
11:27arrdem(let [{:keys [ox/static?]} {:ox/static? true}] ox/static?)
11:28arrdemoops. #clojure is not a repl.
11:28Glenjamini think you can drop the namespace in some bits of that
11:28Glenjamin,(let [{:keys [ox/static?]} {:ox/static? true}] static?)
11:28clojurebottrue
11:30gfredericks,(let [{:keys [:foo]} {:foo 12}] foo)
11:30clojurebot12
12:04blunteGiven 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:06justin_smithblunte: so given the constructor function, get the class it constructs?
12:06gfredericks,(defrecord HooHa [])
12:06clojurebotsandbox.HooHa
12:06gfredericks,->HooHa
12:06clojurebot#<sandbox$eval26$__GT_HooHa__35 sandbox$eval26$__GT_HooHa__35@1882760>
12:07gfredericksyou'd have to unmunge something eh; much easier if you have the var
12:07gfredericks,#'->HooHa
12:07clojurebot#'sandbox/->HooHa
12:07blunteI 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:08blunte(defn read-and-make-rec [line fn-create-rec] ...)
12:09blunteI could pass the field count in, but I was hoping to avoid more parameters than I need
12:09blunte(tethered to phone on train, so if I go absent thanks for the replies)
12:10scottj,(doc ->HooHa)
12:10clojurebot"([]); Positional factory function for class sandbox.HooHa."
12:13justin_smithblunte: I had thought that you could do (apply ->MyRec (repeat nil)) and then count its keys, but that locks up sadly
12:13bluntewhoops!
12:13justin_smithahh!
12:13Glenjamin,(count (map->HooHa {}))
12:13clojurebot0
12:13Glenjamin,(defrecord Stuff [a b])
12:13clojurebotsandbox.Stuff
12:14Glenjamin,(count (map->Stuff {}))
12:14clojurebot2
12:14justin_smith,(:arglists #'map->HooHa)
12:14blunteohh
12:14clojurebotnil
12:14justin_smith,(:arglists (meta #'map->HooHa))
12:14clojurebot([m__5869__auto__])
12:14Glenjaminjust count keys on an empty one :)
12:14justin_smithor check the arglists - then you don't even have to make one
12:15justin_smith,(:arglists (meta #'->Stuff))
12:15clojurebot([a b])
12:15TimMcjustin_smith: THen you need the var.
12:15justin_smithahh, yeah
12:15justin_smithgood point
12:15bluntethe issue is, I don't know my Record in the function. I just have a create function ->R
12:15justin_smithright, and you don't have the function's var so you can't check the arglist
12:16mmitchel_does anyone know how to have "lein ring server" listen on a host other than "localhost"?
12:16TimMcReflection?
12:16bluntewhile 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:16justin_smithblunte: so if you took map->MyRec instead of ->MyRec as an arg, you could count the keys of the result of applying to {}
12:16bluntejustin_smith: I see, I could probably get away with that
12:17justin_smiththat would also do the automatic nils for non-supplied keys
12:17bluntewell then!
12:17bluntesuper, thanks as always
12:18justin_smith(inc Glenjamin)
12:18blunteahh indeed, sorry :)
12:18justin_smithfor the idea of using the map->MyRec version
12:18justin_smithseems lazybot is so lazy he is not even logged in
12:19bluntehehe. ok, disconnecting. I was so desperate I used my limited phone data to get on here ;)
12:20TimMc(count (:params (first (filter #(= (:name %) "invoke") (org.timmc.handy.reflect/methods (class ->Foo)))))) ;;= 2
12:20TimMc(this is not guaranteed to work against future Clojure versions since more invoke methods could be added)
12:32michaelr525hmm
12:33michaelr525so 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:34michaelr525call (om/build) from the onClick handler of the button doesn't seem to work
12:34michaelr525how should approach this correctly with Om?
12:34michaelr525I
12:35michaelr525I'd like to use that component for creating a new item and editing existing items
12:35michaelr525The usual CRUD stuff
12:38michaelr525hum hum
12:38hellofunkmichaelr525 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:38hellofunkand better if use a async chan in onClick to queue up the state change, even better in most cases
12:38michaelr525hum hum
12:40michaelr525hellofunk: 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:41michaelr525or I think I get it, I'll pass the data in the conditional build call
12:41michaelr525right?
12:58edwIs 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:01stuartsierra,(partition 3 1 [:a :b :c :d :e :f])
13:01clojurebot((:a :b :c) (:b :c :d) (:c :d :e) (:d :e :f))
13:04edwstuartsierra: That's not quite what I was thinking. More like this: https://www.refheap.com/88882
13:04edwstuartsierra: Your solution would work by wrapping the col with a couple nils.
13:15justin_smithedw: 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:16justin_smithone on each end seems arbitrary to me I guess
13:16edwjustin_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:17justin_smithedw: ahh, ok
13:17justin_smithif it were dsp style windowing, it would make sense to have n-1 empty inputs to define a window
13:17justin_smithor, padding to fit a fixed width
13:17stuartsierraedw: adding the Nils might work better as a separate step then, then you can use partition.
13:19edwjustin_smith: Good feedback. I am, of all things, a graph paper layout app.
13:21edwjustin_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:22edwWhich gets me thinking about this: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
13:25TimMcedw: For a graph papr layout app you speak pretty good English.
13:25edwTimMc: Verbs, who them?
13:26justin_smith(inc TimMc)
13:40jazzitIs 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:45ToBeReplacedi'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:46dnolen_jazzit: weasel has stale declared dependencies - esp. if you are using a newer release of ClojureScript
13:47jazzitdnolen_: 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:47jazzitdnolen_: (New to Clojure)
13:47dnolen_jazzit: I don't use weasel so I can't say anything about it
13:48jazzitdnolen_: OK. What's a good alternative for a browser repl?
13:49dnolen_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:49hiredmangiven up on?
13:49jazzitdnolen_: Really. I got the impression Emacs was the Holy Grail of Lisp/Clojure development.
13:50hiredmandnolen_: that implies you were waiting for something and got tired of waiting, so I am curious as to what that was?
13:50dnolen_jazzit: I use Cursive for actual interactive dev now - I'm tired of the Emacs stuff changing
13:51dnolen_hiredman: I still use Emacs mostly - just not for REPL driven Clojure stuff.
13:51jazzitdnolen_: Is Cursive an editor?
13:51dnolen_debug REPL is also a big draw
13:51dnolen_jazzit: plugin for IntelliJ
13:52dnolen_jazzit: and I can make it work mostly like Emacs, lots of small annoyances but whatever the overall experience is better
13:52AeroNotixdnolen_: what do you mean "emacs stuff changing" ?
13:52jazzitdnolen_> jazzit: and I can make it work mostly like Emacs, lots of small annoyances but whatever the overall experience is better
13:53dnolen_AeroNotix: cider randomly breaking, cider dev dependency
13:53AeroNotixdnolen_: I'm not sure I follow. Do you update often?
13:53dnolen_which isn't to say I don't appreciate all the work going on in cider
13:53dnolen_AeroNotix: yes and I expect it to not break
13:53jazzitdnolen_: So the whole Emacs live editing thing is just hype?
13:53ToBeReplacedmdrogalis: have you worked on anything substantial using robert-hooke for purposes other than exception handling (ex. logging, caching)? how'd it go?
13:53dnolen_just don't want to fiddle w/ it anymore
13:53AeroNotixdnolen_: What are you upgrading for?
13:53AeroNotixdnolen_: honest question
13:53hiredmanbasically, 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:53dnolen_AeroNotix: I just keep my packages up to date, I like enhancements
13:54mdrogalisToBeReplaced: Logging - yes.
13:54AeroNotixdnolen_: sure, but CIDER isn't 1.0 software yet, afaik
13:54dnolen_AeroNotix: neither is Cursive
13:54mdrogalisI have a layer of logging over an API that 100% separates logging from API calls
13:54hiredmandnolen_: upgrading is a mistake :)
13:54dnolen_anyways, use what works for you :)
13:54jazzithiredman: Quite an eye-opener.
13:54dnolen_jazzit: Emacs live editing isn't hype
13:54AeroNotixdnolen_: sure, I'm just saying that I don't have those problems ( and I update once a week as well )
13:54dnolen_jazzit: live editing period is good stuff
13:55AeroNotixdnolen_: btw are you on a mac?
13:55jazzitdnolen_> jazzit: Emacs live editing isn't hype
13:55dnolen_AeroNotix: yes
13:55AeroNotixdnolen_: I've had co-workers have trouble initially setting CIDER up on a mac
13:55hiredmanjazzit: 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:55ToBeReplacedmdrogalis: 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:55jazzitdnolen_: OK, I meant not so good for Clojure
13:55Bronsaswank-clojure still works like a charm.
13:56hiredmanBronsa: with a new versions of slime?
13:56Bronsahiredman: no, I'm using a 2009 version
13:56mdrogalisToBeReplaced: 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:56mdrogalisToBeReplaced: You'll have a pretty good time I think. I have been, anyway.
13:56ToBeReplacedmdrogalis: 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:57dnolen_jazzit: in general it's probably fine for Clojure
13:57ToBeReplacedah cool, thanks for the help; i'll peek around
13:57mdrogalisToBeReplaced: 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:57mdrogalisToBeReplaced: Sure thing.
13:57dnolen_jazzit: but REPL support for ClojureScript is still subpar all around - hopefully this will change - weasel seems like a good start
13:57jazzithiredman: dnolen_: Sorry, I meant Clojurescript
13:58jazzitdnolen_: I had weasel working a few days ago but some upgrade must have borked it.
13:58jazzitdnolen_: It was very nice to work with.
13:59dnolen_jazzit: then I recommend pinging the maintainer, I can't imagine that it would be tough to bump the dependencies
13:59jazzitdnolen_: OK, will do.
14:01itruslovejazzit: 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:01itruslovejazzit: https://github.com/iantruslove/clojurescript-mode
14:18justin_smithI 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:18justin_smithhttps://sympa.inria.fr/sympa/arc/caml-list/2014-08/msg00012.html
14:22hiredmanI don't think clojure's sets are red-black trees
14:22hiredmanthe sorted ones might be
14:24justin_smithoh, ok
14:25hiredmanjust glancing at the email it sort of looks like it may discuss some implementation details from some specific implementations
14:25hyPiRionyeah, they are hash sets
14:25amalloythe sorted ones are
14:26justin_smiththe regular set delegates to persistenthashmap
14:29hiredmanwhich 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:29hiredmanbah, bad connection
14:29hiredmanI just don't think that email can be used as evidence
14:29justin_smithhiredman: 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:36hiredman
14:40hiredmanthe feature expression stuff makes me so sad
14:41hiredmaneveryone is so eager for something lifted from common lisp, completely ignoring the downsides to doing that stuff in the reader
14:42solussdhiredman: what are the downsides?
14:42hiredmanI get that it is easy to do in the reader, but it makes the reader much less useful for analysis
14:43hiredmansolussd: by resolving them in the reader I cannot write a tool based on the reader that can inspect/analyze them
14:43solussdah
14:43solussdI hadn’t considered that.
14:44turbofaili like scheme's cond-expand construct
14:44turbofailfor this purpose
14:45justin_smithhiredman: 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:45turbofaili think i implemented a version of it at some point for clojure
14:45justin_smith*be absurd
14:45hiredmanjustin_smith: yes
14:45hiredmana terrible hack to get around a wrong headed feature
14:45technomancyI'm not sure how I feel about disqualifying things based on their being absurd
14:45hiredmanwith some slight amount of foresite that could be completely avoided
14:46technomancyembracing absurdity is part of what makes us human
14:46hiredmanif you have ever tried to do tooling for language where the official parser throws data way or does partial evaluation it is terrible
14:47hiredmanresolving stuff like this at read time in the reader is equivalent
14:56meingbgSo what's up with forward definitions? Isn't that a little bit 1970's style?
14:57justin_smithhell, sexps are kinda '50s style
14:57hiredmanit makes the compiler simpler and helps unify the experience loading code in a repl and loading it from a file
14:58hiredmanand given the dynamic typing it helps catch things like defined names faster
14:58hiredmanundefined
14:59meingbghiredman: So do you think it's on purpose, or just because the compiler implementor didn't get around it yet?
14:59hiredmanit is on purpose
15:00hiredmanif 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:01stuartsierrameingbg: some background from Rich Hickey on compilation units here https://news.ycombinator.com/item?id=2467359
15:01meingbgI 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:03llasrammeingbg: 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:03llasrammeingbg: So my experience is that you get completely used to it and you stop even thinking about it
15:04llasramhiredman: Has there been some recent secret discussion of feature expressions I'd missed?
15:04amalloy(inc llasram)
15:04amalloyc'mon lazybot
15:04llasramer, lazybot even
15:05hiredmanllasram: puredanger added a patch or something that made it show up in my rss reader and triggered me
15:06puredangerI am working on a consistent set of patches for evaluation right now
15:06meingbgllasram: 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:07justin_smithmeingbg: one thing that reduces the pain for me is the fact that declare is multi-arity
15:07justin_smith(declare a b c d e ...)
15:07hiredmanpuredanger: common lisp's mechanism is such a wart, and makes the reader much less useful for tooling
15:07puredangerI understand your concerns
15:07meingbgjustin_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:08hiredmanpuredanger: so do you think it isn't an issue? is there some overriding plus to doing it in the reader?
15:08llasrammeingbg: You could write a wrapper macro enclosing all of the definitions which first forward-declares them
15:09puredangerhiredman: I'm just trying to get a consistent set of patches to evaluate
15:09llasramSince you have specific reason for putting them in a non-standard order, it doesn't seem like an entirely insane idea :-)
15:09puredangerhiredman: I'm not magically blessing anything
15:09meingbgllasram: True. Unless that interferes with my editor, when there is suddenly only one top-level form.
15:10puredangerhiredman: I think cljx has demonstrated utility in the approach. there are also unresolved issues.
15:10sveriHi, How can I make marginalia work with my clojurescript sources? Adding src-cljs to the :src option in leiningen was not enough
15:11hiredmanmeingbg: 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:12hiredmanthe sort of modeling layer between the language and the spec/paper/etc gives you a lot of flexibility
15:12meingbgllasram: You're probably right. I should just appreciate the ability to bend lisp in special cases like this.
15:12Bronsahiredman: I honestly don't see how an approach that doesn't operate at read-time could work given macros
15:13michaelr525hey
15:15meingbghiredman: 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:15hiredmanBronsa: http://srfi.schemers.org/srfi-0/srfi-0.html seems pretty reasonable
15:16hiredmanBronsa: another possiblity would be to add feature-expression expansion as a stage before macroexpansion
15:17hiredman(which would mean macros could not emit feature-expressions, which I am fine with)
15:21Bronsahiredman: 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:23hiredmanI hadn't seen cond-expand until turbofail mentioned it
15:24hiredmancond-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:27Bronsahiredman: 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:27hiredmanBronsa: sure
15:40SagiCZ1.
15:52jdkealyhow can i make "or" queries in datomic ?
15:53puredangerrules
15:55puredangerjdkealy: see http://docs.datomic.com/query.html and search for the "social-media" rule for an example
15:55jdkealythanks!
15:58jdkealycan you make "rules" inline or do you have to reference them like this ?
15:58puredangernot inline
15:59jdkealyso in clojure i make a rule as a function ? defn rule[p1 p2 p3 p4] ?
16:02jgtso… Did I find a bug in Clojure? Or am I just stupid?
16:02jgthttp://stackoverflow.com/questions/25126368/seemingly-magical-behaviour-in-my-clojure-repl
16:04amalloyjgt: your ref contains the class PersistentQueue, not an instance of that class
16:04stuartsierrajgt: and `concat` returns a lazy sequence, it doesn't work on queues the way you think
16:04amalloyall the stuff you do after that is just a big pile of undefined behavior, probably
16:06jgtthat shit cray
16:10stuartsierrajgt: laziness, errors, and undefined behavior; http://stackoverflow.com/questions/25126368/seemingly-magical-behaviour-in-my-clojure-repl/25126712#25126712
16:12stuartsierraGarbage in, garbage out.
16:21zoldar_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:31dnolen_zoldar: it appears you are using advanced compilation as the default - that's always going to be slow
16:32amalloyi'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:32dnolen_zoldar: for the best performance I would figure out how to make :none work for you
16:37zoldardnolen_: :whitespace equals to advanced? please have a look at profiles.clj
16:38zoldardnolen_: :dev profile merged with base from project.clj is default, effective one
16:40jgtPuh
16:41jgtnow I get “parameter declaration do should be a vector”
16:41jgton line 24
16:41dnolen_zoldar: even whitespace is slow w/ source maps
16:41dnolen_zoldar: the only thing that is fast w/ source maps is :none
16:42jgtanyone see the problem? https://gist.github.com/jezen/33550ae8fac8df1eb2e4
16:42zoldardnolen_: just noticed, switched to none and it's blazingly fast again. thanks for pointer
16:43dnolen_zoldar: the problem with the concatenated modes is that we need to merge 2 source maps - no way to speed that up
16:44iwilligjgt: you are missing the function vector args on 24
16:44iwilligafter open-for-business you should have []
16:44jgtahhh
16:44iwilliglike this
16:44iwillighttps://gist.github.com/iwillig/864bcf3c93a9815ef3d2#file-gistfile1-clj-L26
16:44jgtbut that’s on line 26
16:45iwilligerr sorry yeah line 26
16:45jgtno no, you only said 24 because *I* said 24
16:45jgtand I said 24 because that’s what the compiler told me
16:46jgtI wish the compiler weren’t so misleading
16:47dnolen_jgt: what environment are you using and did you use incremental eval or did you compile the whole file?
16:47jgtdnolen_: Just doing `lein run`
16:47jgtthere isn’t much literature out there that holds your hand while doing Clojure
16:47jgtor rather, Clojure workflow
16:48jgtI missed the brackets because I was thinking of doing something like (def open-for-business #((do …)))
16:48jgtthough I’m not sure if Clojure works like that
16:48dnolen_jgt: hrm usually the line numbers are pretty accurate
16:48dnolen_jgt: that won't work
16:49jgtdnolen_: I guess I haven’t understood the anonymous function macro
16:49zoldaroh crap, austin seems not playing well with :none optimisations mode :(
16:50dnolen_zoldar: yeah sorry can't helper there, I know nothing about austin
16:51zoldardnolen_: thanks for clarifying though
16:51jgtI fixed the vector args syntax error
16:52jgtand also fixed line 15 where I’m trying to count a reference
16:52jgtbut now when I do `lein run` it just sits and does nothing
16:52jgtmaybe it compiled and is just running endlessly
16:52jgtI don’t know
16:53dnolen_jgt: you are in an infinite loop at the bottom at line 41
16:53dnolen_you will never reach lines 46 and on
16:53jgtah…
16:53jgtright you are
16:55jgtI think I have to start my loops after the shop has opened
16:55amalloyso 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:57SagiCZ1,(time (doall (list* 0 1 2 3 4 (concat '(5) '(6)))))
16:57clojurebot"Elapsed time: 0.085463 msecs"\n(0 1 2 3 4 ...)
16:57SagiCZ1,(time (doall (concat (list* 0 1 2 3 4 '(5)) '(6))))
16:57clojurebot"Elapsed time: 0.07163 msecs"\n(0 1 2 3 4 ...)
16:58SagiCZ1not really
16:58amalloySagiCZ1: 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:01amalloyanyway, 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:05michaelr525om stuff beginning to work (a tear of happiness ;)
17:06michaelr525hehe
17:06jgtI have been shuffling things around
17:06jgttried to stick my loops in functions
17:07jgtsomething is still looping infinitely
17:07jgthttps://gist.github.com/jezen/22f23e394a90c4dc56d8
17:07jgtcan anyone spot it?
17:09justin_smithjgt: you have two loops that check @shop-is-open, and you run both synchronously before you set shop-is-open false
17:09justin_smithmaybe you want to run monitor-waiting-room and send-customers-from-street in threads?
17:09jgtyeah maybe
17:09jgtdo I stick them in futures? Excuse my noobiness
17:09justin_smithotherwise, the first one you run is just going to run infinitely
17:10justin_smitha future is the easy way, yeah
17:10justin_smithalso, monitor-waiting-room is going to sit there and eat CPU when you don't have anything in @waiting-customers
17:11justin_smithand because you do the cut-hair outside the dosync, one customer could get two haircuts
17:11jgtIT WORKS
17:11jgtahhh, I don’t care
17:11jgtit’ll do for now
17:12jgtI can come back and learn Clojure a bit harder
17:12jgtone day
17:12justin_smithOK, just saying, since the point of refs is coordination that prevents such conditions :)
17:12jgtthanks for your help :)
17:12pandeiroanyone working with h2? does it really not give you back a proper record from jdbc/insert! or am i missing something?
17:13justin_smithjgt: also, your usages of do outside if are redundant (all of them unless I missed any)
17:13jgtjustin_smith: I don’t think I have any?
17:13jgtunless (dosync) counts as a do
17:14justin_smithinside your defns
17:14justin_smithcut-hair
17:14justin_smithsend-customers-from-street
17:14justin_smithopen-for-business
17:14justin_smithall have unneeded do blocks
17:14justin_smithdefn and while have implicit do already
17:14jgtah, ok
17:15justin_smiththough it is needed in if (since the second line with become an else otherwise
17:15justin_smith)
17:15jgtyeah, I understood that
17:15jgtnow it’s a bit clearer
17:15jgtthanks
17:15turbofailthat said in both of those cases you could replace if with when
17:15justin_smithand then eliminate do entirely, nice
17:16turbofailer, that one case i mean
17:16gfrederickstechnomancy: do you object in principle to `lein vcs tag` having some way to opt-out of signing the tag?
17:21technomancygfredericks: no, it just hadn't occured to me
17:21technomancyoccurred
17:24technomancysomeone had an xargs trick the other day to let you grep all your deps
17:24AeroNotixgrep yo' deps baby
17:25amalloyi think it was alandipert, technomancy
17:26gfredericksI'm assuming that xargs comment was unrelated
17:26amalloyyeah. <alandipert> amalloy, lein cp | tr : '\n' | grep 'jar$' | xargs grep -R 'System/exit'
17:26technomancyamalloy: thanks!
17:27gfredericksif I knew 10% more bash stuff I could do 2x more things
17:30technomancyhuh... that doesn't actually work for me
17:32amalloyi'm surprised `tr : '\n'` works - i would have expected to need $'\n'
17:32hiredmanyou may need to use zgrep
17:33technomancyhiredman: that's what I thought too, but no dice
17:33hiredmanoh
17:33technomancyoh, zgrep is for gz, not regular zip
17:33hiredmanright
17:33hiredmanand for single files
17:34hiredmannot an archive of multiple files
17:34gfrederickstechnomancy: keeping backwards compatibility on the tagging thing is tricky though :/
17:35arohneris there anything around cljsbuild for sha1'ing compiled files, so they can be easily served with long cache-control headers?
17:51tickingdnolen_: is providing multiple namespaces within the same vector to cljs.closure/build ok or a big no no? It seems to work.
17:51dnolen_ticking: supposed to work far as I know
17:52tickingdnolen_: great :D thanks!
18:11technomancypaging gfredericks http://davidmalki.tumblr.com/post/93643917408/sometimes-you-have-an-idea-in-the-shower-and-you
18:13TeslaNickWhen 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:13amalloyTeslaNick: usually ##(doc into)
18:13TeslaNick(into {} key-values) perhaps?
18:13lazybot⇒ "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
18:13amalloy&(into {} (for [x (range 5)] [x :default]))
18:13lazybot⇒ {0 :default, 1 :default, 2 :default, 3 :default, 4 :default}
18:15TeslaNickWould I not then need to partition the list into vecs first?
18:16TeslaNickIt doesn't like &(into {} '(:a 10 :b 20))
18:17TeslaNicknor (into {} '((:a 10) (:b 20)))
18:18amalloyTeslaNick: 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:19amalloyor i suppose ##(reduce (partial apply assoc) {} '((a 10) (b 20))) works too, but seems tacky
18:19lazybot⇒ {b 20, a 10}
18:19TeslaNickI'm trying to write a function in the style of assoc. So (assoc m :key val :key2 val2)
18:20justin_smithTeslaNick: isn't that basically hash-map?
18:20TeslaNickYes. My original question is, should I use hash-map, array-map, or something else I haven't found?
18:21TeslaNickI'm not sure what the difference between those to fns are aside from internal representation
18:21justin_smitharray-map is what {} uses for smaller key counts
18:21justin_smithit gets promoted to hash-map automatically at larger sizes
18:21puredanger<= 8 map entries
18:22dnolen_TeslaNick: there's little reason to use array-map directly
18:23TeslaNickExactly what I wanted to know
19:08s2ky, youtube.com/skywayinc
19:08clojurebot#<CompilerException java.lang.ClassNotFoundException: youtube.com, compiling:(NO_SOURCE_PATH:0:0)>
19:11tufti always find that odd. there's this great map adt, but the only abstract constructor is (into {})
19:20amalloythat spam url looks remarkably clojurey
19:20justin_smithhah, I didn't even recognize it as a spam url at first
19:21amalloyclojurebot was even more duped than you were
19:34schmeeI'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:34schmeehow can I extract the links?
19:35schmee(html/select page [:a.similar-artist :href]) doesn't do the trick, and I tried a bunch of variations on that theme...
19:36hiredman:href there is an attribute
19:36ben_vulpeshey has anyone done any work to integrate clojure type hinting into emacs?
19:36hiredman[:a.foo] is the tag a with the css class foo
19:36ben_vulpes(that is to say cider/nrepl/swank...)
19:37hiredmanI would just tack on a map of (comp :href :attrs)
19:39schmeehiredman: ahh, so there's no better way to write the select thing to get the result directly?
19:40schmeethe comp thing worked beautifully btw, thanks!
19:41hiredmanschmee: 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:42amalloyben_vulpes: integrate it? what would that mean?
19:46ben_vulpesamalloy: 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:47amalloyben_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:48amalloyalso, it's called the minibuffer
19:49ben_vulpeshm, i don't see any difference after (set *print-meta* true)
19:49hiredman!
19:50amalloywho knows what works in latest cider. it works in my four-year-old swank/slime setup
19:52ben_vulpes*sigh* cider *sigh*
19:52ben_vulpes<-- emacs noob
19:52amalloyi 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:52mgaareschmee: look at html/attr-values
19:53hiredmanamalloy: you say that...
19:53amalloyif optimism is wrong i don't wanna be right
19:55hiredmanwell, 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:06tsantosClojureScript 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:06tsantos((node/require “stripe”) “sk_test_iedoworpdjpdjsqooej”) doesn’t work.
20:09gfrederickstsantos: looks fine to me
20:09tsantosI get this:
20:09tsantos(function (exports, require, module, __filename, __dirname) {
20:09tsantos^
20:09tsantosRangeError: Maximum call stack size exceeded
20:11hlshipI'm having a bit of "hair on fire" with Lein w/ uberjar vs. other profiles
20:11hlshipI have a single code base
20:12hlshipI want to generate Uberjars for different entry points
20:12hlshiplets call them "client" and "server"
20:12hlshipEverything works *except* that lein uberjar
20:12hlshipdoesn't seem to recompile .class files if they are present
20:12hlshiponly after a clean
20:13SegFaultAXHave the underlying clj files changed?
20:13hlshipyes
20:13hlshipworking on a gist ..
20:13gfrederickstechnomancy: thxman
20:13gfrederickstechnomancy: I believe his selection to be artificial
20:14hlshiphttps://gist.github.com/hlship/96e6d6b8dc4a5e752028
20:15hiredmanhlship: why do you think it should recompile .class files?
20:15hlshipI've tried a lot of variations w/ the :aot field, and where it goes (top level, inside :uberjar pofile, inside :client profile)
20:15hlship@hiredman - because I've changed the .clj source files
20:15hlshipthen `lein with-profile client uberjar`
20:15SegFaultAXhlship: So to be clear, this has nothing to do with the different entry points, right?
20:15hiredmanhlship: well, that gist doesn't show that
20:15SegFaultAXYou're just seeing some weirdness with the build?
20:16hlshipLooks like the problem is that I'm AOT compiling but also :omit-source true
20:16hlshipI get the correct behavior when I remove that line
20:16hlshipso it feels like if you omit source, it is defeating the check to see if compilation should occur?
20:17hiredmanhlship: well, what you may be seeing is the runtime choosing to load the source instead of the compiled class
20:17hiredman(which it does in some cases)
20:17hlshipvery true
20:18hlshipThough I'm not sure
20:18hlshipsince I'm checking results using
20:18hlship"java -jar target/client-0.1.0-standalone.jar"
20:18hiredmansure
20:18hlshipwhich is a :gen-class
20:18hlshipwhich is a :gen-class
20:18hiredmanbut 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:19hlshipthat's true and hard to check
20:19hiredmanyep
20:19SegFaultAXI suppose you could manually unpack, change, and repack the jar.
20:19SegFaultAXSince it's just a zip file.
20:19justin_smithhlship: why not use an environment variable or system property on the target machine to dispatch the main function to run?
20:19hiredmanhlship: but it is still not clear to me why you expect the class files to be regenerated when you use different profiles
20:20SegFaultAXOr even just a command line option.
20:20SegFaultAXhiredman: I think the question about multiple entry points was a red herring.
20:20hiredmanhlship: are you generating with one profile, changing source, then generating with another? project.clj doesn't count as source
20:20hlship@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:20hlshipNope, I'm chaning my client.main source file, changing the -main function there.
20:21SegFaultAXSo you create an uberjar, then edit the source, then create another uberjar, and the second uberjar doesn't reflect your changes?
20:23hiredmanwell 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:24hiredmanlein uberjar && touch src/whatever && lein uberjar
20:24hlship@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:25hlshipit is confused by :omit-source, when I turned that on, it reverted to several iterations back when I ran the client
20:25hlshipmeaning, I think, that it reverted back to a much older version of the .class file
20:25SegFaultAXhlship: 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:25hlshipthat was obscured, as @hiredman said, by the packaging of newer source
20:26SegFaultAXhlship: 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:26hiredmanhlship: do you have any kind of circular maven dependencies or something?
20:26hlshipnot that I know of
20:27hlshipI'm very careful with my dependencies
20:27hiredmanhlship: or if you aot everything regularly, you may be getting old transitively aot'ed code in the jar
20:28SegFaultAXhlship: Cleaning before uberjaring fixes the issue? What version of lein are you running?
20:28hlship2.3.4
20:28SegFaultAXAnd cleaning fixes it?
20:29hlshipSegFaultAX: checking ...
20:30hlshipI've been thrashing on my project.clj, here's where it currently stands:
20:30hlshiphttps://gist.github.com/hlship/60d3cc37bb7766f62146
20:30hlshipI removed the profile stuff,
20:30hlship1st execution: https://gist.github.com/hlship/419e9ca3c7de27641dd1
20:31hlshipchange fan.auth.main
20:31hlshipSecond execution: https://gist.github.com/hlship/aee6dd5ef047962c364e
20:32hlshipno sign of AOT compilation, old behavior holds (should print ""Startup 6")
20:32SegFaultAXAnd what did you do in the middle?
20:32SegFaultAXTouched the -main fn to prn something new?
20:32hlshipyes
20:33hlshipNothing tricky: https://gist.github.com/hlship/93908ea3ed11aab54d91
20:34hiredmanit 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:35hlshipI'm used to Gradle, where it can convince it to tell me what it does in painful detail when I need it
20:36hlshipLein is more opaque
20:41hlshipI need to take off
20:41hlshipI'll create an empty shell of a project
20:41hlshipso I can share it
20:42TEttingerthat's an odd error, hlship
20:42hlshipand see if I can track down where the error lies
22:29SeaKI'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:31TeslaNickWhat's the impetus for not using map?
22:31mgaare"prove that you can implement map" probably ;)
22:31mgaareSeaK: you have the right idea, but you have made a number of syntax errors
22:32justin_smithSeaK: I assume you mean to apply func, but syntactically you have not
22:32justin_smithsorry, cons
22:32justin_smithyou don't apply cons (func is being applied, to the tail of the list, in just one go)
22:33SeaKTelsaNick, 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:33mgaareyou also need parens around every expression
22:34mgaaregotta wrap the call to cons in parens
22:34justin_smith,((fn [x] cons (rest x)) [1 2 3]) ; syntactically valid, but probably a mistake
22:34clojurebot(2 3)
22:35justin_smithin that code, cons is a no-op
22:35justin_smithit could be anything
22:35justin_smithor not even be there
22:35justin_smith,((fn [x] (rest x)) [1 2 3])
22:35clojurebot(2 3)
22:35mgaareit's evaluated as itself and then ignored
22:36mgaarethis is a right answer: (defn my-map [f xs] (when (seq xs) (cons (f (first xs)) (my-map f (rest xs)))))
22:37caternmgaare: aaaah! so cruel!
22:37mgaareSeaK: 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:37caternwhy would you give that away?
22:37justin_smith(inc catern)
22:37lazybot⇒ 1
22:37SeaKThanks for help, trying to fix it up atm.
22:38mgaarealso you need a base case - what happens when there are no more xs left
22:40catern(my very first inc, how wonderful)
22:40mgaareyou're welcome ;)
22:40justin_smithmgaare: be glad that wasn't a dec instead
22:41mgaarejustin_smith: not a dec! that's worth like 100 Schrute Bucks
22:43justin_smithsince you obviously don't care anyway, may as well
22:43justin_smith(dec mgaare)
22:43lazybot⇒ -1
22:44justin_smith$karma so
22:44lazybotso has karma -32.
22:44justin_smith$karma juxt
22:44lazybotjuxt has karma 12.
22:45abaranoskywhat's new in the Clojure world?
22:45catern$karma clojure
22:45lazybotclojure has karma 16.
22:45justin_smithwell, really now
22:45justin_smith(inc clojure)
22:45lazybot⇒ 17
22:45justin_smithabaranosky: just handing out fiat judgement left and right, mostly
22:46TEttingerI wrote a tile connector for someone's tile-based game, he had 160 lines of java and I replaced it with 22
22:46TEttingerof clojure
22:47justin_smithsounds about right
22:50abaranoskyjustin_smith: what is fiat judgment? sounds fun
22:51justin_smithabaranosky: I guess it's the wrong term - I basically just meant casting judgement capreciously about
22:51justin_smith*capriciously ... I should stop trying
22:52abaranoskytrippy
22:53TEttinger(inc mgaare)
22:53lazybot⇒ 0
22:54justin_smithI have joins and parts hidden, he left?
22:55TEttingermgaare is here
22:56justin_smithoh the ) interferes with my client highlighting
23:09mgaareI 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:12justin_smithsorry to hear that
23:12justin_smithand sorry for the third person talk
23:13mgaarescala now, could be worse
23:14abaranoskymgaare: what is "the clojrue startup"?
23:15mgaareI was at a startup that was primarily working in clojure called clickscape
23:16swgillespiemgaare: atlanta?
23:16mgaareyep
23:24munderwoHi all, is there a better room for clojurescript?
23:25justin_smithwell, there is #clojurescript, but it is a frequent topic here too
23:26munderwook cool. i'll ask there first and see if I get any help. thanks!
23:34munderwoHi 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:36arohnermunderwo: are you serving react.js in the files that run your tests?
23:39munderwoarohner: you mean in some html? or compiled into the final js?
23:40arohnermunderwo: that part is up to you. But just like your normal app has to deliver react somehow, so do your tests
23:41arohnerit's late here, so I should get off the computer
23:41arohnernight
23:44munderwoarohner: night