This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-27
Channels
- # beginners (80)
- # boot (5)
- # cider (4)
- # cljsrn (3)
- # clojure (83)
- # clojure-russia (1)
- # clojure-spec (15)
- # clojurescript (20)
- # community-development (8)
- # cursive (6)
- # emacs (5)
- # fulcro (14)
- # hoplon (71)
- # off-topic (6)
- # om (2)
- # onyx (33)
- # parinfer (3)
- # re-frame (21)
- # reagent (20)
- # spacemacs (2)
- # specter (4)
- # vim (8)
I see a ton of resources for learning clojure so I’m a bit lost on where to start… is there one in particular that’s recommended for people who already know fp in other languages and have a basic understanding of lisp?
http://4clojure.com has some good exercises, and when you solve them you can see other people's solutions
also be sure to check out the cheatsheet https://clojure.org/api/cheatsheet
cool! thanks for the links
@automattable and for books, Joy of Clojure is perfect for someone coming from ML or Common Lisp and learning Clojure
👍 I’m coming from haskell so that should be perfect
@automattable Have you worked on the JVM before? If not, that's probably going to be the biggest shift coming from Haskell, other than Clojure having no type system 🙂
not in a long time, but yes
what’s so different about the jvm that would cause me issues?
tbh, I’m expecting strict evaluation to be the thing that takes me longer to get used to
(and I will definitely miss my types :P)
Folks coming from non-JVM languages sometimes seem to struggle with tooling, classpaths, stacktraces etc.
I think it depends on how you look at it.
Some people do just fine.
Just putting it out there as a possible hurdle 🙂
ah I forgot about that sort of thing
I’ve heard the stacktraces can be rough
especially when macros get involved
And especially when you have lazy sequences in play 🙂 (re: your comment about strict evaluation)
maybe I’ll just only use total functions
I personally feel the stacktraces aren't as bad as some people make out -- I think there are some heuristics you can quickly pick up to help ignore the "noise" in the stack traces.
So what brings you to Clojure from Haskell @automattable ?
interviewing for a clojure job soon
they claim I don’t need to know it going in, but I figure it can’t hurt
Nice!
I’m pretty excited about it 🙂
This is a good talk to watch about one of the unique aspects of Clojure https://vimeo.com/223309989
is there a good way to apply a vector of functions to corresponding members of a vector of values? i’m looking for
(f [inc dec square] [1 2 3])
> [2 1 9]
@jakeb (map #(%1 %2) [inc dec square] [1 2 3])
is there an easier way to do
(map #(map (fn [f v] (f v)) [inc dec] %) [[1 2] [3 4]])
> ((2 1) (4 3))
ugh, it auto expanded, the input was (map #(map (juxt inc dec) %) ...)
but clearly juxt isn't what you want at all
yeah, #(%1 %2) is as close as you get
unless you count (.call f x)
but that isn't an object, it's not first class
misremembered the name of the method at first
but to end up with something first class, you need to wrap it in a function, so you might as well embed (f x)
instead of (.invoke f x)
but now i’m just trying to map a function over the second item in each tuple in a vector
@jakeb I'm wondering if a reduce
statement is a better fit for your scenario, but I'm not in a position to fully flesh out the options
I would like to use something like this (take 3 (iterate plus now (days 1)))
, that I found on the website https://github.com/dm3/clojure.java-time#an-appetizer
it says ArityException Wrong number of args (3) passed to: core/iterate clojure.lang.AFn.throwArity (AFn.java:429)
Too many or too few? The error message only tells you that there are a 'wrong number'.
says ClassCastException java.time.LocalDate cannot be cast to java.time.temporal.TemporalAmount java-time.temporal/t-plus (temporal.clj:293)
so
(into {} [(vector 1 90)])
> {1 90}
(into {} [(list 1 90)])
> ClassCastException java.lang.Long cannot be cast to java.util.Map$Entry
vectors are interpreted as key/value pairs. notice:
user=> (seq {:a :a :b :b})
([:a :a] [:b :b])