On Oct 30, 9:22 am, Dennis Haupt <d.haup...@googlemail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> i played around a bit
>
> (defmacro times [times & exprs]
>   '(let [countdown# ~times]
>      (loop [remaining# countdown#]
>        (when (< 0 remaining#)
>          ~@exprs
>          (recur (dec remaining#))))))
>
> (defmacro forloop [[i end] & code]
>   `(let [finish# ~end]
>      (loop [~i 0]
>        (when (< ~i finish#)
>          ~@code
>          (recur (inc ~i))))))
>
> the second one works fine:
> (forloop [a 4] (println a)
>
> but when i try to do the loop without an externally applied counter
> variable, i get a runtimeerror: "Can't take value of a macro"
>
> what exactly does it mean? it also happend when using expandmacro, so
> i guess my error is really, really obvious. but what is it?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOrV29AAoJENRtux+h35aGEfAP/AjDZ7VpZOB7xg6xuhWfe0UO
> pKH4WG5CDWF4MdezuWvS1n3D6V60cLV2DwdIS5K8TYBHnYKe6iKQwdpssNpDe4HE
> 3MwmYQIF8X4rbezH5XXhyR1WnWBAKJLrkTg1oB6SJNvUlotF8SnhjYTmROXX9sfV
> OE+AiR0Mt8QoxKGnCBQOSDhAw0IMVdKpuAqTbfggUVJD1mQTY+fHA3kwFfh+k2UR
> XWcYxRTFIEcK3guVzKBYk0FyBT9A6xBu88En7yzgBUC9fqwwmzN/Q4msIXVq2Ep4
> /7p28YQnLEa+PJmQJlLN5bwEBbrsyMAvyvmVU4JbUznIc+o2mCx2Lny9Bv64NAYS
> aesIxwp9Qn4enkYtvqdSfyTonEZRyA+O5gmcjPgpZfIuHYiVPgP2Kibr36T9TU5L
> CjnKblyRvHyM0a0jo2hfh3D7HNPBzp11aWuB5/wJ3pxqL9yjzdmSKfTW8SWoKgYL
> yObnt3e/d4Zm+yZ2+J/THP4AtTZfo4M365Swo/rypDjuecwvOXyTiGA+nbZUXF/k
> j8ptkAvOQQX3GZ1btzWE4Wh9+Q0eO6wO9IopNwvwnffC9k7OZ0AebYfynzsBwv/V
> LTtNKC+HGrcpvw1gxpF4rnkmjjPWHtn413GwKLNaGMBVmTZ05gofIuR2sQijBRfy
> 6JF2sFkMro16WxcGf0rw
> =estl
> -----END PGP SIGNATURE-----
It looks like you are using a normal quote instead of a backquote in
the definition of times.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to