This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-17
Channels
- # admin-announcements (4)
- # beginners (35)
- # boot (183)
- # cider (28)
- # cljs-dev (4)
- # cljsjs (1)
- # cljsrn (5)
- # clojure (52)
- # clojure-austin (4)
- # clojure-russia (83)
- # clojure-sdn (1)
- # clojure-uk (18)
- # clojurescript (48)
- # core-matrix (5)
- # cursive (4)
- # datomic (23)
- # devcards (2)
- # dirac (43)
- # editors (2)
- # emacs (4)
- # events (5)
- # funcool (2)
- # hoplon (81)
- # immutant (3)
- # juxt (3)
- # ldnclj (1)
- # luminus (12)
- # off-topic (6)
- # om (72)
- # onyx (32)
- # parinfer (2)
- # pedestal (1)
- # proton (6)
- # protorepl (3)
- # re-frame (30)
- # reagent (2)
- # spacemacs (2)
- # specter (1)
- # testing (1)
- # uncomplicate (3)
- # untangled (15)
- # yada (10)
I'm reading up on Specter, and it seems really powerful and useful. Anyone have an opinion? Pitfalls or limitations I should look out for as I experiment?
@zcaudate: I assume you have a large data structure in a single function?
We use Hiccup to generate some pretty complex web pages and don't hit that error, but all our functions containing Hiccup fragments are pretty small and they are composed (and mapped over data structures) to build the full page.
@seancorfield: yeah… it just snuck up on me… having said that… I don’t think the datastructure I need parsed is THAT big… and it’s really a shame that there is no unmacroed version of hiccup
is there any way to keep track of the amount of bytes read from an inputstream? or do i have to start using Java magic for that?
not exactly, multiple transformations (`map`, filter
et al) get fused into one stack of function calls
hey there’s this function that takes a function that returns a bool and makes it return the opposite boolean value.
is there some kind of meta input-stream that combines a sequence of input streams into a single input stream?
the problem i'm solving: i have remote locations (s3) of chunks of a big file (video) .. i want to "combine" all those chunks into a single big file
so, what i'm planning to do: transform remote location into an input-stream, then run (reduce) on the sequence to reduce it into one big stream
Perhaps you want to write a fn that returns a proxy that implements InputStream, implementing the read methods by reading from its seq of input streams until exhausted
yeah, i was afraid it was going to be something like that, which is exactly what i want to avoid
Is there a built-in like this? (x even? [1 2 3 4 5])
=> [[2 4] [1 3 5]]
?
user=> (vals (group-by even? [2 3 4 5]))
([2 4] [3 5])
using vals
requires extra checking of the first item to be sure
but yeah, I guess group-by is the way to go
@niwinz: figured using group-by
is fine and has the advantage about being explicit about where are what values: {:even [...] :not-even [...]}
vs. [[2 4] [1 3 5]]
quick question
let’s say i wanted to take a function like (defn add [a] (+ a a))
, and later in my code, get the actual code for the function, like '(defn add [a] (+ a a))
, so that i could walk it
@micahasmith: There’s no general way to do this. You could get source filename and line number and read it in, or you could create a macro that attaches the source to the function.
you know, i think the macro-way could work for me. thanks @eraserhd !
@urbanslug: maybe #C03S1L9DN gives you better feedback.
@urbanslug: cljs.core.async does not have a thread blocking version of take <!!
jr: I don’t know why I don’t think of these as thread blocking versions but rather...
Consider (def a "apple")
. Is there a way to replace a
with an expression? Something like (def (symbol a) "apple")
?
I tried in a REPL and it spits out an error
@george.w.singer I would probably use macros for that
If the task is more complicated than what you've written of course :)
george.w.singer: if you don't need the metadata def adds, it's simple to do with intern
But yeah, if you need to call def because you like def's metadata additions, you need a macro. But I think, as in the real world, intern
is under-appreciated.
@noisesmith thanks for pointing me in that direction