This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-22
Channels
- # architecture (1)
- # aws (3)
- # beginners (78)
- # boot (33)
- # cider (49)
- # cljs-dev (3)
- # clojure (82)
- # clojure-berlin (2)
- # clojure-dusseldorf (14)
- # clojure-gamedev (75)
- # clojure-italy (15)
- # clojure-nl (2)
- # clojure-poland (9)
- # clojure-russia (1)
- # clojure-spec (11)
- # clojure-uk (91)
- # clojurescript (17)
- # core-async (2)
- # cursive (1)
- # data-science (3)
- # datascript (34)
- # datomic (13)
- # docs (2)
- # duct (32)
- # emacs (8)
- # fulcro (95)
- # instaparse (17)
- # jobs (2)
- # jobs-discuss (1)
- # jobs-rus (4)
- # leiningen (1)
- # luminus (1)
- # lumo (4)
- # mount (1)
- # nrepl (1)
- # off-topic (98)
- # onyx (13)
- # portkey (12)
- # re-frame (10)
- # reagent (11)
- # remote-jobs (4)
- # rum (3)
- # shadow-cljs (34)
- # specter (7)
- # sql (1)
- # tools-deps (8)
@vincent.cantin A link at the end of each part pointing to the next part would be helpful.
You are right. I am also thinking about adding a TOC with a link to all the parts at the beginning of each part.
How about the content?
I found the jump from stateless to stateful a little confusing. It's not clear why there is an extra layer there. A fn returning a fn is easy to understand, but why do we then go to a fn returning a fn that returns a fn? I don't need an answer here, just commenting that I found that bit confusing and it might be worth clarifying.
Ok. I will do more thinking tonight from home and maybe add something to explain more.
Thank you for your feedback ๐
I made some adjustments so that the transducers are always presented the same way.
Does it feel better now?
And the pic in part 1 is a pretty good demonstration but it's not obvious unless you know the game. Maybe it would work better as a gif?
Good suggestion. I will add that tonight.
I made the change you mentioned about the link at the end.
@vincent.cantin Great article! A question and a suggestion...
Let's move the conversation in a thread.
In part 5, you test reduced?
and then call deref
on the value -- which may be confusing since you only talked about unreduced
in part 4 without explaining that a reduced
value can be deref
'd. Not sure whether it's better to use unreduced
in part 5 or explain exactly what unreduced
does in part 4.
You are right. I probably rushed too much toward the end without explaining. I will add more info there.
In part 4, you mention ensure-reduced
but because you give the source, readers might assume they need to type that in. Might be better to either just describe what the function does or make it clear that you are showing the source of a built-in function.
Oh, that's true.
So, that was actually two suggestions ๐ Here's the question: did you actually find a use case -- or even any reasonable documentation -- for the 0-arity transducer?
I opened a stackoverflow question about that. I should link it in the post for people who wonder.
Cool. I'll have to go and "follow" that since I've never seen a good explanation for it...
here is the link https://stackoverflow.com/questions/48848876/transducers-init-not-called
Not sure if this is the right forum to raise nREPL issues.
I am getting the following error while trying to load a buffer to my (remote) REPL:
Exception in thread "nREPL-worker-0" java.lang.IllegalArgumentException: No implementation of method: :send of protocol: #'clojure.tools.nrepl.transport/Transport found for class: clojure.tools.nrepl.middleware.load_file$wrap_load_file$fn$reify__668
Complete stack trace: https://pastebin.com/fafec0AV
My profiles.clj:
{:repl {:plugins [[cider/cider-nrepl "0.17.0-SNAPSHOT"]
[refactor-nrepl "2.4.0-SNAPSHOT"]]
:dependencies [[org.clojure/tools.nrepl "0.2.12"]]
}
}
Effectively none of my required namespaces are getting loaded.
Any help/pointers would be helpful. TIA.@rahulr92 Well there are #nrepl and #cider channels that might be better placed to help you with something this specific. It sounds like a version mismatch between your client (in Emacs?) and your server dependencies... As I recall, cider-jack-in
has been adding dependencies automatically for a while so specifying them in a :repl
profile doesn't sound necessary... but, on the other hand, I stopped using Emacs/CIDER a year or two ago so I'm no authority (I switched to Atom/ProtoREPL).
@seancorfield Thanks. I am using cider-connect
to connect to a remote REPL from my local Emacs (Spacemacs). The profiles.clj mentioned is of the remote host where I am running a headless lein repl
. I will try reaching out to the channels mentioned.
In general the more languages you know, the easier it's to learn a new one. It probably takes some time to get used to lisp, and to get most out of it being a dynamic language. Having worked, and still working with Java, I still not make optimal use of the repl.
A big part of the learning curve for Clojure is understanding basic functional programming concepts, so if youโve already got that via haskell/scala then youโre ahead of the curve.
Hi, I am new to clojure. I have some information I want to store in a map, but the โunique identifiersโ of that information is composed of different fields, so what would be a way ti generate a key for this map? join the different fields together in a string or keyword? having nested maps? Any other solution? Assuming that having maps as keys might not be a good idea! Thanks!
@bertofer having maps as keys is perfectly fine in Clojure since they are immutable. As long as you donโt store mutable Java objects as keys or values it is the preferred approach
oh, nice. In that case, it is fine too to have maps as topic in pub/sub core.async or dispatch value in multimethods?
Vectors might be preferable as dispatch values for design reasons - it's often the nature of maps to get more keys added to them, and if you ever forget a select-keys
then it won't dispatch correctly. You can build a vector from map inputs in your multimethod dispatch function with juxt
Using Clojure, If someone gave you a string like ( "peaches" & "creme") | "oatmeal" that is, logical AND "peaches", "creme", logical OR "oatmeal" how would you go about testing it against a string like "blueberry oatmeal" or "tasty peaches and creme" ?
(I'm working on a challenge problem) ๐
@michael.gaare right? i am looking at using Lucene for the search indexing part, but i'm also thinking I can roll my own finite state machine. it's all very cool & groovy, starting out it's tricky since i feel like i have no grip at all on how to make an FSM i could "walk" against query expressions like: "how do you like them " & ("apples" | "limes")
okay i have a question about that because i was looking at instaparse and ...
deriving a syntax tree from a query expression is pretty straightforward once i say "hey you can be delimited by a pipe | or an ampersand & etc" ... that is, specifying the grammar in instaparse, but i'm not sure how i can use a new syntax tree to test against stuff in the db. i'm stuck on the bit where you can "eval" a syntax tree like: ("beaver" & "hugs") against the stuff in the db, say we have a db containing: "beaver hugs squirrel" ... getting a syntax tree is great and i know i can use (insta/transform transform-mappings ...) to replace symbols and then evaluate the expression... (there are some examples where they replace all the symbols that read ":add" with plus signs, and then this sums up all the numbers...) How would i test my new parsed-out logic-expression (such as 'beavers' & 'hugs') on an arbitrary input string / db entity? (i think i need to see more instaparse examples using transform)
Come over to #instaparse :)
It helps when you have "instaparse" as a highlight word in slack
Noob lein question please, how can I choose the version of a dependency dynamically? EG
(defproject abc/bar (System/getenv "VERSION")
:dependencies [[abc/foo (System/getenv "VERSION")]])
Hey everyone, Iโm working on a project in cljs using the New Relic node module. Itโs a bit of a tricky module though because it must be loaded first. I have it as the first node/require
in my code but I continue to get errors saying, โNew Relic must be loaded first.โ Anyone know how I can go about forcing this module to load before anything else?
not up to snuff on my transducers. is there some transducer i can use after the map range here to concat the results? or is it best done outside the transduction ?
(into [] (comp (map #(range %))) (range 1 4)) ;=> [(0) (0 1) (0 1 2)]
or just use mapcat
yeah i need an index in the real thing so i was hoping i could map-index and then cat without mapcatting over the values bundles with range
then cat
is your animal
also of course #(range %)
could be range
in the example (not relevant to the question or your actual code of course)
note that cat
is a transducer, not a function that returns one (like map
, etc)
yeah just quickly created an "essence" and was thinking it would make some infinite ones ha
you canโt use range
in a transducer map btw - transducers realize intermediate steps fully
infinite range that is
I guess these are finite as written
but something to be aware of
thanks alex. i'm gonna read your chapter on them tonight during the basketball game
not really - just a short intro there. but more in Clojure Applied
@dpsutton I worked through http://elbenshira.com/blog/understanding-transducers/ recently, found it helpful
@lockdown- The most used Clojure wrappers for what? Or just in general? (The latter is probably too broad a question to get a sensible answer?).