Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn calculate-row
- [data rows]
- (loop [d data
- r rows]
- (if (= (rest d) ())
- r)
- (cond
- (= (first d) \F) (recur (rest d) (bottom r))
- (= (first d) \B) (recur (rest d) (top r)))))
- (defn bottom [rows]
- (first (partition (quot (count rows) 2) rows)))
- (defn top [rows]
- (second (partition (quot (count rows) 2) rows)))
- (calculate-row (char-array "FBFBBFF") (range 0 128))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement