This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-02
Channels
- # beginners (29)
- # cider (41)
- # clara (1)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (158)
- # clojure-dev (2)
- # clojure-dusseldorf (2)
- # clojure-italy (8)
- # clojure-mexico (1)
- # clojure-russia (2)
- # clojure-spec (43)
- # clojure-uk (1)
- # clojurescript (44)
- # community-development (98)
- # cursive (9)
- # data-science (8)
- # datascript (4)
- # datomic (30)
- # emacs (6)
- # fulcro (11)
- # graphql (6)
- # jobs (1)
- # jobs-discuss (27)
- # lein-figwheel (5)
- # luminus (13)
- # lumo (4)
- # off-topic (28)
- # onyx (9)
- # parinfer (12)
- # perun (2)
- # portkey (5)
- # re-frame (48)
- # ring (2)
- # shadow-cljs (52)
- # spacemacs (29)
- # tools-deps (15)
- # unrepl (9)
- # vim (7)
- # yada (3)
@elena.caraba in Clojure only false
and nil
are considered falsey, so if coll is empty (count coll)
returns 0, which is truthy
I just created a stack-overflow question detailing my problems at organizing cljs code, if anyone wants to help me there I will be very grateful
https://stackoverflow.com/questions/49611955/clojurescript-equivalent-of-javascripts-module-pattern
defn
is a macro that expands to def
+ fn
. if you don't want to create a top-level function, you can just use fn
by itself.
boot.user=> (macroexpand '(defn foo [] 42))
(def foo (clojure.core/fn ([] 42)))
something like this? https://pastebin.com/4SY3izCs
(fn [name] (.get client (str "resources/" name))
could also be replaced with #(.get client (str "resources/" %))
for extra concision
partial
itself returns an anonymous function with fn
(you can do (source partial)
in a repl to see that)
Hi all....swapping from php and wanna do my web work with clojure. What's the best framework for something like a blog...luminous, pedestal, other? Thanks
http://cryogenweb.org/ is great for a blog
but may be too good if your goal is to build a web app :)
I loved it...thanks! It has plugins? I could not found ones...
Which one did you use???? For web app....
I saw that luminus has great acceptance in github. Compojure is great too... :-)
Write a (defn not-zero [x] (if-not (zero? x) x)), then (if-let [x (not-zero x)] ...)
I would not do this personally, but just for the fun of the challenge, you could do
(if-let [coll-count (and (seq coll) (count coll))] ...
If all the arguments to and
are non-nil, it returns the last arg, but if you pass an empty collection to seq
it will return nil, which will cause the and
to short-circuit and return nil.
The reason I would not actually do that is because a month from now, I just know I’d come back to that code and wonder why the heck I was using that odd construction. An if-let
inside a let
would be much easier to read and quicker for me to understand as a code maintainer.
@manutter51 I ended up using (seq coll)
and taking out (count coll)
@elena.caraba Why not just (if (empty? coll) 0.0 ...)
@elena.caraba if its coll I recommend not-empty over seq, because it doesn't change collection type.