Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Clojure - map function

Current License: CC BY-SA 3.0

Post Revisions

9 events
when toggle format what by license comment
Aug 6, 2014 at 2:29 vote accept Pauli
Aug 5, 2014 at 20:23 comment added DaoWen @Thumbnail - Ha, you're right, thanks. You would need to use Integer/parseInt to convert the string to an int instead of the int "cast" that works for chars. The point is that I don't really understand the OP's question—*if you just want to apply the function to the string (not the individual characters), why don't you just call it directly rather than using map?* Apparently I'm missing something...
Aug 5, 2014 at 18:59 comment added Thumbnail @DaoWen Your code produces ClassCastException java.lang.String cannot be cast to java.lang.Character ... - surely not what's intended.
Aug 5, 2014 at 15:01 comment added DaoWen You don't need map if you just want to call a function using a single argument. If that's what you want, then don't use map: (#(- (int %) (int 0円)) "1234")
Aug 5, 2014 at 4:32 comment added Mars One qualification: The result of (map f [a b c]) isn't exactly the same as the result of [(f a) (f b) (f c)], since map returns a lazy sequence rather than a vector. I think it's correct to say that the result of (map f [a b c]) is the same as the result of (lazy-seq [(f a) (f b) (f c)]), and that result of (vec (map f [a b c])) is the same as the result of [(f a) (f b) (f c)]. (If I'm wrong about some details, more knowledgeable people will hopefully correct me.)
Aug 4, 2014 at 18:52 comment added M Smith This has bitten me quite often
Aug 4, 2014 at 16:58 answer added noisesmith timeline score: 4
Aug 4, 2014 at 16:58 answer added Arthur Ulfeldt timeline score: 1
Aug 4, 2014 at 16:50 history asked Pauli CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /