This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (3)
- # babashka (3)
- # beginners (25)
- # calva (12)
- # cider (58)
- # clara (11)
- # clj-kondo (19)
- # cljsrn (2)
- # clojure (84)
- # clojure-austin (1)
- # clojure-europe (5)
- # clojure-nl (4)
- # clojure-spec (23)
- # clojure-uk (53)
- # clojuredesign-podcast (5)
- # clojurescript (24)
- # core-async (57)
- # cursive (16)
- # datomic (39)
- # emacs (1)
- # fulcro (40)
- # funcool (2)
- # graphql (17)
- # jackdaw (31)
- # jobs (2)
- # joker (3)
- # malli (7)
- # off-topic (12)
- # re-frame (9)
- # reagent (2)
- # reitit (1)
- # ring (4)
- # shadow-cljs (170)
- # sql (36)
- # tools-deps (5)
- # xtdb (20)
@neo2551 I expect it's because filterv only accepts a unary predicate, whereas mapv will accept a transforming function with different arities to map over multiple collections at once.
If the question is "Why doesn't filterv filter over multiple collections at once?" ... I guess I'm not sure what that would look like.
Thanks! I still wonder why we could not filter with predicates accepting multiple arities though.
A predicate is a transformation returning a falsy or truthy value from its arguments
@neo2551 Yeah, you could consider filter as a special case of map[T,Bool]. Which means you could implement a sort of filter over multiple colls using map
I’ve noticed a convention of adding a
! suffix to function names that have side effects, so I have a few functions that insert/update a database such as
add-booking! etc… This got me thinking, functions that query the database are also not pure functions as the result may be different (if someone was to edit the database) so should functions such as
get-booking also share the same convention?
create-account! is called from a
register function, should I also suffix the
register function with
! as it has side effects?
I understand it makes no difference at all but would just like to get into good habits whilst learning
Yep, when I’ve seen this convention, only the side-effecting functions tend be indicated by the
!, rather than all impure functions. So
get-booking wouldn’t have a
register! probably would.
I mostly use
! for things that my program modifies, i.e., writing to file, writing to a database, sending data across the wire. Things which I consume, I don't suffix with
! (unless I then modify and write out, external to my application)
> functions that query the database are also not pure functions as the result may be different (if someone was to edit the database) so should functions such as
get-booking also share the same convention
In this case the result of the function isn’t idempotent but it’s not your function that mutates state
Hi ! I I would like to know if it's possible to populate deps.edn dependencies in command line or some externals tools ? Right now, I use clj-refactor with cljr-add-project-dependency in Emacs but it only works when a REPL is already running.
OK thank you @alexmiller. Is this something that could be useful and above all feasible?
Certainly something I was looking for the other day (coming from other languages that have package managers to install and update deps) I was surprised to find there wasn’t anything like this for clojure.