Skip to content

Instantly share code, notes, and snippets.

@jclaggett
Created September 28, 2010 16:05
Show Gist options
  • Select an option

  • Save jclaggett/601272 to your computer and use it in GitHub Desktop.

Select an option

Save jclaggett/601272 to your computer and use it in GitHub Desktop.

Revisions

  1. jclaggett created this gist Sep 28, 2010.
    22 changes: 22 additions & 0 deletions topic.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    (defmacro topic
    ([t] nil)
    ([t form] form)
    ([t form & more]
    `(let [~t ~form] (topic ~t ~@more))) )

    (def topic-ex1
    (topic % 1
    (+ 1 %)
    (/ % 2) ) )

    (def topic-ex2
    [
    '(->>
    (map vector (range) coll)
    (filter (fn [[f & args]] (apply f args)))
    (map first) )

    '(topic coll
    (map vector (range) coll)
    (filter (fn [[f & args]] (apply f args)) coll)
    (map first coll) ) ] )