Created
June 29, 2013 00:03
-
-
Save gilesbowkett/5889028 to your computer and use it in GitHub Desktop.
line 35 is a problem I'm having in Quil, the Clojure interface to Processing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns circles.core | |
(:require [quil.core :as q])) | |
; "hello world" for Quil meets http://bit.ly/18luJO2 | |
(def the-width 808) | |
(def the-height 500) | |
(defn random-x-y [] | |
(list (int (rand the-width)) | |
(int (rand the-height)))) | |
(defn circle [xy] | |
(q/stroke 171 163 225) | |
(q/stroke-weight 5) | |
(q/fill 213 209 240) | |
(let [diam (+ 50 (q/random 100)) | |
x (first xy) | |
y (second xy)] | |
(q/ellipse x y diam diam))) | |
(defn log-xy [a-list] | |
(println (str "x: " (first a-list) " " | |
"y: " (second a-list)))) | |
(defn setup [] | |
(q/smooth) | |
(q/frame-rate 20) | |
(q/background 0) | |
(let [xy (random-x-y)] | |
; this totally works | |
(circle (random-x-y))) | |
; this totally fails | |
(map circle (list (random-x-y) (random-x-y))) | |
) | |
(defn draw [] ()) | |
(q/defsketch example | |
:title "Circles" | |
:setup setup | |
:draw draw | |
:size [the-width the-height]) | |
(defn -main [] ()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Whenever you have a problem with Clojure, pretty much first thing to investigate is laziness :-)
In this case you can wrap the call to
map
withdorun
:-)