This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-01
Channels
- # announcements (3)
- # babashka (20)
- # beginners (77)
- # calva (27)
- # cider (5)
- # clara (3)
- # clj-kondo (9)
- # cljs-dev (4)
- # cljsrn (5)
- # clojure (26)
- # clojure-europe (32)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-uk (5)
- # clojurescript (25)
- # clojureverse-ops (4)
- # core-async (49)
- # cursive (15)
- # data-science (1)
- # datahike (4)
- # datomic (3)
- # docker (1)
- # events (1)
- # helix (5)
- # holy-lambda (3)
- # introduce-yourself (1)
- # jobs (1)
- # kaocha (2)
- # lsp (15)
- # malli (42)
- # off-topic (18)
- # pathom (18)
- # pedestal (12)
- # polylith (7)
- # rdf (1)
- # re-frame (22)
- # reitit (2)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (33)
- # shadow-cljs (85)
- # spacemacs (3)
- # vim (12)
- # xtdb (29)
hi! when using cursive for debugging, how to use the parameter of an anonymous function in intelliJ's "Evalute" window? I've tried using "%" but for that it says "unable to resolve %". In the "Variables" windows this parameter is listed as "p1--52131#" however it is not working with this name in the Evaluate window. Any ideas?
Hi everyone,
I'd like to understand what's the reasoning behind a few choices related to a few Clojure functions. This is not to criticise the choices made or the functions themselves, is to help me having a better understanding and know the motivations or history behind them:
- any?
and not-any?
: at a first sight I'd have expected these two function to be the complement of each other, but that's not the case. The behaviour of the 2 functions is clear, still I find it remarkable the difference between them. Is this the result of a specific choice? Or maybe the two functions are unrelated, they have an independent story, it just happens that their external appearance may suggest that they are potential complements?
- some
: also here the behaviour of the function is clear. What I find puzzling is its idiomatic usage with sets - which looks pretty cool and handy in practice - but in my mind this clashes with the signature what says that the function accepts a predicate as first parameter. So, are sets considered predicates (maybe in specific cases such as this one)?
Thanks 😊
> the two functions are unrelated, they have an independent story, it just happens that their external appearance may suggest that they are potential complements ^^
I think any?
was created for use with spec. So if you want to spec a collection of anything you have a predicate for that, while not-any?
is the opposite of some
and some
doesn't have a question mark because it returns the first non-falsy value, which can be useful on its own
For self clarification, I did write some functions any? all? none?
prior to spec's development to help with those types of scenarios. They are compatible with spec as well. Ping me if you want them.
(#{:a :b} :a)
-> :a
. (#{:a :b} :c)
-> nil
. Sets implement clojure.lang.IFn and it is a membership operation
all clear. Still, not necessarily a predicate - being a predicate a function that returns either true or false
some is defined as (some pred coll)
but it seems is often used as (some f coll)
where f can also be a set
False and nil are falsey values, everything else is truthy. In that sense sets are predicates
So I guess the key (to clarify my doubts) is the word "logical" in the function definition docs. Thanks everyone for the answers :thumbsup:
@U017QU43430 The convention in Clojure is that a strictly Boolean-returning predicate function has a name ending in ?
-- but any function can be used as a predicate where its result will be treated as either truthy or falsey.
See https://clojure.org/guides/faq#qmark_bang for notes about ?
and !
in function names.
It looks like this is graphing the project's dependencies, whereas I want to graph my own namespaces, if that makes sense.
Namespaces themselves are all at the same level, there is no hierarchy. Can you elaborate on what kind of graph you’ve in mind?
there are a couple tools out there for this
I think if you google clojure namespace graph or whatever you'll find them
certainly tools.namespace can give you the graph as data
clj-kondo exposes this data; and even has a graphviz generator: https://cljdoc.org/d/clj-kondo/clj-kondo/2021.10.19/doc/analysis-data#namespace-graph
https://github.com/gfredericks/clj-usage-graph supports graphs of namespaces or vars