This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (6)
- # announcements (4)
- # babashka (11)
- # beginners (18)
- # cider (7)
- # clj-kondo (4)
- # clj-on-windows (32)
- # clojars (6)
- # clojure-doc (1)
- # clojure-europe (14)
- # clojure-sg (1)
- # clojurescript (24)
- # conjure (4)
- # cursive (14)
- # datomic (2)
- # events (2)
- # graphql (5)
- # meander (6)
- # missionary (10)
- # nextjournal (6)
- # off-topic (10)
- # pathom (2)
- # pedestal (1)
- # practicalli (1)
- # re-frame (8)
- # reagent (3)
- # releases (1)
- # sci (6)
- # shadow-cljs (10)
- # spacemacs (4)
- # vim (6)
- # xtdb (9)
Or to say, the call
(counted? "asdf") itself is meaningless as “asdf” is not a clojure land type. Most clojure functions is only meaningful for clojure specific types that implements some clojure interfaces.
Several of Clojure's type-testing predicates simply test whether an object is an instance of a specific Clojure implementation interface. In this case,
clojure.lang.Counted. They are not always very useful tests.
seq? for example tests if something is an instance of
clojure.lang.ISeq which tells you very little.
sequential? is a similar, narrow type-testing predicate.
seqable? on the other hand is actually useful 🙂
For a new project created with lein, how to resolve this lint? 'Unresolved Symbol' : http-server
I think you might want to look at https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#lint-a-custom-macro-like-a-built-in-macro
You will generally need to add a custom rule anytime you are dealing with macros that introduce bindings
I'm currently looking at the
for macro and trying to understand how its modifiers work. As I understand it, the intention is for
:while test to take elements of the resulting sequence until
(test x) becomes false, and
:when test should behave similarly to calling
filter on the resulting seq.
However, the following example produces unexpected output:
So these two forms evaluate to the same seq. Shouldn't the
(for [x (range 3) y (range 3) :while (> x y)] [x y]) => ([1 0] [2 0] [2 1]) (for [x (range 3) y (range 3) :when (> x y)] [x y]) => ([1 0] [2 0] [2 1])
:whileone stop when it encounters the first pair where x =< y, namely
[1 1]? Could someone please explain what actually happens? I've looked at examples at clojuredocs, but still don't get it.
:while after y sequence stops iterating over y values and moves to next x value.
x = 0, [0 0] stops iterating over y
x = 1, first result is
[1 0], [1 1] stops iterating over y
x = 2, other two results are
[2 0] and
[2 1], [2 2] stops iterating over y
:while after x sequence checks the x:
(for [x (range 3) :while (not= x 2) y (range 3)] [x y])
And you can do both:
(for [x (range 3) :while (not= x 2)
y (range 3) :while (not= y 2)] [x y])
What is the rational to implement
when-let with only accepting 1 binding? Wouldn't be the less surprising way if it worked like
let (aka "
There's an open issue for this, although it's pretty inactive now. There are implementations there if you want to try them. https://clojure.atlassian.net/plugins/servlet/mobile?originPath=%2Fbrowse%2FCLJ-2213#issue/CLJ-2213
The main question is: how should each of the bindings affect the truth or falseness of the condition used by the when? There isn’t necessarily one answer that all agree is the obvious one. With a single binding it is obvious