#clojure logs

2014-07-21

00:06ghadishaybanoh my
00:06arrdemghadishayban: you pinged earlier?
00:07ghadishaybanHave a clojure build using invokedynamic on vars, protocol functions and keyword invokes all working
00:07ghadishaybanhey arrdem
00:07arrdemsweet!
00:08ghadishaybanhave no idea how the latter perform, but static vars have a healthy performance pop
00:08arrdemcan I get an estimate? :P
00:08ghadishaybangot nearly 2x on this benchmark, https://github.com/clojure/test.benchmark/blob/5b50c61d8991330fe1cef42fd16a6c8e75a33f7c/src/main/clojure/call.clj#L13
00:09ghadishaybandon't hold me too it, won't post public numbers for at least a week
00:09arrdemsure
00:09arrdeminteresting...
00:10arrdemI'm getting close to having entirely static vars working, I'll be curious to see how they stack up.
00:10ghadishaybangot rid of the volatile in c.l.Var
00:10arrdem0_0
00:10arrdem... and replaced it with an invokeddynamic check?
00:11ghadishaybanindy SwitchPoints give you an effectively final value
00:11ghadishaybanthat you invalidate
00:11arrdemyep. that'll work.
00:11arrdemnice!
00:12ghadishaybani re-used the CallSite for Vars to do the protocol funs too, which look like this:
00:13ghadishaybanGUARD(target.implementsInterf?, target.callInterface, Protocol-IFn.invoke(target..args))
00:14ghadishaybanand the last argument, protocol-IFn, is the var representing the protocol function, re-uses the switchpoint
00:14ghadishaybanhaven't benchmarked the KeywordInvoke callsites yet, but just getting all of that bytecode on the other side of an indy callsite should help
00:22ghadishaybanpjstadig: good stuff you wrote on the mailing list
00:22ghadishaybanpjstadig: about indy all those years back
00:23TEttingerwoah actual clojure dev chat in #clojure, this stuff is way over my head :)
00:24arrdemTEttinger: you should see me and Bronsa in -offtopic :P
00:24arrdem-offtopic is really -gsoc
00:24TEttingerhaha
00:26arrdemGrimoire UX question: better to have inline source of Clojure functions, provide a link to the release tag, file and line on GitHub or source that is/has a link?
00:28ambrosebs*goes to -offtopic*
00:28arrdemI registered -gsoc a while back, but it's seen no use due to the hijacking of -offtopic
00:29justin_smithclojure-social is also opened up again, btw
00:29arrdemorly?
00:30ambrosebsarrdem: inline or github
00:30ambrosebsor both
00:30arrdemalready doing inline... for some things the inline is useless hence the thought to add github.
00:31arrdemworking towards ditching Jekyll. It was nice to get started with but turned out to be 1) slow and 2) inflexible
00:31arrdem(dec ruby)
00:31lazybot⇒ -2
00:34bsimaLet's say I have a dataset called "data". Is it good practice to do the following (using Incanter):
00:34bsima(def data (read-dataset "data.csv"))
00:34bsima(def proc-data ($where {:col "val"} data))
00:34bsima(def proc-data2 ($where {:col2 "val"} proc-data))
00:34bsimaI go on to use each of the above defs in other functions. I ask in regards to the quote about having 100 functions acting on one dataset. Technically I think I'm creating separate Incanter datasets in this code, so I'm not sure if this is the best way to do it.
00:42platzlearn about Data.List.Split before doing something crazy
00:42platzah
00:52cj3kimThoughts on assigning a large hashmap to an atom?
00:56arrdemif you're using atoms without a very good reason you're probably doing it wrong... also "assigning" isn't really meaningful and has effectively zero memory overhead.
00:56arrdemso... go crazy?
01:11kristofIs "the entire hash map" the best coarseness of granularity?
01:11kristofAfter all, if one key need to be updated, does that affect the updating of other keys?
01:18hyPiRionkristof: no
01:19kristofhyPiRion: Those were rhetorical questions for cj3kim's benefit.
01:26hyPiRionoh
01:30hellofunki'm curious if dereferencing an atom has any overhead compared to reading a non-atom value. for example, if you have an atom map and you want to read 2 keys, is it better to read each key with a separate dereference, or first dereference the atom, then read each key from the dereferenced value?
01:36hellofunkthen again this question may have a different answer in clojure vs clojurescript, the latter of which i'm using
01:39Bronsahellofunk: the time spent dereffing an atom should be meaningless
01:39Bronsahellofunk: in cljs it's just a field lookup
01:40hellofunkBronsa: thanks, useful
01:41Bronsahellofunk: well and a function call I guess, but that's almost surely going to be inlined if that's a concern
01:59amalloyhellofunk: performance time of accessing the atom is the wrong question to ask. what about correctness? if you deref an atom twice and look at different parts of it, they may not represent a coherent snapshot
02:00ambrosebsarrdem: just pushed core.typed 0.2.60. clojure.core.typed/envs will give you a useful map of the current type environments, hopeufully useful enough for grimoire.
02:22Bronsaambrosebs: what does arrdem plan to use core.typed for on grimoire?
02:34andyfBronsa: I see a case with t.a(.j) 0.3.0 where an AST has :raw-forms (clojure.lang.Compiler/LOADER), i.e a list of 1 symbol, whereas with 0.2.2 :raw-forms always seemed to be a list of parenthesized forms. Does that sound expected?
02:35Bronsaandyf: yes, it now contains also the raw-forms of macroexpanded symbols
02:35Bronsai.e. clojure.lang.Compiler/LOADER gets macroexpanded to (. clojure.lang.Compiler LOADER)
02:36andyf(. clojure.lang.Compiler -LOADER) is the expanded form I see, but understood.
02:36Bronsayeah right
02:38Bronsathat's something that just turned out to be useful for tools.analyzer.js
02:38andyfok. Just need to tweak some Eastwood code to handle that case then. Not a big deal.
02:38andyfPreviously I wrote code assuming a list of parenthesized forms.
03:05at21Hey guys. Can anyone help me wih emacs cider? When i jack-in sysntax doesn't get highlighted in repl, i.e. if I enter => (println "hello") , then "println" doesn't get highlighted. Why?
03:06at21When I turn on clojure-mode, repl stops working for some reason
03:07vijaykiranat21: the repl doens't use clojure mode - I think clojure mode and cider repl modes are both Major modes - so only one can be active at any point of time
03:07at21But I somehow remember running repl with highlighted syntax. Maybe it was just nRepl itself I'm not sure
03:09at21"""I think clojure mode and cider repl modes are both Major modes - so only one can be active at any point of time""" <- but I can enable cider-mode, and it works fine
03:15vijaykiranat21: ah - not sure then, there was related issue open on GH - let me check
03:20vijaykiranat21: can you try setting the clojure font-lock in cider ?
03:20vijaykiranat21: this one > cider-repl-use-clojure-font-lock
03:20at21there is no match for such command
03:21at21at least in my version
03:21at21last
03:21at21M-x cider-repl-use-clojure-font-lock right? There is no such command
03:22vijaykiranat21: no - it is a customization option - so you need to use (setq cider-repl-use-clojure-font-lock t) or something and eval it in a scratch buffer
03:23vijaykiranI'm trying it out to confirm
03:23at21... how to do that?
03:23at21put it in .emacs?
03:23vijaykiranat21: yup
03:24vijaykiranat21: also you can try 'M-x eval-expression' for your current session
03:26at21I did that
03:26at21nothing happened
03:26vijaykiranat21: try restarting cider ?
03:26at21yeap
03:27at21i restarted both emacs and cider
03:27at21Don't understand what should happen?
03:28at21Does your text in cider repl get highlighted??
03:28lazybotat21: What are you, crazy? Of course not!
03:28at21lazybot: about what?
03:29ssiderisat21: the highlighting of the line happens only after you've pressed enter
03:34at21ssideris: I've only noticed that. It now does highlight only after pressing Enter with (setq cider-repl-use-clojure-font-lock t)
03:35at21thank you. I think there's no way too use both major modes in emacs repl
03:35at21vijaykiran: ssideris: thanks
04:08xsynHi
04:08xsynhow do I replace a string with a nil ?
04:09xsyn(clojure.string/replace "NULL" "NULL" nil)
04:09xsyndoesn't work
04:09xsynI understand why, but yeah I just what nil in my vectors where "NULL" currently exists
04:11vijaykiran,(let [s "NULL"] (if (= s "NULL") nil s))
04:11clojurebotnil
04:12vijaykiranxsyn: it doesn't feel "right" though
04:12TEttinger,(replace ["NULL"] "NULL" nil)
04:12clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/replace>
04:13TEttinger(doc replace)
04:13clojurebot"([smap coll]); Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap"
04:13boxeda string and a vector are two different things…
04:13TEttinger,(replace {"NULL" nil} ["NULL"])
04:13clojurebot[nil]
04:13xsynsure, I was thinking to map it though
04:13TEttingerright, but what would you be replacing it in otherwise
04:13vijaykiran,(mapv #(if (= % "NULL") nil %) ["one" "two" "NULL" "stuff"])
04:13clojurebot["one" "two" nil "stuff"]
04:14TEttingernil can't be in a larger string
04:14boxed,(clojure.string/replace "fooNULLbar" "NULL" "\u0000")
04:14clojurebot"foo
04:14boxedhah, clojurebot doesn’t handle that nicely :P
04:14TEttinger,(replace {"NULL" nil} ["one" "two" "NULL" "stuff"])
04:14clojurebot["one" "two" nil "stuff"]
04:14boxedbut I think that proves that the code works :P
04:14TEttingeryep
04:14xsynTEttinger: No, I've got a vector with "NULL" in it, and I'm trying to make it more clojurific
04:15xsynNice
04:15xsynthank, yiou
04:15TEttingerno prob
04:16TEttinger,(replace {"NULL" "\u000B\u000B"} ["one" "two" "NULL" "stuff"])
04:16clojurebot["one" "two" " " "stuff"]
04:16TEttingerthat's a fun trick to fiddle with IRC clients, not all handle it
04:16TEttinger\u000B is the vertical tab char, which on my client makes a single message span multiple lines
04:17pyrtsaxsyn: String input where the word "NULL" has a special meaning? Just check that you won't need to handle Mr. Null with that code. :-P http://stackoverflow.com/q/4456438/26981
04:17boxedcolloquy doesn’t… but colloquy is pretty weird in a lot of ways :(
04:18ruoshanSystem Info: CPU Speed: 2 @ 2.40 GHz · RAM: 8 GB · OS X: Version 10.9.4 (Build 13E28) · Uptime: 9 days · Load Averages: 1.52 1.47 1.48
04:19xsynpyrtsa: I'm receiving the data like that, and trying to clean it
04:19chamomilequestion, are there any clojure 'best practices' project templates? i'v looked, don't know if that's even a thing
04:19pyrtsaxsyn: Sure. Just joking, a bit. ;)
04:20augustlchamomile: not sure if that is a thing :)
04:20boxedchamomile: beyond the templates in leiningen?
04:20augustlchamomile: Stuart Sierra's components are pretty commonly used I think
04:20augustlhttps://github.com/stuartsierra/component
04:22TEttingerboxed: so far only Floe works with it to my knowledge
04:32boxedTEttinger: with what?
04:32TEttingeroh, the vertical tab thing
04:32boxedah
04:32TEttingerit's possible there are others, but Floe uses WPF which needs to handle some funky enterprise data display stuff
04:33TEttingervertical tab has been recommended to not be used since the 80s I think
05:08noncom,(mapv #([(str "a-" %) %]) ["apple" "potato" "cat"])
05:08clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>
05:08noncomwhy? ^
05:08noncom,(mapv #(vector (str "a-" %) %) ["apple" "potato" "cat"])
05:08clojurebot[["a-apple" "apple"] ["a-potato" "potato"] ["a-cat" "cat"]]
05:08noncomthis works ^
05:09noncombut why not the short form ?
05:09opqdonutnoncom: #([(a %) %]) is the same as (fn [x] ([(a x) x]))
05:09broquaintYou're invoking the vector in the first instance, noncom.
05:09opqdonutnoncom: see what's wrong with that?
05:09noncomah, i see...
05:09noncomwow
05:10noncomwell, thanks for the explanations :)
05:22amalloynoncom: (juxt a identity) is a more fun way of writing what you meant by #([(a %) x]) anyway
05:23noncomamalloy: hehe, thats fun :)
06:37luxbockI wanted to write a macro to creates fn-definitions from a JS-object that holds an API for a library I'm using, but this appears to be impossible since CLJS lacks `resolve`, or is there some way around this?
06:45__daniel__luxbock: http://stackoverflow.com/questions/12020576/resolve-function-throws-an-error-in-clojurescript-but-not-clojure
06:45__daniel__looks like u can hack it with aget if u export the symbols
06:46luxbockhmm I see, thanks
07:39noncomhi, is there any real and up-to-date support of C# in emacs ?
07:39noncomoops, sorry, wrong channel
07:54luxbock`(cljs.tagged_literals.JSValue. nil)` the same as `#js {}`?
07:55luxbockis*
08:41ssprosshi everybody, is somebody familiar with om (cljs/reactjs)?
08:48boxedsspross: try asking the question and we’ll see if we can help. Personally I had a lot of trouble with Om and am using Reagent instead
08:49sspross@boxed ok, thanks! I'm struggling with the basic tutorial, getting a "Unsupported major.minor version 51.0" error while trying to use lein cljsbuild on my MacOS X 10.9, any hint?
08:50john2xhow do I require a new clojure file/ns in a running repl?
08:51john2xah wait, it did find the new file, it's just a new dependency isn't installed.
08:52boxedsspross: osx ships with java 1.6, and you’re trying to use a class file that requires 1.7
08:54sspross@boxed uh... ok, bad idea to install java 1.7 on mac os x or usual?
08:55boxedsspross: I haven’t done so and haven’t had any problems.. did you download some jar file manually?
08:56ssprossboxed: hm no, i'm just trying to follow the tutorial and failing at second cmd :) https://github.com/swannodette/om/wiki/Basic-Tutorial but i don't want to bother you, i try something else...
08:57boxedsspross: try Reagent :P
08:57ssprossboxed: hehe, I'm on it ;)
10:35hcumberdaleHi :)
10:36hcumberdaleHow can I make my fn seq aware so that it will recur if a seq is passed?
10:36hcumberdale(defn gen-id [node] (str (:x node) ":" (:y node))) ;; for example
10:38hcumberdale(if-not (seq? node) (str....) (recur ?))
10:38jeremyheilerhcumberdale: you could create another function that maps over gen-id
10:39jeremyheilerso like: (map gen-id (:seq :of :nodes))
10:39hcumberdaleyes jeremyheiler that whould be easy
10:39hcumberdaleBut I thought it would be better if my fn is aware of seq as argument
10:40jeremyheileri woudln't overload your function like that
10:41jeremyheilerbut, i'm missing context, as i don't know what you're doing
10:41jeremyheileri'd just keep it simple
10:42hcumberdaleI thought there is a simply way I'm not seeing
10:44vermahow do you guys chain your async calls? I need to make an HTTP request, based on success or failure of that I need to make another one, I seem to be following the node.js pattern for doing this, any suggestions/ideas on how you guys do it?
10:57AeroNotixverma: http-kit takes a callbackl
10:59hcumberdale(defn gen-id [& nodes] (map #(str (:x %) ":" (:y %)) nodes)) << found it :)
10:59jeremyheilerhcumberdale: ah ok. it wasn't clear that you wanted varargs
11:08hcumberdalejeremyheiler: varargs are just my way to solve it...
11:09hcumberdalemaybe it's also possible with 2nd vararg and recur
11:11vermaAeroNotix, hmmm, that's ok I guess then, However, I've found that promises model is pretty awesome also since you can use the -> form (-> (get-promise) (.then #()) (.then #()))
11:15justin_smithverma: core.async lets you write async state machine / callback based code as if it were normal synchronous code
11:16vermajustin_smith, any examples? or does it work in clojurescript?
11:23justin_smithyes, it does
11:23justin_smiththere are many examples
11:23justin_smithhttp://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io/
11:23justin_smiththis was one, but I was just googling, I am sure you can find many others
11:24vermajustin_smith, nice! thanks, looking
11:27teslanickNote that in clojurescript you only get the non-blocking take/put functions (>! and <!, and not >!! and <!!)
11:28teslanickBecause the JS runtime is single-threaded and (for practical purposes) unblockable.
11:28vermateslanick, yes, thanks
11:29teslanickAlthough it's surprising to me that Workers don't have access to blocking functions (aside from importScript)
12:08scape_manjaro is pretty great.
12:20zanesLately when I use clojure.tools.namespace.repl/refresh it seems like it’s failing to load all of the namespaces back in. I wind up getting java.lang.ClassNotFoundExceptions and need to go to each individual file and cider-load-current-buffer it to get things working again. Anyone else encountered this issue?
12:20hcumberdaleany idea how to ("xy") => "xy" and "xy" => "xy" ?
12:21hcumberdalewith list? and if ?
12:22technomancydon't use clojure.core/list?
12:23technomancyit is one of the worst functions in clojure
12:23technomancy,(when-not (list? (cons 1 nil)) (println "what a crappy function"))
12:23clojurebotnil
12:23hcumberdalethx :)
12:24technomancyaw come on clojurebot
12:24hiredman,(type (cons 1 nil))
12:24clojurebotclojure.lang.PersistentList
12:24hiredman(haha)
12:25technomancywat
12:25nobodyzzz,(first (flatten (list '("xy")))
12:25clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:25technomancy,(type (cons 1 (cons 1 nil)))
12:25clojurebotclojure.lang.Cons
12:25technomancyI don't even
12:25nobodyzzz,(first (flatten (list '("xy"))))
12:25clojurebot"xy"
12:25nobodyzzz,(first (flatten (list "xy")))
12:25clojurebot"xy"
12:26nobodyzzzyey =)
12:26nobodyzzzno if and list on the other hand
12:28technomancyhcumberdale: anyway, what you probably want is c.c/seq? instead of list?
12:35hcumberdaletechnomancy: solved it with a simple (apply str
12:35hcumberdalewanted a string to stay a string and a list with a string to become a plain string
12:39TimMc)
12:48sm0keis there something like try with resource in clojure like in java
12:49pyrtsawith-open
12:49sm0kelike (try [f (future ...)] .. (catch (cancel f)))
12:49sm0keno not just for calling close
12:50sm0kefor trapping exceptions
12:50sm0kehttp://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
12:51sm0kei think try catch is fundamentally broken
12:51sm0kewhy should try block vars be available in catch!
12:51sm0keshouldnt*
12:51pyrtsasm0ke: Which ones?
12:52pyrtsaThe ones already initialised, or the ones uninitialised as well? How would that work?
12:52ennHello, I'm a Cider user looking to get method signatures to show up in the minibuffer as I type (Slime-style). Right now it's working perfectly in cider-repl-mode but not in cider-mode. Is there a switch somewhere for this?
12:53technomancyenn: I don't know the exact setting, but eldoc is what that's called
12:54sm0kehurm
12:54sm0kewell they could be null
12:55pyrtsasm0ke: You can always opt in to that (regardless of whether Clojure or Java): just declare them outside the try block (and in case of Clojure, use e.g. atoms so that you can reset them).
12:56enntechnomancy: ok, thanks, that will give me something to look for
12:56sm0keyeah but that's te clumsy solution
12:57sm0kecan a future cancel itself?
12:59sm0kei am working with play-clj, it is really hard to do interactive development error is causing whole repl to crash
12:59sm0keas error*
13:00sm0kewhich is weird because i am putting whole main inside a try catch
13:03sm0kei mean whole body of main
13:17zanesAnyone have any luck getting test.check with cider-test-run-tests?
13:52vendethielanybody using intellij with clojure ? I've tried la clojure, but it seems to crash when I restart intellij :(.
13:52teslanickI tried to use it with Cursive for a while, I decided it wasn't worth it.
13:54arrdemI've seen the estimate that 50% of the Clojure user base works in emacs throw around before. It doubles as a nice commentary on the state of tooling for different editors...
13:54arrdem*thrown
13:59SegFaultAXvims support has improved significantly in the last 6mo-1y
14:20aaelonyHi, if I use type hints in a defrecord, are those hints put to use in Clojure 1.6 ?
14:21shiranaihitois it difficult to get Clojure to reload namespaces while running? .. i'm trying this: "(require 'application.main :reload-all)" .. but it doesn't seem to work
14:22aperiodicshiranaihito: what do you expect to happen?
14:23shiranaihitowel, "application.main" contains a handler function that i'm using with embedded Jetty
14:23justin_smithshiranaihito: one gotcha is that if in application.main you started some long term process, reloading the ns is not going to change the definition of the process
14:24justin_smithshiranaihito: use #'handler instead of handler when running jetty, and ring will do the right thing
14:24shiranaihitoi'd like to have changes to the handler to show up without restarting the server (and whole Java process)
14:24justin_smithyeah, #'handler instead of handler fixes that
14:24shiranaihitoi'm not using ring though :/
14:24aaelonyI guess hinted fields are mentioned on line 364 of https://github.com/clojure/clojure/blob/f7215fdb8ca7d23faa7b47865d5acab1af8437a3/src/clj/clojure/core_deftype.clj#L285-L370 but I'm not sure I understand if those hints are being acted on...
14:24aperiodicshiranaihito: you'll need to use the new things you pick up after the reload. so, using a var forces the var's value to be looked up every time, meaning if its definition changes you'll see the new thing
14:24amalloywaaaaaaat. not using ring?
14:24shiranaihitohmm.. well, "application.main" is a namespace.. i'm not supposed to try and reload vars, right?
14:25justin_smithshiranaihito: yeah, I hope you have a very good reason to not use ring
14:25shiranaihitoyeah.. i wanted a different way to dispatch requests to handlers
14:25shiranaihitojustin_smith: how so? :P
14:25justin_smithshiranaihito: point is that a long running process isn't going to have its code change just because of an ns reload
14:26justin_smithshiranaihito: ring's request to handler dispatch is very good and very flexible, for example it makes it easy to use a new handler after ns reload
14:26shiranaihitojustin_smith: alright.. hmhm well, i didn't quite follow you there.. what's the problem with long-running processes then?
14:26justin_smithif you are using plain jetty, well, good luck I guess
14:26shiranaihito:P
14:26justin_smithshiranaihito: you can manually do it by doing a var lookup in your handler for the actual function to call
14:26shiranaihitoi doubt it's _that_ horrible a choice
14:26justin_smiththen a function redef will cause the new code to run
14:27justin_smithshiranaihito: ring is one of the best things in clojure, and I don't know of many reasons to avoid it
14:27justin_smithI'd be interested in yours if you have one
14:27shiranaihitovar lookup & redef? .. how does that relate to require :reload?
14:27justin_smithshiranaihito: require :reload rebinds the var
14:28amalloyshiranaihito: are you actually sure you're not using ring? just about every clojure webserver uses ring underneath, so you might not even realize you're using it
14:28justin_smithif you are not doing an explicit var lookup, than it can look it up once, and keep using that
14:28shiranaihitowell, i wanted a different way to structure my apps, and arranged for dispatching requests in a different way
14:28justin_smithso for a reload to do what you want, you need to manually deref the var on each request
14:28justin_smithshiranaihito: try using ring but not compojure then
14:28justin_smithring is extremely open ended
14:28shiranaihitonah i'm using embedded jetty :P the request gets dispatched by my little thing
14:29shiranaihitohmm
14:29justin_smithring does not do dispatch at all
14:29justin_smithI think you are confused
14:29shiranaihitocould be
14:29justin_smithwell, it calls the handler function you provide it
14:29justin_smithbut that's it
14:29justin_smiththe rest is up to whatever lib you use (compojure, or whatever else)
14:29shiranaihitoright well, compojure is the correct comparison, yes
14:29justin_smithtry lein deps :tree
14:29justin_smithyou may just see ring in that tree
14:30shiranaihitoif it helps clear it up, i'm not using ring, and not using compojure, but a request gets dispatched anyway (because i made it happen :P)
14:30justin_smithshiranaihito: once again, ring does not do the dispatching part at all
14:30shiranaihitoyes
14:30shiranaihitoi got it already
14:30justin_smithit turns a request into a map, and later turns a data structure into an output stream
14:30shiranaihitocompojure
14:30shiranaihitoi'm not using compojure either
14:30shiranaihitook? :P
14:31justin_smithbut your code is using an input stream and an output stream or something, OK
14:31shiranaihitoyeah, embedded Jetty
14:31justin_smithring uses embedded jetty
14:31justin_smithas one backend among others
14:31shiranaihitothe jetty adapter?
14:31shiranaihitoyep
14:31shiranaihitoi used that as a basis for calling my dispatch thingy
14:32justin_smithanyway, using ring will be easier, but if you really want to not use the best lib for the job, then manually deref the var that points to your dispatch / handler function for each request
14:32justin_smithand then :reload will do what you expect it to
14:33shiranaihitohmm
14:34shiranaihitoi'm confused by that deref stuff.. is it enough just to put a @ in front of a var's name?
14:35technomancyjustin_smith: actually isn't the point to *not* deref the var?
14:35technomancyjust call it directly
14:40ennAll of the examples I can find for defmulti seem to use an old, now-changed syntax (where the second argument is a hierarchy name). And the defmultis I am writing based on the arg list don't work. I tried to make one with only a default method:
14:41enn(defmulti foo) (defmethod foo :default [whatever] whatever)
14:41ennwhen I try to call it I get a null pointer exception in clojure.lang.MultiFn.invoke
14:41amalloyenn: you need a dispatch function somewhere
14:41ennamalloy: what function would I use if I just want to dispatch based on class?
14:43gfredericks,(doc class)
14:43clojurebot"([x]); Returns the Class of x"
14:45ennwith (defmulti foo class) I get exactly the same exception.
14:45ennah, I guess it doesn't replace the earlier definition. If I use a new name it works.
14:45ennThank you
14:46amalloydefmulti strikes again
14:48bbloomamalloy: yeah :-/
14:48alpheusGoogle App Engine doesn't allow listening sockets, and I want to get nrepl working. What if I change nrepl to make an outgoing connection instead?
14:49amalloyclojurebot: defmulti |strikes| again
14:49clojurebotRoger.
14:49technomancyalpheus: it's easier to use the http nrepl transport; check out drawbridge
14:49alpheuscool, thanks
14:49teslanickThat's what I've used with Heroku (prior to it getting socket support)
14:49technomancyalso https://devcenter.heroku.com/articles/debugging-clojure
14:52technomancyso... just published https://github.com/technomancy/leiningen/wiki/SigningDeployedJars and would like feedback on it
14:52technomancydocs for how to sign artifacts you've already deployed
14:54vendethielSegFaultAX: so, vim is still better ? IDEA not worth it, in your opinion ? (if you've tried idea, that is)
14:56amalloytechnomancy: the four-line code snippet with cp/gpg won't work, because the jars don't live in the place you're copying from
14:56technomancyamalloy: ah right; I should just put [...] or something
14:56technomancybecause you can't copy it verbatim anyway
14:57amalloyalso, you should settle on whether the version is 1.3.1 or * (i don't recommend *, which might suggest signing all versions of a jar at once)
14:57technomancyoh right; I didn't mean to suggest **
14:57technomancyI'll just stick with 1.3.1
14:58amalloyand *also*, gpg -ab mylib-1.3.1.{jar,pom}
14:59technomancyhttp://p.hagelb.org/mrfp.gif
14:59technomancyheh, but thanks
14:59technomancyI guess the same syntax can be used for the cp?
14:59amalloyi love the {a,b} expansions in bash
15:00amalloyyeah
15:00Glenjamini dunno if it'd use them in a tutorial like this
15:00Glenjamin*i'd
15:00amalloyGlenjamin: this is the perfect opportunity to teach folks they don't need to slavishly retype everything!
15:00Glenjaminyeah, but then you need a comment to say what it does
15:00Glenjaminwhich detracts from the core example a bit
15:01amalloyadn it's not like people signing stuff on clojars on the command line are technologically illiterate
15:01technomancyamalloy: gpg only accepts one file at a time for -ab
15:01Glenjamini guess it depends how many people would recognise the shell expansion
15:01amalloyGlenjamin: what. why would you need that. there's nothing exlpaining what the -ab flag to gpg means
15:02technomancyworks for cp though
15:02Glenjaminhrm, i see what you mean
15:02Glenjaminmy intuition is its less guessable
15:02amalloytechnomancy: drat. i read `man gpg` but couldn't immediately tell if it would work or not; i made an optimistic guess
15:03amalloy*shrug* i'm in favor of teaching things all the time, Glenjamin, and i don't think it detracts from the tutorial
15:04amalloyreally, i think people will just copy all the stuff in here to copy artifacts and then forget what it all means, which imo is fine. but the {a,b} syntax may be interesting enough to retain
15:04Glenjamini do find myself stopping people at work mid-command to tell them about this feature
15:04Glenjamini think you have convinced me
15:05technomancytoo late anyway, it's out there
15:05technomancythough... it *is* a wiki
15:05amalloytechnomancy: hahaha that cp command. i love it
15:05amalloyyou forgot the . at the end, and instead rename the jar to .pom
15:05technomancyderpy mcderp
15:06Glenjaminheh, for a second i thought that was on purpose, and was royally confused
15:06technomancythis is what happens when you try to get clever!
15:06platzIf I have an nrepl/cider session in emacs, is there an easy way to add a new dependancy to my project.clj and have it downloaded, without killing the cider/nrepl session and starting it again?
15:06amalloyit's true, technomancy. technology is a sin
15:06platzi.e. if i want to suddenly parse json in the file I'm working on
15:08technomancyamalloy: punishment for hubris
15:10amalloyactually, technomancy, i'm a little dubious on this whole prospect of post-signing deployed artifacts. are authors *really* going to carefully inspect every character of every file to see if some attacker has changed a true to a false or something, disabling a key safety feature? it's way easier to trust the contents of a file on my local hard drive that i'm about to deploy, compared to one i downloaded after publishing months ago
15:13amalloyand we're *deleting* the copy in our ~/.m2? if the idea of signing is that we want to verify no attacker has modified the published artifact, we've just lost a safe-ish comparison point that we could be diffing against
15:13amalloyso it all works great unless there's been a security breach, in which case it seems unlikely to work
15:13silasdavisin clojure.test deftest can you not use the for macro?
15:14amalloyfor is not a loop
15:14amalloyit is a lazy list-comprehension
15:14silasdavisyes
15:14silasdavisit is
15:14silasdavisright
15:14silasdavisdoseq?
15:14clojurebotdoseq is like for, but for side effects instead of values
15:15amalloysure, although clojure.test/are is supposed to do that
15:19silasdavislooks like I'd have to do (apply are ... (for ...)) to get similar effect
15:19silasdavisthat doesn't seem particularly nice
15:19amalloyer...probably not, but i suppose i don't know what you're testing
15:20silasdavissomething like all possible paths through a tripartite graph
15:21silasdavissame (is ...) assertion for each path
15:21silasdavisfor does it nicely
15:21amalloyyeah, you want doseq
15:21hyPiRion(inc amalloy)
15:21lazybot⇒ 150
15:21silasdavisamalloy, thanks
15:21amalloywhat've i done now, hyPiRion?
15:23ogiusing core.match, can i get something to the effect of (match ... [x x] ...)?
15:23ennthe code in an :or clause gets run regardless of whether or not the key is supplied ... what's the rationale behind that?
15:24hyPiRionamalloy: provided the right answer
15:24amalloy,(macroexpand-1 '(let [{x :x :or {x 1}} {}] x))
15:24clojurebot(let* [map__27 {} map__27 (if (clojure.core/seq? map__27) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__27)) map__27) x ...] x)
15:24amalloy&(macroexpand-1 '(let [{x :x :or {x 1}} {}] x))
15:24lazybot⇒ (let* [map__16660 {} map__16660 (if (clojure.core/seq? map__16660) (clojure.core/apply clojure.core/hash-map map__16660) map__16660) x (clojure.core/get map__16660 :x 1)] x)
15:24amalloythe key point here is the (let [x (clojure.core/get map__16660 :x 1)])
15:26ennsure, I am just wondering why it was done that way. It feels unexpected (especially considering the short-circuiting behavior of the similarly-named or macro)
15:26gfredericks,(defmacro eval-when [cond expr] `(if ~cond ~expr '~expr))
15:26clojurebot#'sandbox/eval-when
15:33gfredericksI don't think that does exactly what I wanted
15:34technomancyamalloy: I'll admit it's not ideal
15:35technomancymaybe I should add a warning saying if you can't thoroughly audit the artifact, it's better to just deploy a new signed version
15:36technomancyamalloy: or alternatively, write something that diffs a jar/pom against a git tag?
15:36Glenjaminthat in itself would be neat
15:36amalloydiffing against a git commit is an interesting plan. should be safe enough to do, and while it doesn't cover everything it's better than nothing
15:37technomancyactually giving security advice on a wiki is probably kind of dumb in the first place =D
15:37Glenjaminif you have a jar with source+class, can you trust the two match?
15:37amalloyGlenjamin: no
15:37Glenjaminand is source->class deterministic?
15:37amalloyalso probably no
15:37technomancyGlenjamin: good question
15:37Glenjamini get the sense we're all a bit screwed from a security pov
15:38technomancywell, the number of scenarios in which it's OK to deploy .class files to clojars is already very low to begin with
15:38technomancyso that helps
15:38technomancyI wouldn't be surprised if AOT with the same JDK would be deterministic though
15:39amalloytechnomancy: i would be a *little* surprised if it produced exactly the same output, but *very* surprised if it were actually deterministic (ie, guaranteed to do so)
15:40technomancywell
15:40technomancywe'll just have to wait till someone to actually care enough to try it
15:40amalloyi dunno, maybe that's pessimistic
15:40gfredericks,(defmacro then [] (str (java.util.Date.)))
15:40clojurebot#'sandbox/then
15:40gfredericks,[(then) (then)]
15:40clojurebot["Mon Jul 21 19:38:05 UTC 2014" "Mon Jul 21 19:38:05 UTC 2014"]
15:40gfredericks,(then)
15:40clojurebot"Mon Jul 21 19:38:11 UTC 2014"
15:40gfredericks,(then)
15:40clojurebot"Mon Jul 21 19:38:14 UTC 2014"
15:40gfrederickswait oh
15:40gfrederickshm
15:40amalloy,(and (then))
15:40clojurebot"Mon Jul 21 19:38:23 UTC 2014"
15:40gfredericksright
15:41ennI have a frustrating API that will give me the name of a java class as a string, but expects an actual reference to the java class elsewhere. How can I find the class given the string?
15:41gfredericks,(Class/forName "java.util.Date")
15:41clojurebotjava.util.Date
15:41gfredericks,(-> "java.util.Date" read-string resolve)
15:41clojurebotjava.util.Date
15:41verma,((fn [{:keys [a b]}] (+ a b)) :a 5 :b 10)
15:41clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox/eval190/fn--192>
15:42enngfredericks: thank you
15:42gfredericks,((fn [& {:keys [a b]}] (+ a b)) :a 5 :b 10)
15:42clojurebot15
15:42vermaah, thanks gfredericks
15:43gfredericksenn: verma: you're welcome
15:43verma,((fn [& {:keys [a b]}] (+ a b)) :a 5 :b 10 11)
15:43clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: 11>
15:43vermanice
15:43verma(inc gfredericks)
15:43lazybot⇒ 77
15:59SagiCZff
16:16amalloydid contains? ever used to work on sequences? http://stackoverflow.com/a/24866960/625403 claims it did but i'm quite doubtful
16:18SagiCZamalloy: I don't think so.
16:20amalloyyeah, i can't find it with a dive through the git logs either
16:29mikerodamalloy: wouldn't that break the perf characteristics that contains? is going for
16:29amalloymikerod: of course
16:30amalloyit's plausible that back in like 2008 contains? might have behaved that way, although i don't think it did
16:30mikerodah, way back in history perhaps. I think that would have been weird still though.
16:45stuartsierraamalloy_: `contains?` never *worked* on lazy sequences. On anything non-associative, it returned nil.
16:46stuartsierraStarting with Clojure 1.5, it throws an exception instead.
16:46technomancymaybe "worked" here is shortand for "doesn't asplode"
16:46technomancyshorthand
16:47gfredericks&*clojure-version*
16:47lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
16:47gfredericks&(contains? () 8)
16:47lazybot⇒ false
16:47gfredericks,(contains? () 8)
16:47clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentList$EmptyList>
16:47gfredericks&(contains? :haha 42)
16:47lazybot⇒ false
16:48stuartsierraEven better, &(get :not-a-map 42)
16:48stuartsierra=> nil
16:49stuartsierraAs I tried to fix in http://dev.clojure.org/jira/browse/CLJ-1107
16:50gfredericksyeah I wonder what intentional behavior he has in mind
16:50gfrederickstechnically every change is breaking
16:50ogii'm using cider with emacs. once i add a function to a module, i have to (use module) in repl again to bind the function name. is there a better way?
16:50gfredericksin the "could theoretically break something" sense
16:54arrdemI mean... we had a huge "breaking" change in 1.3..
16:54gfredericksogi: you can change your repl to that namespace, if it's just one namespace that's bothering you
16:54arrdemrm -rf src/clj/clojure/contrib
16:54gfredericksogi: also require with :as doesn't have that behavior
16:54gfredericksarrdem: contrib never shipped with clojure I don't think
16:55andyf_arrdem: And I think that and other changes in 1.3 have led to a wish to avoid such changes in the future
16:55andyf_Or so I have heard
16:55ogigfredericks: thanks, but if i change the default namespace then i have to "use" things like clojure.repl, although admittedly only once
16:55arrdemandyf_: my point is that of we were using SemVer or something else for clojure.core we'd be on 2.X already, so the idea of quibbling over "breaking" changes when every release is potentially breaking is kinda absurd.
16:56gfredericksogi: yeah, that bothered me so much I started creating a namespace called . so I could refer to it fully qualified from everywhere
16:56andyf_gfredericks: Someone could know about get's behavior, and rely on no exception being thrown for unsupported types
16:56gfredericksreplaces clojure.repl & anything else I want
16:57gfredericksandyf_: yes, that argument technically applies to any change; I'm just sayin' it's a continuum
16:57arrdemgfredericks: .... you what
16:57arrdemgfredericks: oh. ./. right.
16:57ogigfredericks: thanks! that feels a bit hacky but seems very practical
16:58gfredericksogi: I ever made a plugin: https://github.com/gfredericks/dot-slash :(
16:58gfrederickss/:(/:)/
16:59gfrederickss/ever/even/
16:59gfredericksogi: yeah any other approach to making stuff available everywhere felt a lot more hacky
17:00gfredericksand evaling stuff in arbitrary namespaces is just too useful especially with cider
17:01fifosineis there a lazy sequence that provides the seq you give it at the start and then repeatedly some specified character when it runs out? For example (take 8 (my-seq-fn '(1 2 3) 0)) yields (1 2 3 0 0 0 0 0)
17:01ogigfredericks: make a plugin you did :) thanks again!
17:01Glenjamin(concat X (repeat Y)
17:01Glenjamin)
17:01gfredericksogi: np
17:02fifosineGlenjamin: Thanks!
17:07andyf_Bronsa: I guess it is intentional that primitive type hint checking got more strict from taj 0.2.2 to 0.3.0 ?
17:21fifosineIs there a way to simplify the code duplication here?
17:21fifosine(if mybool
17:21fifosine (let [a 1 b 2]
17:21fifosine (func a b))
17:21fifosine (let [a 2 b 1]
17:21fifosine (func a b)))
17:23amalloystuartsierra: interestingly enough, while reading through the git logs, i found that actually in the very early days contains? threw an exception on sequences; it was changed to return false later, and then much later it went back to exceptions
17:24amalloyfifosine: (apply func (if mybool [1 2] [2 1]))?
17:24amalloyone of numerous reasonable approaches
17:24fifosineooh I like that
17:30fifosine,(map list (list "1234" (concat "12" (repeat "0"))))
17:30clojurebot(("1234") ((\1 \2 "0" "0" "0" ...)))
17:32amalloysee https://github.com/clojure/clojure/blob/91b5515e/src/jvm/clojure/lang/RT.java#L453-L470 if anyone is curious: a snapshot from back in 2008 where (contains? () :x) threw an exception
17:32fifosine,(map list "1234" (concat "12" (repeat "0")))
17:32clojurebot((\1 \1) (\2 \2) (\3 "0") (\4 "0"))
17:33amalloywow, this was back before clojure.core existed. src/boot.clj, (in-ns 'clojure)
17:43fifosineamalloy: Can you see a way to reduce the # of calls to map to 1?
17:43fifosine(defn map-pad [f x c1 c2]
17:43fifosine (if (< (count c1) (count c2))
17:43fifosine (map f (concat c1 (repeat x)) c2)
17:43fifosine (map f c1 (concat c2 (repeat x)))))
17:43hiredman~paste
17:43clojurebotpaste is https://refheap.com/
17:45amalloyi mean, of course you can reduce it to 1, by writing (apply map (if ...)). but the main problem is the repetition of concat/repeat/count, and the fact that you've written a totally non-lazy map
17:46amalloyif you write it to be lazy, the nicer way to do things sorta falls into your lap along the way
17:48fifosineamalloy: Can you be more specific? I'm not used to writing things lazily
17:50amalloywell, if you wanted to write this correctly and lazily, https://www.refheap.com/cee3428d51e888b8b4a995f39 is one way
17:51amalloythe point is to never look any further ahead in any sequence than you need to, which means you can only go one at a time
17:51amalloyand of course a version that only works for exactly 2 collections is kinda silly - why not more? 2 is a suspicious number
17:52fifosineamalloy: So the benefit of this is that no more than necessary is calculated?
17:54SegFaultAXvendethiel: Emacs is still clearly the winner since that's where the most time and effort has been spent.
17:54SegFaultAXvendethiel: But as a vim user, I'm happy to report that support for vim is perfectly workable.
17:56fifosineamalloy: The way you've written it, it's kind of like a generator in python, right?
17:57amalloyno more than any other lazy sequence function is
17:58fifosineamalloy: That's what I mean. This stuffs new to me but cool
17:59fifosineamalloy: Why is that "when" call necessary? We can't assume each thing in coll is a collection?
18:00amalloytry taking it out and see what happens. then think about why it happened
18:02bortrebIs there a way to ignore a single *.clj file from compilation when using leiningen?
18:02bortrebmeaning I have a normal source directory, but I want to disregard a single flojure file and compile the others as normal
18:03hiredmanwhy are you compiling anything?
18:03hiredman(I assume by compiling you mean aot compilation)
18:03technomancybortreb: do you understand how clojure's transitive compilation works?
18:04technomancythere's basically no way to compile a namespace without compiling everything it requires
18:04bortrebI mean exclude the file from everything leinengen does completely, not just for compilation. For example, I don't want it to include it in the jar when building a jar, nor try to evaulate any forms in the file
18:05technomancybortreb: you could put it in a directory that's not on the classpath except in the dev profile
18:05bortrebI have a src folder with say 5 clojure files, but one of the clojure files has problems that I want to deal with later, so have leinengen disregard it. (none of the other files depend on it.)
18:06bortrebahh -- thanks technomancy I think that's a clean way of handling it
18:06bortrebI'll do that
18:07technomancyif it has problems you can just comment it out
18:09bortrebIt's part of transitioning from a really old-school cloure setup (from clojure 1.0/1.1 before leiningen) to using leiningen -- the problem file depends on other source files that I don't realy want to be part of the project, but I still want to use it with the old system. But moving it to a different folder that leiningen doesn't track will work nicely for now, thanks!
18:10technomancycool beans
18:17shaun__loon: how do you write a zipmap
18:19loonshaun__: very carefully
19:00PigDudehow do you determine if a value implements some protocol?
19:01nathan7PigDude: satisfies?
19:01nathan7PigDude: (satisfies? protocol value)
19:02amalloyalthough often if you're calling satisfies? it suggests you're using protocols wrong. you should generally only be accepting things which satisfy some protocol, not things which *might* satisfy it
19:04PigDudeamalloy: i was going to use it in a precondition
19:04PigDudeamalloy: is that right?
19:04amalloyif you're a fan of preconditions, that's a reasonable thing to do
19:05PigDudehow else would you only be accepting things which satisy some protocol though?
19:05amalloyjust assume they satisfy it, and call the protocol functions. if not, things blow up. just like when you call ##(+ 5 "apple")
19:05lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
19:06PigDudeah ok
19:06PigDude"5apple"
19:06PigDude:)
19:08amalloy5Napple
19:08amalloythat's why you can't add bigints to strings - it looks like product placement
19:11johnwalkeris lambdajam going to be livestreamed?
19:11johnwalkeri really want to watch rich's keynote tomorrow morning
19:12johnwalkerlooks like it's going to be amazing. alex miller is going to run a datomic workshop
19:14johnwalkerwoahh and reiddraper
19:14bbloomztellman: before i go benchmark it... does immutable-int-map speed up lookups too? measurements in the README only show construction
19:14ztellmanbbloom: I think it was mostly equivalent
19:14ztellmanthere are benchmarks in the tests
19:15bbloomztellman: k, i have a relatively large maps of longs and faster lookup would actually be a win
19:15ztellmandouble-checking now, I'm a bit hazy
19:15bbloomztellman: awesome, thanks
19:16amalloyztellman only appears hazy because he is a being of pure energy
19:16ztellmanshush, don't give away my secrets
19:17ztellmanbbloom: how large is "relatively large"?
19:18bbloomztellman: thousands on the low end
19:18bbloomtens of thousands more generally
19:18ztellmanbbloom: ok, my benchmark is for 1mm entries
19:18bbloomeven better :-)
19:18ztellmanit's basically equivalent, but much faster than sorted-map
19:20ztellman50ns for basic lookup, 400ns for sorted-map
19:20bbloomztellman: i don't need sorted at all
19:22ztellmanbbloom: sorted is automatic, you get if you like it or not
19:22bbloomdoesn't hurt to have it
19:32bbloomztellman: more annoying is how destructuring uses nth on a sequence and so Class.isArray sucks up a bunch of time in a tight loop :-/
19:32ztellmanfor bbloom: so use something which is Clojure.lang.Indexed
19:32ztellman?
19:34bbloomztellman: yeah, but the issue came up b/c of varargs in assoc-in
19:34ztellmanoh, hmm
19:34ztellmanyeah, no answer for that
19:34bbloomwould be nice if variadic functions could be called with something Indexed if the call site used a fixed number of args
19:36ztellmanif rest on an Indexed returned an Indexed, totally doable
19:36ztellmanunfortunately only clj-tuple does that
19:37amalloybbloom: variadic functions *are* called with something indexed when there are a fixed number of args
19:37amalloyspecifically, an ArraySeq
19:37amalloybut assoc-in doesn't take varargs, it destructures a sequence
19:37bbloomamalloy: d'oh good catch
19:40bbloomi just specialized assoc-in for my particular use case & it's nice and fast now
19:40bbloomthanks guys
19:41amalloybbloom: what were you calling assoc-in with that you were getting bad performance?
19:41bbloomamalloy: a tight loop :-P
19:41amalloyno, the args to it
19:41bblooma vector
19:41amalloyClass.isArray is only called near the end, after most of the performant options
19:41bbloombut it's still called before using first/next
19:41ztellmanamalloy: ArraySeq is an IndexedSeq
19:41ztellmannot Indexed
19:41ztellmanwhich have nothing to do with each other, hilariously
19:42amalloyugh, the trickery. i forgot about that
19:42ztellmanwow, this is dumb
19:42ztellmanit could be Indexed trivially
19:42ztellmanwhich would help everything
19:42amalloyoh yeah, and when you destructure a vector into first/rest what you get back isn't a vector anymore
19:42amalloyso it's not indexed, even though of course it could be
19:44amalloyman. nthFrom and seqFrom could use some work
19:44bbloomamalloy: yup, i find that i have to call .nth instead of nth in quite a few hot spots
19:44ztellmanamalloy: hackday
19:44ztellmanseriously, let's just fix Clojure-land a bit
19:44bbloomevery time i profile anything, you can be sure that java.lang.Class is on the hotpath
19:44bbloom:-/
19:52bbloomztellman: i was only half kidding... can i ignore this problem and assume you'll submit a patch ;-)
19:52ztellmanI dunno, I've pretty carefully avoided JIRA back-and-forth
19:53ztellmanbut I think I have enough dangling issues that I'm going to just do them all
19:53ztellmantry to get amalloy to join me in this masochistic venture, but he's gunshy
19:53technomancydon't look at me; I'm allergic to jira
19:54amalloytechnomancy: find me a picture of someone who's allergic to something delicious and keeps eating it
19:54amalloythis will refer to myself, who keeps getting pulled back to jira
19:54technomancygimme like a hundred seconds
19:55technomancyhttp://wondermark.com/1k37/
19:55amalloyexcellent. strawberries are what i was thinking of
19:55amalloyperhaps because i have read that already
19:56technomancyyeah you totally set me up for a soft ball, thanks =)
19:56amalloywait, i guess i haven't. that's from last month. i haven't read wondermark in a couple years
19:56andyf_Submitting to jira is only masochistic for those who can't stand waiting a year or 2 for a commit to master - wait maybe that is the definition of masochistic?
19:56amalloyit just looks so familiar
19:56technomancyyears??
19:56lazybottechnomancy: What are you, crazy? Of course not!
19:56amalloyandyf_: i've got several patches waiting longer than that
19:58bbloomi didn't mean to start another jira bitchfest :-/
19:58bbloom(but i would have submitted two dozen more patches if i felt it was gonna do any good)
19:59andyf_It is a bit easier if Clojure core agrees the issue is a bug, rather than enhancement.
20:00amalloybbloom: it's okay. factual is having a hackday next week, and i'll include fixing up ArraySeq on my list
20:00bbloomamalloy: awesome, thanks :-P
20:00technomancyamalloy: then you missed the 4th of July special? http://wondermark.com/1k43/
20:02amalloynot at all, technomancy, i just put it off for two and a half weeks, apparently
20:03technomancywhew
20:08garthIs there a reason to do (apply max someList) over (reduce max someList) or vice versa?
20:09amalloyi wonder if it's right to make ArraySeq_int and friends implement Indexed. they probably don't want to box up their values for nth
20:10bbloomgarth: in both cases, you need to make sure someList is not empyt, since max requires at least one argument
20:11bbloomgarth: but generally, reduce will be faster than apply because apply will create an intermediate lazy sequence
20:11bbloomamalloy: that's a good question
20:11amalloybbloom: wat
20:12bbloomamalloy: wat wat?
20:12amalloywhat you just said about reduce/apply makes no sense. for max it's clearly wrong, and for most other cases i can think of as well, although i won't say it's wrong in *all* cases
20:13amalloyi guess you're thinking of reducers, and assuming that your input is something reducible that's a fair point
20:14bbloomgarth: ok apparently don't listen to me
20:14amalloybut if you want the max, and what you have is a seq or something like that, there's no real advantage to calling reduce instead
20:16amalloystill, i spoke too hastily - i always forget that these days reduce is actually clojure.core.reducers/reduce
20:17PigDudeamalloy: good one :)
20:17PigDudeamalloy: (earlier, internet died where i was)
20:23amalloybbloom: are you familiar with the amusing thing that happens if you try these two very similar expressions? https://www.refheap.com/be5d3b5a42039c9228e8367b1
20:24bbloomamalloy: nope
20:24amalloylazy seqs are reducible, but if you use any of the reducer transformers on one, you hold its head for the whole computation
20:24ztellmanhaha, whee
20:26amalloybasically because there's no mechanism for a reified CollReduce impl to behave like a ^:once fn*
20:26amalloyit's saving the collection for you just in case you want to reduce over it again
20:31amalloythe lazy seq world is nice, and reducers are nice, but my opinion (mentioned on at least one jira ticket somewhere) is that trying to bridge them is folly
21:18blur3dHey, I have the following app-state/data, and I am trying to avoid nesting the data under the kind and label-id keys. Is there an easy way to update a sensor value in the hashmap? Or is it better to just use nested maps as indexes (and just duplicate the data in the sensor hashmap)?
21:18blur3dhttp://pastebin.com/WQ1dj2EW
21:27ghadishaybanamalloy_: i have a fix for the lazy-seq reducible thing in CLJ-1250
21:27TEttingeryou're just a fixing machine lately, ghadishayban!
21:34ghadishaybanTEttinger: ain't no fix if it doesn't go through the process and get applied
21:34justin_smithblur3d: would you want multiple sensors of the same kind? if not it seems it would be convenient to put the sensors in a hash map with kind as the key
21:35ghadishaybanA periodic reminder to vote for JIRA tickets: http://jafingerhut.github.io/clj-ticket-status/CLJ-top-tickets-by-weighted-vote.html
21:35blur3djustin_smith: yeah, I was hoping to support multiple sensors of the same kind. And the lablel would be how people can tell them apart
21:35justin_smithblur3d: also, you can use 1 as a label, instead of :1, I think that would make things easier
21:36blur3dyeah I might just use numbers, but then I can’t (:1 labels)
21:36justin_smithblur3d: how about something like {{:kind "altimeter" :label "0"} {:updated-at ... :value ...}}
21:36justin_smithblur3d: but you can use get
21:36blur3dbut I need to use get anyway, incase a label is empty
21:37justin_smithsince you need both kind and label (only the combination will ever be unique) it seems like they need to be combined to make a proper unique key
21:37blur3dcan you use that kind of destructuring in an update-in/assoc-in?
21:37blur3dyeah, that is what I am after… rather then double nested hashmaps
21:38justin_smith,(update-in {[0 1] 0} [[0 1]] inc)
21:38clojurebot{[0 1] 1}
21:38blur3da way to use the kind + id as a index when updating
21:38justin_smithwith only two pieces of data, a two element vector may be better than a small map, in terms of readability
21:38blur3dindex/unique key
21:39justin_smith,(update-in {{:a 1} 0} [{:a 1}] inc) but of course a hashmap works too
21:39clojurebot{{:a 1} 1}
21:39blur3dwell, I plan to support a timeseries of values which get conj to the :values [] key
21:40justin_smithok, I think that's outside the current question, but totally doable of course
21:40blur3dI think will work fine
21:40justin_smithso like [{:time ... :value ...} ...] as the values in the map
21:41blur3dyeah, I haven’t worked out how I plan to graph the data yet…. even just a vector should be ok [time value]
21:42blur3dI like http://code.shutterstock.com/rickshaw/, but its support for timeseries seems limited to a constant update interval - and the data is updated during user defined events
21:44justin_smithblur3d: there was this algorithmic music composition tool called cecilia, that is kind of defunct now but it had great tools for manipulating data in graph form (like you could click buttons to make each data point random walk from the current value, or to shrink or expand by some factor in the x or y range)
21:45justin_smiththis is suprisingly rare, as graphing is usually seen as read-only and a way to display existing data, not a way to interactively create an interesting dataset
21:46blur3dsounds interesting
21:47justin_smithyeah, even the ability to click and drag data points is rare (and probably scary to many statisticians)
21:48blur3dwhat I am working on is a real-time dashboard for Arduinos. Basically, you include a library in you arduino code, add a couple lines (1/2 per sensor/input) and then it will send data via serial/tcp/bluetooth to a web app (likely node-webkit) and automatically create a dashboard that updates
21:50blur3djustin_smith: The destructing hash keys work great - thanks
22:06justin_smithblur3d: cool, regarding the node-webkit webapp, you could go all tiny and run that on a beagle-bone
22:06justin_smithbeagle bone ships with a node web server that allows js access to all its sensor ports
22:08blur3dyeah, I was hoping to support raspberry pi’s and any low powered ARM devices that support node webkit - and potentially, you only need data collection ‘server’, so other devices would only need a web browser and javascript
22:08justin_smithhttp://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone?CMP=KNC-USA-DC-SBC-BBB-BRAND
22:08blur3dI’ve got the arduino code library written. It sends data via extending the Firmata library/protocol
22:09justin_smithcool
22:09blur3dand I’ve prototyped several ways to read the data… over serial/tcp
22:10blur3dI was hoping to just use browser support for serial/tcp, but it is too early and chromium doesn’t support it enough yet
22:11blur3dso that led me to looking at node-webkit, and running a light weight node server (hopefully in clojurescript) that can read the data and send it to clients via websockets
22:12nkozoblur3d: maybe is better to send the data using Data RTC
22:12justin_smithblur3d: so arduino->serial->compuer->www->client ?
22:13blur3dI haven’t really looked into Data RTC… I’ve tested websockets tho
22:13blur3dyeah, that looks right
22:14nkozoblur3d: Data RTC is like UDP, maybe is an advantage over websockets for your use case
22:14justin_smithyou could skip the computer and still have the hardware inputs (and still be running node as your server) if you used a beagle bone
22:14justin_smithbeagle->www->client
22:15blur3dI’ll look into it… I have it all working just using clojure… but i’d rather package it as an multi-platform app - so whatever node-webkit can support, it likely what I have to work with
22:15blur3dI need to get myself a beagle
22:15justin_smithwell with the profile described above, it would just be a standard node web page
22:16blur3dyeah… node webpage should work.. but I don’t know node webkit that well
22:16blur3dthe toolchain seems very broken
22:17justin_smithwell the beagle comes with the node webserver running and connected to the hardware ports by default
22:17blur3dand using node_modules with C extensions (like for serial), has been giving me problems
22:17justin_smithbut also has enough power that you should be able to pull off running jvm clojure
22:18technomancythe beagle bone is super pokey at jvming
22:18justin_smithone of the first things I tried with mine was sshing into the box, connecting an led to some hardware ports, and using bash to turn the led on and off
22:18blur3dI dont think I need the jvm - except for development
22:18justin_smithtechnomancy: OK, that sucks
22:18justin_smithyeah I have heard bad things about the jvm on arm actually
22:18technomancyI had better luck with racket
22:19justin_smithooh, that is an interesting option, yeah
22:19blur3dI’ve run simple clojure apps on the raspberry pi
22:19technomancythey just added badass arm jit in racket
22:19blur3dworked fine
22:21blur3dhmm, It’s interesting that with the beagle I wouldn’t need any arduino library… so somehow the user would need to specify/read sensor values
22:22blur3din any case, I plan to make the dashboard as generic as possible.. and you just send it data and it builds itself automatically as data comes in
22:22justin_smithblur3d: with a beagle it runs linux and you can just cat files under /proc to get port values or set them
22:22justin_smithcat out to proc/foo/bar to send a voltage, cat from proc/foo/bar to read it
22:22blur3dyep. but I am writing the dashboard to just be a dumb terminal
22:23justin_smithOK
22:23blur3dso somewhere you would need to tell it what to display
22:23blur3dhttp://dashingdemo.herokuapp.com/sample
22:23blur3dI’d like something along the lines of that
22:23justin_smithI hope you are considering using om
22:24blur3djustin_smith: but, I don’t see why the dashboard can’t be forked or extended for specific beagle use
22:24justin_smithsure
22:24blur3dyeah, plan to use React + om… that is what I needed the data transformation for
22:25justin_smithalso you should be able to pull in dashboard directly into beagle, since on default bootup it already has node serving web pages and able to read from / write to all the hardware ports via js
22:25blur3dthis is actually the inspiration for the project - Bret Victor, Seeing Spaces http://vimeo.com/97903574
22:25cespareI just found that if one of my test files has a syntax error, lein test ignores it completely.
22:26blur3dnice, that could be cool
22:26cespareis there a way to make it not do that?
22:26cesparebecause, y'know, that's terrible
22:26justin_smithblur3d: awesome demos in that vid
22:27blur3dYeah, Ive got a spare core (an arduino with built in wifi), and I’ve been using it to test tcp… and it is really cool to see it all working
22:28myguidingstarHi all, I'm considering a workflow for project using cljx+clojurescript.test
22:28blur3dbeing able to see the internals is magical
22:28blur3dsparkcore” http://spark.io
22:29blur3dThe arduino API is very simple
22:29blur3d#include "TestDrive.h"
22:29blur3dTestDrive.begin();
22:29blur3dTestDrive.setLabel(2, "Main Bedroom");
22:29blur3dTestDrive.sendTemperature(2, temp);
22:29myguidingstarI think it would be too slow to run auto cljx build + cljs build + running tests
22:30myguidingstarbut instance feedback is essential to me
22:30myguidingstarany suggestion?
22:31blur3dnkozo justin_smith technomancy: thanks for the discussion. I’ve got to head out.
22:32blur3djustin_smith: I’ll try and let you know what I have something working enough to push to github
22:32blur3dmight be a few weeks
22:33blur3dI’ve started to play with om, and I really like it, but I need to learn a fair bit
22:33justin_smithblur3d: awesome, do keep me updated
23:01cesparenvm, looks like a bug that's been fixed.
23:51visofhello
23:52visofi'm starting embedded server using java inside clojure, but only i need to return the object but verbose of the server also returned with the object