Skip to content

Instantly share code, notes, and snippets.

@copperlight
Created April 17, 2016 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save copperlight/cf590a4a7bfedf758398a2052050900c to your computer and use it in GitHub Desktop.
Save copperlight/cf590a4a7bfedf758398a2052050900c to your computer and use it in GitHub Desktop.
(defn diamond [width offset]
(doseq [w (take-nth 2 (concat (range 1 width) (range width 0 -1)))]
(do
(print (apply str (repeat offset " ")))
(print (apply str (repeat (/ (- width w) 2) " ")))
(print (apply str (repeat w "x")))
(println))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment