This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-13
Channels
- # adventofcode (69)
- # announcements (1)
- # babashka (68)
- # beginners (37)
- # calva (3)
- # cider (4)
- # cljdoc (4)
- # cljsrn (1)
- # clojure (73)
- # clojure-europe (13)
- # clojure-nl (15)
- # clojure-switzerland (11)
- # clojure-uk (6)
- # clojurescript (14)
- # code-reviews (1)
- # conjure (1)
- # cryogen (3)
- # fulcro (32)
- # lambdaisland (8)
- # pathom (13)
- # reagent (6)
- # releases (1)
- # reveal (43)
- # shadow-cljs (9)
- # tools-deps (2)
- # vim (2)
Hi, I need some help, I broke my box. I'm not sure what's wrong. I tried to do a system upgrade and rebooted the server and re-running my application has this error
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassCastException: class clojure.lang.PersistentVector cannot be cast to class clojure.lang.Named (clojure.lang.PersistentVector and clojure.lang.Named are in unnamed module of loader 'bootstrap') (NO_SOURCE_FILE:0)
maybe my lein is just out of date?
Oh thank heavens
that was it
talk about adrenaline...
Is anyone else has trouble to access http://4clojure.com
Okay, I managed to visit the page using Firefox but Safari can’t open it for some weird reason.
As an experienced programmer with practically zero lisp experience I find it hard to grok Clojure code. I understand it fine when I read it, but when I look at code I get no intuitive feel for it - how it flows, what the intent of the writer was etc. No doubt this is in part something that simply comes with using the language and getting used to it, but I’d be curious to hear if any other beginners are having the same problems and how they have handled it.
Currently no, but I’m mostly in a reading phase of my learning... which I get isn’t an optimal way to get a language. Atm I have a lot more time to read than sitting at a computer to write.
I would second the advice to use the REPL. Especially when learning. You can try out small experiments and experience how Clojure works. You get immediate feedback. Totally short-circuits the write-compile-run-see_results cycle of non-REPL languages. If possible, set up your favorite editor and connect it to a REPL. Writing code in an editor helps immensely to balance parens and other formatting so that you can visually see the structure of the code. All editors connected to a REPL will have some hot-key combination to send each Clojure form to the REPL and evaluate it. You might find the following useful (if you haven't seen them already) https://clojure.org/guides/repl/introduction https://clojure.org/guides/repl/annex_community_resources
Np, one you use the REPL you’ll see. You work in tiny blocks of logic then once something works you physically place that logic where you want it. That’s the power of lisp to me.
@U01GZD00HA8 What code do you read? Some of what people write in clj is ugg-lyy, so you have to pick your https://github.com/weavejester. 2nd'ly you need some familiarity with the https://blog.skyliner.io/fourteen-months-with-clojure-beb8b3e4bf00: update, cond->, etc.
Np, one you use the REPL you’ll see. You work in tiny blocks of logic then once something works you physically place that logic where you want it. That’s the power of lisp to me.
is there a way to destruct a map with unknown key names? for example I know that a map has two key values but I don’t know the names
You can call seq on the map to get it as a sequence of key value pairs and restructure that
That would let you get the values but I would think there’s a better way to approach this perhaps
I mean inside a let
block something like (let [{:keys [these keys are unknown} map} return the vals here)
I was wondering if Clojure destructuring has something like that and I am not aware of it
You could make your own macro to do such a thing though. Would be similar to what I just pasted but using the user supplied keys to bind to the values in an arbitrary order
Just call vals to get the values as a seq if you don’t need their keys. Not sure what your use case is
What’s the function to use for f
in transduce
that would and
a seq of booleans? I tried and
, but I got an error that you can’t use a macro in that place.
Thanks I ended up just reducing it differently to solve the same problem 🙂