This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-05
Channels
- # arachne (7)
- # architecture (3)
- # beginners (106)
- # cider (22)
- # clara (2)
- # cljs-dev (14)
- # cljsrn (12)
- # clojure (121)
- # clojure-china (1)
- # clojure-italy (2)
- # clojure-spec (22)
- # clojure-uk (32)
- # clojurescript (38)
- # community-development (45)
- # cursive (15)
- # datascript (6)
- # datomic (12)
- # defnpodcast (2)
- # emacs (8)
- # events (1)
- # fulcro (14)
- # immutant (6)
- # jobs (3)
- # jobs-discuss (6)
- # jobs-rus (3)
- # keechma (4)
- # keyboards (4)
- # leiningen (8)
- # luminus (1)
- # off-topic (91)
- # onyx (13)
- # parinfer (36)
- # re-frame (12)
- # reagent (23)
- # remote-jobs (1)
- # ring-swagger (3)
- # shadow-cljs (57)
- # specter (11)
- # sql (9)
- # uncomplicate (4)
- # vim (2)
- # yada (15)
oh, I see what you’re asking. (on your 2nd one, you shouldn’t ever expect [org.ocpsoft.prettytime/prettytime-parent "LATEST"]
to work)
It’s probably that LATEST is finding the latest snapshot for some reason
It does the same even if you use RELEASE (which should not ask for snapshots).
boot -d org.ocpsoft.prettytime/prettytime-nlp:4.0.1.Final repl
goes off looking for snapshots too... 😞yeah, LATEST refers to either release or snapshot
I don’t think maven 3.x even supports LATEST or RELEASE any more, but maybe Aether does
I should know this but it keeps messing me up. I've got a call to concat
in the middle of a function that returns a string. I can't for the life of me figure out where to add doall
to get it to return something other than clojure.lang.LazySeq@...
. Is doall
the wrong thing to use here or am I just missing something obvious?
the printed format is useless because the toString for a lazy-seq is the wrong thing in almost every case, doall only realizes the elements, it doesn’t put it into a non-lazy type so it doesn’t eliminate the problem
I found https://stuartsierra.com/2015/04/26/clojure-donts-concat which I guess answers most of my question, but I'm still a bit unclear of when doall
should work or not.
doall
does not un-lazyseq a lazyseq, it just realizes it:
user=> (type (map prn [1 2 3]))
clojure.lang.LazySeq
user=> (realized? (map prn [1 2 3]))
false
user=> (type (doall (map prn [1 2 3])))
1
2
3
clojure.lang.LazySeq
user=> (realized? (doall (map prn [1 2 3])))
1
2
3
true
conversion can be done like normal (lazyseqs are still seqs):
user=> (vec (map prn [1 2 3]))
1
2
3
[nil nil nil]
@U61HA86AG Thats's a fantastic explanation, thanks for the help. It's been on of the things that has tripped me up repeatedly but I've never taken the time to really try to understand it.
@shaun-mahood glad i could help 🙂
Oh, and I guess I discovered how to use mapcat - I replaced my concat
call with (mapcat conj)
and it worked the same, then changed that into a transducer and it got rid of the laziness and works how I needed.
@shaun-mahood I of course don't know your exact use case, but I think it might be slightly more idiomatic to use clojure.string/join
if you're building a string from your mapcat call:
(clojure.string/join (mapcat conj list-of-stuff))
the hilarious thing is that when you call str on the return value of concat and get clojure.lang.LazySeq@... it’s still realizing the whole thing (it has to in order to get the hash code it wants to print) - the issue isn’t the laziness or state of realization per se, it’s that toString for lazy-seq is the wrong thing, and you want the print-method (what eg. pr, prn or pr-str would produce) or to make your own string out of the elements in the lazy input
Hi, I am using luminus to get started and wonder if I should use devcards. luminus has doo. Would you recommend to use devcards in conjunction with devcards or is it sufficient to use doo for starters?
@timok: I like to use devcards as much in the design phase as anything else - https://juxt.pro/blog/posts/generative-ui-clojure-spec.html is probably the most compelling thing Ive seen (and used a bit) for devcards outside of the original talk
I would be a bit hesitant to recommend it if you are using re-frame (unless you are up for a bit of extra work), since it doesn't play nice by default, but otherwise I'm a pretty big fan
@timok: I've been using it recently to design my reagent components that I then use in re-frame - it's good for that since it forces you to consider the boundaries of the component and separate it from the application.
@shaun-mahood so when you have good separation it works fine?
@timok: Yep - anything you want to build with base reagent (no re-frame subscription or handlers or otherwise) work great with it. There have been people who have gotten it working with re-frame but it requires some extra work that I haven't put the time in to figure out.
@shaun-mahood thanks! I'll try it out in a bit.
that course will teach you the basics
braveclojure looks fine. I hope only that the exercises are not too difficult for a beginner
oke, maybe first then the koans and later brave and in the meantime do some 4clojure ?
Just make sure you first master your setup, a repl properly integrated with your editor is mandatory to appreciate and get Clojure
oke, I was thinking of using intelij with cursive or maybe even atom if that one has a repl
Emacs with Cider if you already know emacs. Otherwise go with Atom + ProtoREPL, or IntelliJ Cursive.
Fwiw, the koans will work "out of the box" after you install java and, optionally, leiningen. No environment setup needed to get started! They're fairly quick and you can work through them in one day and revisit as needed for refresh. Once you're done with the koans, you'll be in a good position to think about an actual environment. I think that "environment setup" is a big obstacle to getting started in any programming platform but especially true for clojure.
I went down the emacs "rabbit hole" but heard nice things about lightmod (https://sekao.net/lightmod/), a self-contained environment for writing clojure/clojurescript.
hmm, is this koan right :
"When things cannot be equal, they must be different"
(not= :fill-in-the-blank :roelof))
isn’t that what the koan is demonstrating? it’s a very simple point but I don’t see what else it could be trying to do
@roelof there’s not really a consensus choice in the community. it kind of depends on what kind of website you want to make and how much experience you have in web tech. luminus is certainly a good choice from what i can see because it manages a lot of moving pieces and has a lot of documentation
Deactivated! (said in a Dalek voice as I watched Seasons 6 and 7 of Doctor Who over the weekend)
@lee.justin.m I was thinking of making a website where households could keep track of the expenses and profits. Maybe later I could grow to a accounting system
If you’re not going to do it as an SPA, luminus has a server-side html templating engine and database integration, which sounds like what you need. Note, I’ve only ever looked at the documentation, so I can’t testify to it. But it looks well supported and thought out.
if you are interested in an all-clojure stack from database to client, you might look at fulcro (again I haven’t used it). but these kinds of frameworks are pretty complicated and are a lot to bite off, so server-side templating might be easier way to ease into it.
Is there also a library where I can make graphs/plots so I can let the user see what part of the expense is for example taxes ?
what do you use when you need an eager list comprehension (that is when you need both the retun value as well as side effects)?
a while ago I trained myself out of using for
and doseq
because they expand into forms which are nearly impossible to cover with unit tests 😅
i wonder if there is a more or less canonical way to signalize that both the value and the side effects are important.
i'm using vec, but i'm not sure it's clear enough that the point is not (just) a conversion to a vector.
what do I do wrong here :
"You can create a set by converting another collection"
(= #{3} (set 3))
set expects a collection - you want hash-set
@alexmiller so I need to do hash-set {3}
?
nope, when I do :
"You can create a set by converting another collection"
(= (hash-set 3) (set 3))
Now meditate upon C:\Users\rwobb\Documents\clojure\clojure_koans\clojure-koans\src\koans\05_sets.clj
---------------------
Assertion failed!
clojure.lang.ExceptionInfo: You can create a set by converting another collection
(= (hash-set 3) (set 3)) {:line 7}, compiling:(C:\Users\rwobb\Documents\clojure\clojure_koans\clojure-koans\src\koans\05_sets.clj:5:1)