#clojure logs

2015-01-03

01:11djames,(some-> 0 inc)
01:11clojurebot1
01:12djames,(some-> 0 (fn [x] (inc x)))
01:12clojurebot#<sandbox$eval51$G__50__52 sandbox$eval51$G__50__52@788223f0>
01:12djamesWAT?
01:13djames,(-> 0 inc)
01:13clojurebot1
01:13djames,(-> 0 (fn [x] (inc x)))
01:13clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Parameter declaration 0 should be a vector>
01:14djamesWAT?
01:14djamesI suppose no one ever promised that macros wrapping special forms would work.
01:15djames(fn 0 [x] (inc x))
01:15djames,(fn 0 [x] (inc x))
01:15clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Parameter declaration 0 should be a vector>
01:16djamesIt makes sense now
01:21amalloydjames: yeah, it's nothing to do with special forms though, as i think you figured out
01:22djamesamalloy: yeah, macroexpansion time happens before all of it
02:16ElementsHi
03:30crocketIs http://www.braveclojure.com/ a comprehensive material on clojure?
03:36crocketHELLo?
03:48TEttingercrocket: I'd say yes
03:48TEttingeryou probably also want docs like grimoire and clojuredocs
03:48TEttinger~grimoire
03:48clojurebotgrimoire is a nifty set of api docs at http://grimoire.arrdem.com/
03:49crocketgrimoire sounds evil
03:49TEttingerheh
03:49TEttingerit
03:49TEttingerit's an old word for book, IIRC
04:24kenrestivoi think you mean olde.
04:25kenrestivoalso, it means a magickal reference text, http://en.wikipedia.org/wiki/Grimoire
05:21jonasenWhy is there no 'boolean?' predicate in clojure (or cljs)?
05:21Bronsajonasen: there's true? and false?, boolean? is just (or (true? x) (false? x))
05:22Bronsaagreed it would be useful to have in core, there's already a ticket in jira for adding a bunch of predicates
05:22Bronsabut it's low priority
05:22jonasenBronsa link?
05:22Bronsajonasen: http://dev.clojure.org/jira/browse/CLJ-1298
05:22jonasenBronsa thanks!
05:23jonasenha! I had already voted on that issue
05:24Bronsaheh
07:11masnun,(+ 23 34)
07:11clojurebot57
07:12mi6x3mmasnun: did you expect this result?
07:12masnunmi6x3m I was actually testing the bot
07:12mi6x3m;)
07:13masnun,(println "Hello bot!")
07:13clojurebotHello bot!\n
07:13hellofunk`would an http client as described on this page be referring to a browser? http://www.http-kit.org/
07:14mi6x3mhellofunk`: for example but not only, http client means anything sending HTTP requests
07:14mi6x3mit could be a browser, but it could also be plain wget or even your own clojure code
07:14hellofunk`mi6x3m: oh i see, so that clojure code could be a server making an http request to another server
07:14hellofunk`and thus the server would be a client
07:15mi6x3mhellofunk`: yep
07:15mi6x3mbut http kit is a library for both purposes hellofunk`
07:15mi6x3mit can serve and it can request
07:15mi6x3mdepends on what scenario you need it for
07:16hellofunk`i am trying to understand where the lines are drawn between jetty, ring, and http-kit. my guess is that ring is a higher level api that can operate on either jetty or http-kit, each of which is a server layer, is that right?
07:16mi6x3mhellofunk`: to begin with, http-kit is very low level
07:16mi6x3myou can do whatever you want with it
07:17mi6x3mjetty is a sophisticated server technology
07:17hellofunk`mi6x3m: but jetty and http-kit server similar purposes, i.e. you wouldn't use both in an app, you'd choose one or the other, right?
07:18mi6x3mhellofunk`: you wouldn't normally use http-kit to host web applications :)
07:18mi6x3mbecause you'll have to implement everything jetty already provides
07:18mi6x3mit can server html content indeed, but this is all it does
07:19hellofunk`mi6x3m: really? it seems to be quite popular and i am looking at it for serving websockets since i gather that jetty/ring (the typical standard combo) doesn't do this so well
07:20mi6x3mhellofunk`: take a look at what jetty provides https://wiki.eclipse.org/Jetty/Feature
07:22hellofunk`hm, it seems http-kit is where people typically turn to when they want to serve sockets, for example, sente: https://github.com/ptaoussanis/sente
07:24mi6x3mhellofunk`: yes, because jetty is heavy and people rarely need everything :)
07:25hellofunk`it says this: Why http-kit? Besides being a great web server, it currently offers by far the best high-concurrency support which is something Sente needs to lean on for WebSocket and long-polling connections.
07:25hellofunk`this implies that it handles sockets better than jetty, hence its popularity?
07:25mi6x3mI cannot judge. If people prefer it over Jetty it must be the case
07:26hellofunk`in a socketless app, if you only use ajax, how can your server arbitrarily choose to send info to the browser? doesn't ajax require the browser to initiate the data transfer?
07:27mi6x3mhellofunk`: it does, doesn't sound feasible
07:28hellofunk`perhaps that's where long-polling comes into play, which i should read up on
07:37nuwanda_long-polling or server sent events
07:47hellofunk`in a typical ajax scenario, when the browser initiates an XHR, is this a blocking action? if the server takes several seconds to respond, does the browser just wait, or does it continue doing other things?
07:49mi6x3mhellofunk`: well you never experience a blocking firefox do you :)
07:50hellofunk`looks like xhr can be either sync or async depending on how it is used: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests
07:50mi6x3mhellofunk`: even if it's sync the browser will let you do other things
07:50mi6x3mthe JS execution might block
08:05hellofunk`mi6x3m: here is the magic phrase from the Chord library page: Currently, Ring’s standard Jetty adapter ~does not~ support Websockets. http-kit is a Ring-compatible alternative.
08:05hellofunk`so that explains the http-kit popularity I think: it is more or less required for websocket use currently
08:07mi6x3mhellofunk`: in conjunction with Ring
08:07hellofunk`mi6x3m: yeah but just about everyone uses Ring, don't they?
08:08mi6x3mhellofunk`: no doubt about that, Ring is great
08:08hellofunk`so unless you go agaist the grain and choose not to use Ring, then if you want websockets, you need to use http-kit
08:09mi6x3mhellofunk`: without ring you can use jetty with websockets also
08:09hellofunk`mi6x3m: sounds painful to use jetty directly without ring
08:31hellofunk`what is the point of this in a project.clj: :exclusions [org.clojure/clojure]
08:33nuwanda_that's inside a dependency right?
08:34hellofunk`nuwanda_ yes
08:34hellofunk`nuwanda_ no actually it is inside the defproject but not inside the :dependencies
08:35nuwanda_weird, never seen it like that
08:36hellofunk`nuwanda_ : https://github.com/james-henderson/chord/blob/master/example-project/project.clj
08:37mi6x3mhellofunk`: it excludes over all dependencies
08:38nuwanda_ ;; Global exclusions are applied across the board, as an alternative
08:38nuwanda_ ;; to duplication for multiple dependencies with the same excluded libraries.
08:38nuwanda_from leiningen's samples
08:38hellofunk`and why would you exclude a dependency on clojure itself?
08:38nuwanda_i'm guessing not to shadow the clojure you're adding as a dependency on your own project
08:39nuwanda_but haven't read anything about that, just something I've assumed since i've seen it
08:39nuwanda_for the first time
08:39mi6x3mhellofunk`: well you are including clojure yourself :)
08:40hellofunk`mi6x3m: so you include it yourself and then tell any other libraries that have already included it to exclude it, perhaps thus preventing multiple versions of clojure getting into your app?
08:40mi6x3mhellofunk`: bingo, this will effectively force the libs to use your clojure
08:41hellofunk`mi6x3m: which means that those libs could *possibly* behave differently than the authors intended if future versions of clojure change a bit
08:42mi6x3mhellofunk`: ehm, yes, but the intention would probably be to use fixes for knowl issues :)
08:42mi6x3mhellofunk`: also, consider this. you are creating an ueberjar
08:42mi6x3madding 3 versions of clojure gets very heavy
09:07donbonifaciohow can I make a function that is variadic and may receive the variadic arg as a vector?
09:07donbonifacio(boo "a" "b") same as (boo ["a" "b"])
09:11AimHereThere's two or three ways, depending on what you're trying to do
09:13mi6x3mdonbonifacio: (defn boo [& args] ...)
09:13gfredericksdonbonifacio: that's not built in, you have to do it by hand; not built in because it's ambiguous and so generally a bad idea
09:13mi6x3mah, wait, you want to get them as a vector
09:13mi6x3mhm, you can write a macro?
09:13donbonifacioyes, I just did a side function
09:14donbonifaciostarting to dislike variadic for generic usage
09:14gfredericksdonbonifacio: do you know about apply?
09:14donbonifacioyes
09:14AimHereCouldn't you multimethod it?
09:15donbonifacioI used apply already for converting variadic to hashes, but this one with vector was more troublesoume
09:16justin_smiththe caller knows whether they are providing a single collection or separate args, so why not let them decide whether to use apply or not?
09:18AimHereFor this particular case, will you be able to tell from the number of arguments which case you're dealing with?
09:20donbonifacionop, didn't find a way to know with one was it
09:21gfredericks,(defn additatify ([nums] (reduce additatify nums)) ([x y & zs] (reduce + (+ x y) zs)))
09:21clojurebot#'sandbox/additatify
09:21gfredericksdonbonifacio: you can't in general, because it's ambiguous -- in general you might want to call a function with just one arg which happens to be a vector
09:22donbonifacioyes, lesson learned gfredericks
09:22donbonifaciofrom now on, explicit vector/hash via params
09:49justin_smithhellofunk`: mi6x3m: it is only possible to get one version of a dep. I guess the global exclusion makes it super clear that you want them to get their own clojure version, but an explicit clojure dep should override the other transative deps anyway.
09:51mi6x3mjustin_smith: I see, so leiningen does assume backward compatibility?
09:52justin_smithmi6x3m: it's as much about the underlying libs as that. The jvm only allows one version of a class (unless you do weird stuff) so only one version of the dep can be loaded.
09:53mi6x3mjustin_smith: oh
09:55nuwanda_I'm confused, than what exactly does ":exclusion [...]" do?
09:55justin_smithit prevents that library's dependency from being included from any of your deps
09:55Glenjaminit means "don't include this transitive dependency of this module"
09:55justin_smithwhich means either you don't actually need it, or the end user is assumed to provide a version
10:45SagiCZ1does any one of you know C#? what is your opinion on how its inheriting works in comparision to what clojure does? it seems extremely convoluted and complicated to me..
10:52mi6x3m-altSagiCZ1: in what regard
10:52mi6x3m-altit's a pretty standard OOP inheritance
10:54SagiCZ1mi6x3m-alt: there is volatile, override, new and all kinds of other modifiers that seem unnecessary to me
10:55mi6x3m-altSagiCZ1: well to you but there are scenarios to those. C# is quite flexible.
10:56SagiCZ1mi6x3m-alt: the question is, is there any scenario you can't achieve with clojure that you can in C#?
10:57mi6x3m-altSagiCZ1: no, they are both Turing complete :) both on a serious note, C# also considers nativeness
10:57mi6x3m-altand has a tight integration to .NET as a whole
11:03SagiCZ1what do you mean by nativeness?
11:06mi6x3m-altSagiCZ1: non-managed code
11:09ziltiWhat's the best way to run a function in a separate thread "indefinitely"? .run it? Put it in a future? Use a core.async/thread?
11:10gfredericksno reason for core.async if you're not using channels
11:11AeroNotixzilti: what problem are you trying to solve?
11:11ziltiI'm using channels
11:11ziltiAeroNotix: I write a server receiving stuff over a ZeroMQ socket, and want the receiving loop running in a thread.
11:12AeroNotixzilti: and the function has some kind of loop?
11:12AeroNotix,doc future
11:12clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)>
11:12ziltiAeroNotix: Yes. It distributes the incoming stuff over core.async-channels
11:12AeroNotixzilti: I'd probably just use a future for ease of implementation
11:12AeroNotixworry about more complicated things later
11:13ziltiAeroNotix: Okay. I wasn't sure if the runtime is okay with an indefinitely running future due to what it was designed for. Thanks!
11:13AeroNotixmeh
11:13AeroNotixit's easy to use (there are better things, sure)
11:16mi6x3m-altzilti: I am using the following for this task in my app: (async/go (while true .... ))
11:16mi6x3m-alti think it does what you need
11:16mi6x3m-alt(and that I am understanding you correctly)
11:17AeroNotixmi6x3m-alt: seems easier to just use future, no dependency if you don't need it.
11:17ziltimi6x3m-alt: I thought about using core.async/thread
11:17ziltiAeroNotix: I'm using core.async anyway, so that isn't an unneeded dependency for me
11:18mi6x3m-altzilti: they seem to be pretty equivalent in that case
11:18AeroNotixThe question remains, by being finicky about this, you seem to think there are tradeoffs between different approaches. What do you think those are and what are you trying to *solve*
11:18mi6x3m-altzilti: go has some extra functionality
11:19ziltimi6x3m-alt: For what I understood, core.async/thread creates a new thread while async/go uses one in the allocated thread pool thus possibly exhausting it after some threads, but I might be wrong with that
11:19mi6x3m-altzilti: I believe it's more about the parking of threads
11:20AeroNotixzilti: if you're worried about that, then just use Thread itself directly
11:20ziltiAeroNotix: I wasn't sure if there were downsides in the specific ways of running something in a thread
11:20Ent_,(partition 2 -1 [1 2 3 4 5])
11:20clojurebot((1 2) (1 2) (1 2) (1 2) (1 2) ...)
11:20mi6x3m-altzilti: yes that seems to be it, the parking allows you not to block an OS thread but to reuse it for something else if your operations are currently blocking it
11:20mi6x3m-altI suggest you use go
11:20ziltiAeroNotix: So for now I'm just using a future, I'm fine with that
11:21hellofunkwhat happens if a library you depend on is removed from clojars? i assume that your app will no longer work when lein cannot download it, is that right?
11:21ziltimi6x3m-alt: I doubt it's gonna park my thread when I'm not using the <! functionality?
11:22AeroNotixhellofunk: removing things from clojars is non-trivial.
11:22mi6x3m-altzilti: no, it will only park it if you use that and it blocks
11:22AeroNotixand entirely manual, and entirely upto the discretion of those in-charge of Clojars..
11:23hellofunkAeroNotix: ok, so library authors cannot on their own remove a library they have published to clojars, correct?
11:23AeroNotixzilti: mi6x3m-alt core.async/go should be only really used if you're using the parking operations. Otherwise it's just dumb.
11:23AeroNotixhellofunk: correct.
11:24mi6x3m-altAeroNotix: well intuitively it's better to always use parking instead of blocking a thread
11:24hellofunkAeroNotix: it just occurred to me the disaster that would ensue if libraries you depend on were to disappear, so that is a bit reassurring
11:24mi6x3m-altwith an exception to the resources the parking may be using of course
11:24mi6x3m-altbut how significant would that be?
11:24AeroNotixmeh, I'm done with this discussoin
11:24AeroNotixNothing useful is coming out of it
11:25ziltimi6x3m-alt: I'd have to look if ZeroMQ parks or blocks the thread when "receive" is called, but other than that I can't influence that
11:25hellofunkAeroNotix: which discussion, go or clojars?
11:25AeroNotixhellofunk: go
11:25AeroNotixzilti: it's a socket read, correct?
11:25mi6x3m-altAeroNotix: a discussion is useful :) we are considering 3 different alternatives
11:26ziltiAeroNotix: Yes, a read from a ZeroMQ socket
11:26AeroNotixzilti: so your thread blocks on that read
11:27ziltiAeroNotix: I assume so, yes. If ZeroMQ blocks, my thread blocks.
11:27AeroNotixYes.
11:28mi6x3m-altzilti: wait, zeromq would not park, the parking is offered by async
11:28AeroNotixmi6x3m-alt: hence why using go blocks for something like this is dumb
11:28AeroNotixthere's no reason to use them unless you are using parking operations *inside the go block*.
11:29mi6x3m-altAeroNotix: oh, now I see, yes, you are perfectly correct
11:29mi6x3m-alt(inc AeroNotix)
11:29lazybot⇒ 5
11:29mi6x3m-altit barely makes sense if the blocking is somewhere else
11:29ziltimi6x3m-alt: But since async can't know when it should block except when using <! it doesn't make sense
11:29mi6x3m-altyeah no sense at all
11:29AeroNotixand since it's a macro, they need to literally be present in the go block itself.
11:30AeroNotixnot some function that the go block calls.
11:30AeroNotixafaicu
11:30ziltiyes, correct
12:08AeroNotixWhat's the function that allows you to update a key in a map with a function, if the key already exists, call the function with the two entries
12:09justin_smithwith the two entries?
12:09kryftI have a simple ring server that uses postgresql; the code worked fine for months, but recently I started getting "ident authentication failed" PSQLExceptions. At first I assumed that something must have changed in the server's postgresql installation (I don't administrate it), but it seems that I can access the db fine through psql or python
12:09kryftSo I wonder if it might have something to do with clojure, jdbc or the jvm
12:10AeroNotixoh just update-in
12:10justin_smith&(update-in {:a 0} [:b] (fnil inc 0))
12:10lazybot⇒ {:b 1, :a 0}
12:10AeroNotixyeah that's it
12:10justin_smithI didn't understand what you meant by "two entries" in this context
12:10AeroNotixI meant the two values under the key
12:11justin_smith?
12:11justin_smithwhat two values?
12:11AeroNotixthe old and new
12:11justin_smiththat's not how update-in works
12:11AeroNotixNo, but I can do similar things
12:11AeroNotixwith update-in
12:11justin_smithsure
12:11AeroNotixenough that I don't need what I originally wanted
12:13AeroNotixoh there's merge-with
12:14AeroNotixjustin_smith: merge-with
12:14justin_smiththat sounds a bit closer to the logic you were describing, yeah
12:41AeroNotixhttps://gist.github.com/AeroNotix/8eca7a25a80c46c19dd9 how do I do this without eval?
12:42AeroNotix(aimed at gettings vars of symbols in macros)
12:44AeroNotixhmm, gist updated. Maybe something like that?
12:45AeroNotixoh there's a resolve function which kinda does this
12:52justin_smithAeroNotix: keep is the equivalent of (remove nil? (map ...))
12:52justin_smith&(keep rest [[1 2] [1] [3 4] [3]])
12:52lazybot⇒ ((2) () (4) ())
12:52justin_smithoops
12:53justin_smith&(keep next [[1 2] [1] [3 4] [3]])
12:53lazybot⇒ ((2) (4))
12:53andyfjustin_smith: You mean, (keep identity ...) is the equivalent of (remove nil? ...) ?
12:54justin_smithandyf: actually I meant what I said, he had (remove nil? (map ...)) and it can be replaced by (keep ...)
12:54justin_smithbecause keep wraps up the functionality of remove nil? and map
12:54andyfsorry, missed the context
12:54justin_smithnp
12:55justin_smithI could have been a bit more clear - (keep f coll) is the equivelent of (remove nil? (map f coll))
14:15gfredericksdoes anybody know if openjdk has anything special about their crypto classes? I tried pasting the AES code and compiling it on my own and it seems to run ~13x slower
14:27arrdemdnolen_: ping
14:27dnolen_arrdem: pong
14:28arrdemdnolen_: https://github.com/clojure-emacs/cider/issues/702#issuecomment-68606220
14:29arrdemdnolen_: just curious if you have feedback / alternate fix
14:29masnunI have setup lazybot in one of my IRC rooms. When I run the jar file, it takes around 500MB memory. I want to run the bot on a VPS where 500MB is more than I can allocate to it. Is there any way to make the bot take less memory?
14:30Bronsaarrdem: cljs frequently has both foo.clj and foo.cljs, it's not only for cljs.core
14:30dnolen_arrdem: no feedback other than that needs to work
14:30arrdemok that was my understanding.
14:30dnolen_arrdem: namespaces in general shouldn't be expected to be unique across platforms, that conclusion is correct
14:31arrdemthanks guys I'll dee what I can do.
14:31dnolen_arrdem: also you should prepare yourself of cljc, where the platform is mixed due to feature expressions
14:31arrdems/dee/see/g
14:32dnolen_s/of/for
14:32andyfdnolen_: Probably the easiest way to prepare for that, if one relies on tools.namespace, is to wait.
14:32arrdemdnolen_: yeah that's gonna be as andyf points out an issue of pushing tools.ns forwards.
14:33andyfor push for the desired changes after they are understood.
14:35arrdem(add-watcher feature-exprs #'arrdem)
14:36kryftCan I somehow pass a flag like -Djava.net.preferIPv4Stack=true to lein repl_
14:37kryftAh, apparently :jvm-opts in project.clj should work
14:38andyfDoes anyone know if the current feature expressions proposal means that Clojure's require/use behavior would change to look for a foo/bar.cljc file if no foo/bar.clj file existed?
14:41dnolen_just shipped out ClojureScript 0.0-2655, only change is that require no longer has :reload-all semantics & there is explicit support for :reload & :reload-all in `ns` and `require` forms
14:43arrdemandyf: I believe that's correct
14:43andyfYeah, looking at the wiki design page, it seems to say that. Looking at the latest Clojure/JVM CLJ-1424 patch now to see if it actually does that.
14:48andyfBronsa: What is the current & after-feature-expressions behavior intended to be if there is foo/bar.cljs and foo/bar.clj? after-feature-expression it appears to be: Clojure/JVM reads only foo/bar.clj, ignoring foo/bar.cljs. ClojureScript reads only foo/bar.cljs, ignoring foo/bar.clj. Does that sound correct?
14:49arrdemcljs ignores foo/bar.cljc? really?
14:49Bronsaandyf: I have absolutely no idea :P I won't bother looking into the proposed impl until a decision is taken
14:50andyfarrdem: There was no foo/bar.cljc in my example
14:50andyfBronsa: understood.
14:50arrdemandyf: my bad. understood.
14:50Bronsaandyf: what you said sounds intuitively correct to me though
14:51arohnerwow, lein figwheel is fucking magical once you get it set up
14:51andyfMaybe I should play around with the demo build of with-feature-expressions that someone published recently.
14:51arohnerhighly highly recommended for all Om/react projects
14:52dnolen_https://github.com/levand/fx-hello-world
14:52dnolen_arohner: figwheel rocks
14:52andyfThis one, by Luke Vanderhart, in case it wasn't obvious what I meant: https://github.com/levand/fx-hello-world
14:55bbloomdnolen_: arohner: https://twitter.com/BrandonBloom/status/550827517662470146
14:55bbloomand https://github.com/brandonbloom/cljsd/blob/master/README.md
14:55bbloomi'm still kinda "meh" on figwheel
14:56arohnerbbloom: I like that approach, but the 'push' nature of figwheel is amazing
14:56bbloomarohner: i'd rather achieve push via "re-evaluate this file"
14:57arohnersure
14:57arohnerI miss not seeing compile errors when I C-c C-k
14:57dnolen_bbloom: Working on the compiler means at least 50% time I never want to see a browser. For the other cases I prefer figwheel.
14:58bbloomi'm using cljs for a personal project now, but i'm doing something highly crazy... i'm quite happy with my entirely unreproducible custom hackery
14:58dnolen_bbloom: but that is an interesting approach
14:58dnolen_bbloom: but w/o going to disk doesn't solve the slow start problems that drive me crazy
14:58bbloomi basically build all the cljs code in clj in memory and then define a single macro that emits everything
14:58bbloomthen i just call the cljs compiler with that one macro
14:59dnolen_bbloom: also you can't shared analysis information across processes
14:59bbloomworks fine for my uses & lets me mostly do everything in clj until i need :-)
14:59dnolen_bbloom: in any case - if it works for you, great!
14:59bbloomi just clojure.core/eval that macro when i need to test jvm-side :-)
15:00bbloomi'm sure any sane clojurist would view this as the ramblings of a mad man
15:00bbloombut it works for my particular needs
15:00bbloomand it's a personal project, so screw other programmers :-)
15:00arrdemwe're all mad here
15:00arohnerbbloom: being a clojurist, I'm quite used to *everything* being viewed as the ramblings of a mad man
15:00arohnerarrdem: beat me to it!
15:00bbloomheh
15:01arrdemandyf: so I suppose this means we want a ClojureScript cheatsheet build at some point..
15:03andyfarrdem: I can help, but believe it or not, I haven't ClojureScript'd, so would likely miss some finer points, if not big things.
15:06dnolen_someone should work on parallel compilation for ClojureScript seems like a simple optimization w/ likely some nice gains especially for larger projects - http://dev.clojure.org/jira/browse/CLJS-957.
15:07bbloomdnolen_: would be super cool
15:15andyfBronsa: arrdem: In partial answer to my earlier question, the answer for Clojure/JVM is that require/use/load of "foo/bar" will look for foo/bar.clj first, and if not found, will look for foo/bar.cljc. The latter file will be ignored if both exist.
15:16andyfMy guess is that it would be an unusual situation for both files to exist.
15:23andyfBronsa: What does ClojureScript do when there are two files for the same namespace, i.e. /src/cljs/cljs/core.cljs and /src/clj/cljs/core.clj - does it read and use both?
15:24Bronsaandyf: only the cljs, it uses the clj just for macros
15:24andyfBut it must read/analyze/compile/etc. the .clj file in addition to the .cljs file, or it will not do the correct thing?
15:26Bronsaandyf: when you require foo.bar, it will just load foo/bar.clj using c.c/load if it finds one in the classpath
15:26Bronsaandyf: no manual analysis
15:29andyfit sounds like arrdem is saying here https://github.com/clojure-emacs/cider/issues/702#issuecomment-68606220 that there can be both a .clj and a .cljs file with the same namespace. I am curious whether ClojureScript ignores one of those files in such a case, or pays attention to them both. Perhaps his issue was specific to processing files inside of the ClojureScript implementation itself, though, not the typical ClojureScript
15:29andyfproject.
15:31arrdemandyf: specifically that was for cljs itself, but I would guess that if you require and require-macros that cljs will happily load both implementations of "the same" namespace.
15:39TimMcMaybe the next time we get roped into a frontend project at work we can use Clojurescript.
15:39TimMcI want an excuse to try Om. :-P
15:46arohnernot quite a clojure question, but how TF do you get chrome to respond with "net::ERR_INVALID_RESPONSE", in a standard ring app?
15:46arohnersome urls work fine, and other reliably cause that error. The response looks fine to me, according to clj-http
15:47arohnerhrm, it might have something to do with a ring-defaults option
15:54kenrestivoandyf: it'd be cool if eastwood could catch (defn foo [{:keys [bar baz]}] (something bar)) <== baz is destructured but not used
15:57cflemingarrdem: When I added CLJS support to Cursive, I had to add language as a data item to all my internal structures - indexes etc
15:57cflemingarrdem: You definitely need to know the language to
15:58cflemingarrdem: Oops
15:58cflemingarrdem: Resolve properly
15:59arrdemcfleming: yep. shouldn't be too bad, just need to do it and rebuild.
16:18cflemingandyf: It is very common to have both a clj and cljs namespace with the same name and file structure
16:20cflemingandyf: This is used by :include-macros or :refer-macros
16:27seangrovednolen_: What do you think about a hand-written js-lib that pulls in mori as a dep, but exports a js-style API (camelCase, map(coll, fn) vs map(fn, coll), plus a chaining fn to easily chain things)?
16:27seangroveI'd be happy to do that, and I think it'd obviate a lot of the need for something like immutablejs
16:27seangroveAnd the API's change slowly enough that maintaining it by hand shouldn't be too bad
16:28bbloomseangrove: what's the difference between that and mori?
16:29seangrovebbloom: Just JS sugar
16:29bbloomis it literally camelCase instead of snake_case ?
16:29seangrovecamel case, arg order, and a chaining API
16:29seangroveimmutable-js is cool, but it's missing a lot of the work that's gone into cljs data structures, obviously
16:30bbloomthis is half a thought, but aren't transducers essentially a chaining api?
16:30mi6x3m-altBronsa: hey, do you think you might release tools.analyzer soon?
16:30seangrovebbloom: Yeah, they could be (and more efficient at that) - I haven't thought this all the way out, just thinking about the three args I hear against Mori
16:31seangroveNeeds to be chainable (js devs love their chaining apis even with the batshit insane hard-coded return semantics), camelCase, and with the callback (or fn) last (like node or swift)
16:31bbloomseangrove: my assumption is that wrapping mori is a waste of time, as it's a direct wrapper of cljs
16:31bblooman alternate wrapper that is more js friendly may make sense, but i'm skeptical
16:32bbloomover time, i've learned to not really care too much about two libraries with incompatible naming conventions, but i understand it causes many folks to freak out
16:33seangrovebbloom: Trying to find a way to help direct more energy into cljs data structures rather than splitting into immutablejs vs mori
16:33mi6x3m-altBronsa: ignore my last statement, the necessary versions are out already :)
16:33seangrovebbloom: And the js community clear prizes... erm... convention over other salient aspects
16:35bbloomseangrove: *shrug* data types are a cross-cutting concern. unless you can clearly win as THE ONE AND OBVIOUS CHOICE for data structures in js land, you're never going to escape duplication of efforts. and no matter what you do, i don't expect cljs' impl to bend to the will of node.js folks et al, so it seems like a lost cause to reconcile
16:35seangroveBut yes, bypassing Mori would make sense since it's doing the same thing, I just wonder if it isn't the same thing with slightly different compiler settings.
16:35seangrovechenglou: Any thoughts, having used both?
16:35bbloomiirc mori is mostly generated anyway, so yeah, probably just slightly different code generator
16:36otwieraczHello.
16:36seangrovebbloom: I'll chew on it a bit, seems like it's a weekend or two project, not too much more than that, and could have some nice implications for use in e.g. immutablejs, etc.
16:37seangroveBut maybe that differing needs and FB's inability to pull cljs development their way would be a deal-breaker
16:37chenglouI love mori lol
16:37chenglouthe perf's superb. I don't care about some micro benchmarks on iteration speed
16:38chenglouthere are much bigger perf gains to be had in mori
16:38chengloubut yeah js people want js API. Swap argument order (callback last), camelCase and chaining would do the thing
16:38chenglouit's either that or everybody flocks to immutable-js
16:39chenglouwhich is fine by me. I don't care much
16:39bbloomi see no chance of mori gaining real popularity
16:39bbloomor anything built on cljs' structures
16:39bbloomthe npm world is too volatile
16:39chenglouwell, immutable-js sure is popular
16:40bbloomsomebody will open a cranky github ticket and twitter will asplode b/c cljs is not "the node way" or something and then somebody will release a persistent data structures "micro framework" or some shit :-P
16:40otwieraczI an trying to follow http://docs.opencv.org/2.4/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html
16:41AeroNotixCan I put defmethods into different namespaces?
16:42justin_smithAeroNotix: absolutely
16:42AeroNotixah, cool.
16:42chengloubbloom: but we already did lol
16:42chengloubbloom: and the wrapper's goal is exactly to be "the node way"
16:42bbloomchenglou: exactly
16:43AeroNotixjustin_smith: do I need to namespace-qualify the defmethod's target in the other namespace/
16:43AeroNotix?
16:43bbloomchenglou: that's exactly what happened and exactly what would happen again, since everything happens in a loop in node land
16:43justin_smithAeroNotix: yes, it belongs to that namespace, so needs to be qualified properly
16:43AeroNotixjustin_smith: thanks
16:46dnolen_seangrove: I honestly don't have that much time to maintain mori & w/ ImmutableJS it's somewhat less compelling to maintain.
16:46dnolen_seangrove: that said I definitely see the value - ImmutableJS has lots of bugs we've ironed out and way more functionality
16:47dnolen_seangrove: one weird problem is that JS users don't have the CLJS compiler to optimize calls to multi-arity / variadic fns
16:47dnolen_seangrove: so they take a significant perf hit
16:48dnolen_seangrove: but maybe that doesn't matter?
16:49dnolen_seangrove: there's also the alterior motive to let ImmutableJS win & not create competition though that's a longer term strategy
16:49dnolen_er I meant Mori has way more functionality of course
16:50chengloudnolen_: got 2 mins?
16:50chengloudnolen_: I have something really interesting that you might wanna check
16:50dnolen_chenglou: sure what's up?
16:50chengloukk sec, putting the last touch
16:55chengloudnolen_: https://rawgit.com/chenglou/react-state-stream/master/index.html
16:56chengloudnolen_: I didn't bother porting it to cljs because I still don't know om/reagent too well. But I think I've found the general API for tweening & unmounting transition
16:56chengloucheck the readme for more details
16:57chengloudnolen_: I like how simple it is (mixin's like 40 lines of code). We could have first-class support for it in React in the future and it's not animation-specific.
16:59chenglouconvenience link https://github.com/chenglou/react-state-stream
17:00dnolen_chenglou: very cool, will need to read over it a few more times but this looks really promising!
17:01chenglou=). Feedback appreciated. This basically boils down to "how do you express a flash timeline in code without FRP"
17:03dnolen_chenglou: huh what's in mori that's missing from ImmutableJS? I thought there were LazySeqs there
17:04rhg135dnolen_, great work on cljs; the node repl is amazing
17:05dnolen_rhg135: thanks, glad to hear it you're liking it!
17:05chengloudnolen_: immutable-js lazy seqs don't cache (it's all or nothing)
17:05dnolen_chenglou: ah right, that'll make a big difference
17:06chenglouso when I'm consuming the tail at each frame, it uses O(n^2) for each get
17:06rhg135i do have one question though, how are you suppose to use macros?
17:06chenglouafter a minute it's like 10k operations and it's recursive, lol
17:06dnolen_rhg135: (require '[cljs.repl :refer-macros [doc]])
17:07rhg135dnolen_, i mean like in core.async where it's an entirely different ns name
17:07dnolen_rhg135: there's actually a pretty interesting proposal for macro usage inference that will hopefully get rid of this http://dev.clojure.org/jira/browse/CLJS-948
17:08rhg135wow, thatd be nice
17:08dnolen_rhg135: hrm, actually that's probably an oversight, could add require-macros special fn in the meantime
17:09rhg135ah ok
17:09rhg135i figure :refer-macros didn't exist when core.async started
17:10dnolen_rhg135: that's right
17:10dnolen_rhg135: fixing this now
17:11rhg135thx, dnolen_
17:11dnolen_rhg135: thanks for the feedback
17:11dnolen_chenglou: will definitely poke around at this and get back to you
17:12chenglouCool
17:12andyfcfleming: Thanks for the info. Is it true that ClojureScript _only_ pays attention to .clj files if a .cljs file has :refer-macros or :include-macros ?
17:12rhg135dnolen_, i did run into a NPE with piggieback from the cljs.repl.node/setup fn but since it works sans nrepl i filed an issue with piggieback
17:12andyfkenrestivo: Could you create a Github issue with an example (that one would suffice)?
17:13seangrovebbloom: Missed your PDS "microframework" - like that idea, I'm on it
17:13dnolen_andyf: those are sugar - (:require-macros ...) is the trigger to load .clj files
17:16bbloomseangrove: *sigh*
17:20dnolen_rhg135: cutting 0.0-2656, in line in Hudson behind some tests but it should be out in a hour so I imagine - will push out a new mies when it does
17:22rhg135dnolen_, cool, i don't do many webapps so i never did do much cljs but node seems perfect for me
17:23kenrestivoandyf: sure, thanks
17:26hellofunkdnolen_ brings holiday productivity to a whole new standard. inspiring, actually
17:30dnolen_rhg135: released
17:30andyfkenrestivo: Have you tried option '{:add-linters [:unused-locals]}' and/or :unused-fn-args ? Those might already do what you want. They are disabled by default because they can be fairly noisy.
17:31kenrestivooh, ok, will do.
17:31rhg135dnolen_, thx, restarting repl
17:33kenrestivooh, cool, unused-locals works
17:33andyfgood. I should have thought of that when you first asked instead of suggesting creating the issue -- a little slow today :)
17:34rhg135dnolen_, maven central takes a while sometimes but ill retry in a while
17:34dnolen_rhg135: it's usually really fast, 15 minutes or so
17:35cflemingdnolen_: CLJS-948 looks interesting, I think that would be a good change if there are no wider implications
17:36dnolen_cfleming: pretty sure there isn't, it's riding on a convention that's already in place and it requires something explicit - the inference is not really an implicit thing
17:37cflemingdnolen_: I was hoping for something that would make it explicit on the macro def whether it was for CLJS or CLJ, but it still looks like a nice change
17:37dnolen_cfleming: yeah that's probably never going to happen
17:37rhg135it'd be nice for core.async to follow it (since it helps with the oh-so-common asynchrony in js) but ya
17:37cflemingdnolen_: I know, I'll have to try to index that somehow
17:38dnolen_rhg135: agreed probably something to reconsider in the near future
17:39rhg135in om it's pretty seamless
17:39rhg135i was writing code for a while then i realized "isn't go a macro"
17:40cflemingdnolen_: BTW I think I'll have the macroexpander in the next drop
17:41dnolen_cfleming: sweet!
17:41cflemingdnolen_: clj only for now, but respects &env and allows arbitrary subforms to be expanded
17:42dnolen_chenglou: this is really nice and simple
17:42dnolen_chenglou: I don't see the need for infinite streams in this case, seems like if mori.seq(foo) => null, you know you don't have to invoke rAF again
17:43dnolen_chenglou: maybe I missed something?
17:43rhg135i can't wait for the next cursive it sound like it's a fairly major improvement over an already useful tool
17:44cflemingrhg135: Thanks, lots of good stuff coming up - I'm hoping to add the node REPL in the next couple of releases too
17:44andyfcfleming: Does this macroexpansion always start with outermost forms until it gets to some form selected by the user for expansion? There are at least some cases where the inner expansions are affected by outer ones.
17:45rhg135cfleming, in my testing it seems to work fine in the normal editor just not in the repl editor
17:45chengloudnolen_: is that what I'm taking about in the perf optimization section? Like, conceptually repeat(s) is the same as [s]
17:45cflemingandyf: Yes - I always macroexpand from the top level form, but only display from the form the user selected
17:45chenglouThe lazy seq with a single state left
17:45dnolen_chenglou: or lazy seq w/ no more states to go to, the seq is exhausted
17:45andyfDid you write your own, or found one that works well?
17:46dnolen_chenglou: you can just set state to the final value then
17:46cflemingandyf: I add a metadata tag to selectively expand subforms too
17:46cflemingandyf: I'm using a hacked version of riddley
17:46cflemingandyf: So it's only clj right now, I need to investigate the cljs expander but will probably do something similar
17:46andyfI haven't yet looked terribly carefully at the file/line/col tracking during macroexpansion in Eastwood, but probably will some day.
17:47chengloudnolen_: yes that's exactly what I was gonna do. I didn't bother simply because I didn't want to deal with mapping over the old seq then finding out that the seq wasn't long enough
17:47cflemingandyf: I was surprised how much of that is thrown away
17:47cflemingandyf: I had to modify the expander to maintain the tags I'm interested in
17:47dnolen_chenglou: also in the examples seems you could just use plain JS objects
17:47andyfAny possibility of publicizing your hacks to riddley?
17:48cflemingandyf: Absolutely. In fact if it's EPL I assume I'm required to do so.
17:48hellofunkcfleming: i'm about to try Cursive on a new project starting this week, looking forward to really kicking its wheels
17:48dnolen_chenglou: instead of mori hash maps I mean
17:48cfleminghellofunk: Great, I'm interested to know how you find it
17:48chengloudnolen_: they'd mutate throughout the whole seq though
17:49hellofunkcfleming: i'm sure i'll have plenty of questions so i'll hit up the mailing list
17:49crack_userhello guys
17:49cfleminghellofunk: Sounds great
17:49dnolen_chenglou: I just mean that they are small, so might be faster to Object.extend is what I mean
17:49dnolen_chenglou: and you don't need to bother with clj_to_js which I know is slow
17:51chenglouTrue. I ported this over from immutable JS to Mori yesterday so it's really not optimized
17:52chenglouI'm not worried about perf for now though =)
17:52dnolen_chenglou: ah k :)
17:54chenglouWas really fast to rewrite the few lines of immutable JS though. Which is why I thought an idiomatic JS helper (easy to make easy to maintain) for Mori might be a good idea
17:57dnolen_chenglou: right, I'd be OK w/ a more idiomatic JS naming scheme for mori's API
17:58ticking_dnolen_: I just stumbled upon reference-cursors, they're exactly the explicit cursor thing I asked for a few days ago :D, thanks for always thinking ahead!
17:58dnolen_chenglou: well I like it! seems cool and straight forward
17:59ticking_(inc dnolen_)
17:59lazybot⇒ 9
17:59justin_smith(inc dnolen)
17:59lazybot⇒ 19
17:59chenglouThx =)
17:59dnolen_ticking_: heh
18:01dnolen_chenglou: the cancel transition logic is very slick
18:01chenglouI like it a lot. I think that was the only real challenge in (react) transitions. How to animate during unmounting
18:02chenglouThe TransitionGroup add on is basically a hack
18:02chenglouHave you seen the two examples I have in the readme
18:02chenglouPhotos swiping and orientation change
18:03chenglouOh wait, cancel transition? I think I'm talking about something else lol
18:16mi6x3m-altis x.y.z-clj a good name for a clojure wrapper around a java library?
18:17scottjmi6x3m-alt: not if you don't own x.y.
18:18mi6x3m-altscottj: define "own" ?
18:18scottjmi6x3m-alt: if it's com.foo and you don't own foo.com.
18:18mi6x3m-altscottj: no, it's not domain-like
18:18mi6x3m-altit's words
18:20scottjis the java library yours? (you created it or are the maintainer etc)
18:20mi6x3m-altscottj: nope, 3rd party work
18:20scottjthen it's a bad name imo
18:21mi6x3m-altI think you are indeed right
18:28mi6x3m-altcan one set a default profile with leiningen?
18:28mi6x3m-altlike dev-32?
18:29KristienPlaying with core.async and Om
18:29KristienIt's so fun
18:30mi6x3m-altKristien: the combination or the parts are fun? :)
18:30Kristienboth :p
18:31KristienIt's for a tool I'm working on, all I have to do now is swap out the timeout for a websocket: https://gist.github.com/rightfold/66ea8d6514aa740032d0
18:53ed-gIs there a library that will let me parse a date-time with time zone? clj-time only parses UTC
18:55justin_smithed-g: to-time-zone
18:55ed-gjustin_smith: thanks!
18:55justin_smithed-g: to-time-zone
18:56justin_smitherr, sorry (client issues0
19:40ambrosebsis there a macro for (and (-> a ...) (-> a ....) (-> a ...) (-> a ....))
19:40ambrosebswhere ... is different in each case
19:43theme2ambrosebs, something using apply?
19:44ambrosebsjust wondering if there's a clojure.core threading macro for this pattern
19:45hyPiRionnot afaik
20:29weavejesterHas anyone come across a good way to manage core.typed and core.typed.rt dependencies in Lein?
20:30weavejesterThe only way I can think of doing it is with a custom deploy profile and some aliases to override "lein deploy"
21:35hiredmancan't you just stick one in the dev profile and the other in your regulard depdencies?
21:42ambrosebsweavejester: yes dev profile is how I would do it https://gist.github.com/frenchy64/0b389202c7dc3778bd52
21:44weavejesterambrosebs: How does Lein know that core.typed overrides core.typed.rt?
21:44ambrosebscore.typed depends on core.typed.rt
21:44ambrosebsand there is no overlap on files
21:45weavejesterambrosebs: Oh! I see
21:45weavejesterThat makes things a lot easier
21:45ambrosebsgood
21:46weavejesterIs this all on the wiki somewhere, or could I add a page on it?
21:46ambrosebstook me a month to figure out the best way :)
21:46ambrosebsplease document it
21:46weavejesterIt's a clever solution :)
21:46ambrosebsthankfully cemerick did the dirty work for me
22:05justin_smithambrosebs: what about (doto a (-> ...) (-> ...) (-> ...)) - not complete, but may be a nice way to do it
22:07ambrosebsjustin_smith: I was looking for an idiomatic solution without writing a macro
22:14kenrestivoaha, doing async/>! inside of a swap! or a send or a send-off causes core.async to lock up hard.
22:15kenrestivoi suspect this is unsupported, but i don't remember seeing that in any docs.
22:15hiredmankenrestivo: there is no "inside" of swap! or send
22:16hiredmanthey are higher order functions
22:16justin_smithI would have suspected it was a bad idea based on the fact that swap! retries
22:16hiredman>! only works inside go blocks, the go macro does not descend in to functions
22:37kenrestivohiredman: "inside" meaning from within the swap fn
22:38kenrestivohiredman: thanks! i was told it did. that makes perfect sense.
22:56hiredmanI could be wrong, but as far as I recall it doesn't and it never has (and it is crazy that it doesn't error out)
22:58hiredmanhttp://dev.clojure.org/jira/browse/ASYNC-98
23:02kenrestivoi had expected it would not. i only tried because someone told me it did.
23:03kenrestivoalso, now i'm finding it locks up when inside a async/thread, using async/alts!! on a channel that is being fed from a go block.
23:04kenrestivoi.e. (let [c (async/go "foobar")] (async/thread (loop [] (async/alts!! [c some-other-chan (async/timeout 1000))) ... the timeout never fires, everything just locks hard
23:05kenrestivo(that's an oversimplified example, the real failing code has got a lot more moving parts)
23:05hiredmanwhat makes you think the timeout never fires?
23:06kenrestivoi think i made a grave error by using core.async without a) better documentation available, and b) not being anywhere near as smart as rich hickey and tim baldridge
23:06kenrestivoi don't know if it fires, but the alt!! never returns
23:06kenrestivowhich it would if the timeout fires, i expect
23:06hiredmanwhat makes you say that?
23:06kenrestivoum, because the code just locks up
23:06kenrestivolines following the alt!! call never execute
23:07hiredmanhow do you know?
23:07kenrestivothe next line actually is (log/trace "this works now")
23:08hiredmanif you take out the alts!! does that happen?
23:08hiredman(do you have trace logging enabled?)
23:08kenrestivoyes i do. and i know the alt call is being called because i have another log line right before it
23:08kenrestivowill try removing the alt completely, interesting idea.
23:13kenrestivohiredman: thanks for your epistemological questions. found a bug somewhere else that may be causing this.
23:20rhg135dnolen_, apparently i thought it'd be 0.0-2656 and it's 0.0-2657 but it works fine
23:20rhg135(inc dnolen_)
23:20lazybot⇒ 10
23:37dnolen_rhg135: cool