[Cs254f11] Simple mapping problem

Jesse French jaf10 at hampshire.edu
Thu Nov 17 12:05:31 EST 2011


Hi all,

I'm trying to figure out how to map some simple functions along a vector, and having trouble due to my lack of understanding of how map works.

(def m
[[85 1]
 [92 5/16]
 [66 15/16]
 [80 1/8]
 [50 1/8]
 [85 1/4]
 [66 13/16]
 [37 1/16]
 [103 1/8]
 [34 1/8]
 [113 7/16]]

My goal is to map a '+ x' down the first value of this vector.

Even 
(map first (map inc m))
doesn't work, when I would like to be doing something like 
(map first (map (+  m x))
or
(map (+  (map first m) x))


(def p [100 15 29 7 63 59 44 72])
(map inc p)
This works, so I'm assuming my problem is with the syntax of how I'm nesting them.


Any thoughts?

Jesse



More information about the Cs254f11 mailing list