Skip to content

Instantly share code, notes, and snippets.

@DCarper
Created August 25, 2012 16:29
Show Gist options
  • Select an option

  • Save DCarper/3467601 to your computer and use it in GitHub Desktop.

Select an option

Save DCarper/3467601 to your computer and use it in GitHub Desktop.

Revisions

  1. Dan Carper created this gist Aug 25, 2012.
    13 changes: 13 additions & 0 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    (def square (fn [n] (* n n)))

    (def sum-squares
    (fn [& args](
    (+ (map square args ))
    ))
    )

    (prn "squares: " (map square [1 2 3 4]))
    (prn "hardcoded sum of squares:" (apply + (map square [1 2 3 4])))

    (prn "sum-squares:" (sum-squares 1 2 3 4))