Mercurial > lasercutter
comparison src/laser/rasterize.clj @ 4:6533b4ef83ad
added hash-map filters :)
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 20 Aug 2010 01:30:12 -0400 |
parents | e6254010c95a |
children | 8cc418e04b87 |
comparison
equal
deleted
inserted
replaced
3:e6254010c95a | 4:6533b4ef83ad |
---|---|
114 ["M63 P0\nG61" | 114 ["M63 P0\nG61" |
115 (str \F feed) | 115 (str \F feed) |
116 "M101" | 116 "M101" |
117 "M3 S1"])) | 117 "M3 S1"])) |
118 | 118 |
119 (defn raster-epilogue [] | |
120 (str-join \newline | |
121 ["M63 PO" | |
122 "M5" | |
123 "M2"])) | |
119 | 124 |
120 | 125 |
126 (defn raster-comment [string] | |
127 (str "(" (re-gsub #"[()]" "" string) ")")) | |
121 | 128 |
129 (defn filter-keys [fun m] | |
130 (select-keys m (filter fun (keys m)))) | |
122 | 131 |
132 (defn filter-vals [fun m] | |
133 (into {} (filter (comp fun val) m))) | |
123 | 134 |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | 135 |
132 | 136 |
133 | 137 |
134 | 138 |
135 | 139 |