Skip to content

Instantly share code, notes, and snippets.

@fogus
Created August 10, 2010 13:41
Show Gist options
  • Save fogus/517281 to your computer and use it in GitHub Desktop.
Save fogus/517281 to your computer and use it in GitHub Desktop.
(defn plot [f min max step]
(doseq [i (range min max step)]
(dotimes [_ (apply f [i])] (print "*"))
(println)))
(plot #(Math/pow % 2) 1 5 1)
; *
; ****
; *********
; ****************
;=> nil
(plot #(Math/pow Math/E %) 0 4 1/2)
; *
; *
; **
; ****
; *******
; ************
; ********************
; *********************************
;=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment