I can now say I have used Arc for programming assignments for classes in school! (Since the professor said I could use any language, I figured I should take advantage of the opportunity.) I'd post the code, but it wasn't really that interesting (just a algorithm for computing Pascal's triangle, mod 2). Although I did enjoy having completed the assignment in about half as much code as anyone else in the class (since everyone else I knew wrote their program in Java). EDIT: On second thought, here is the code. If anyone has suggestions for improving or shortening it, please post them. (def factorial (n)
(if (> n 0)
(* n (factorial (- n 1)))
1))
(def choose (n k)
(/ (factorial n) (factorial k) (factorial (- n k))))
(def indices (n)
(map (let n -1 [++ n]) (n-of n nil)))
(def pascal-triangle (n)
(for i 0 n
(apply prs (map [mod (choose i _) 2] (indices (+ i 1))))
(prn)))
(pascal-triangle 64)
|