Mapping over sequence with a constant

Posted by Hendekagon on Stack Overflow See other posts from Stack Overflow or by Hendekagon
Published on 2011-03-04T05:20:45Z Indexed on 2011/03/04 7:25 UTC
Read the original article Hit count: 253

Filed under:
|
|
|

If I need to provide a constant value to a function which I am mapping to the items of a sequence, is there a better way than what I'm doing at present:

(map my-function my-sequence (cycle [my-constant-value]))

where my-constant-value is a constant in the sense that it's going to be the same for the mappings over my-sequence, although it may be itself a result of some function further out. I get the feeling that later I'll look at what I'm asking here and think it's a silly question because if I structured my code differently it wouldn't be a problem, but well there it is!

© Stack Overflow or respective owner

Related posts about map

Related posts about clojure