specter

Latest version: 1.1.3
2018-09-26T15:38:45.000100Z

👋 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?

2018-09-26T16:50:27.000100Z

@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.

2018-09-26T17:06:41.000100Z

@drowsy Thank you thank you

2018-09-26T17:26:04.000100Z

works like a charm!

schmee 2018-09-26T17:39:18.000100Z

@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]

2018-09-26T17:39:48.000100Z

@schmee Boom! Thank you!