This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-26
Channels
- # 100-days-of-code (3)
- # announcements (2)
- # beginners (237)
- # bitcoin (2)
- # boot (5)
- # cider (15)
- # cljs-dev (9)
- # cljsrn (6)
- # clojure (75)
- # clojure-estonia (1)
- # clojure-italy (8)
- # clojure-losangeles (1)
- # clojure-nl (1)
- # clojure-spec (68)
- # clojure-uk (80)
- # clojurescript (89)
- # cursive (31)
- # datomic (22)
- # emacs (2)
- # events (3)
- # figwheel-main (184)
- # fulcro (28)
- # graphql (1)
- # hyperfiddle (2)
- # jobs (1)
- # jobs-discuss (64)
- # luminus (5)
- # off-topic (16)
- # om (2)
- # onyx (1)
- # pedestal (12)
- # portkey (1)
- # re-frame (13)
- # reagent (56)
- # reitit (13)
- # ring-swagger (13)
- # shadow-cljs (145)
- # slack-help (2)
- # specter (6)
👋 new guy here. I hope my question is simple: I'm looking for a way to map a function to a specific set of indices within a collection. For example:
(transform [ALL MAP-VALS [1 3 5]] inc [0 1 2 3 4 5 6])
;; wishful thinking => [0 2 2 4 4 6 6]
is such a thing straight-forward in specter
?@loganpowell something like (transform [INDEXED-VALS (selected? FIRST #{1 3 5}) LAST] inc [0 1 2 3 4 5 6])
works. Not sure if it's the best solution though.
@drowsy Thank you thank you
works like a charm!
@loganpowell shorter and faster version:
user=> (transform (multi-path 1 3 5) inc [0 1 2 3 4 5 6])
[0 2 2 4 4 6 6]
@schmee Boom! Thank you!