View FatePercentages.clj
(defn roll-fate-die []
(- (rand-int 3) 1))
(defn test-fate-percentages [rolls-count]
(let [rolls (map (fn [x]
(reduce + (map (fn [x] (roll-fate-die))
(range 4))))
(range rolls-count))]
(map (fn [x] [(first x)
(int (* 100 (/ (count (second x)) rolls-count)))])
View map.clj
~@(map (fn [num] (...))
(range 100))
View list.clj
(list ‘a ‘b ‘c)
;;=> (a b c)
View quote.clj
(let [x ‘(1 2 (3 4))]
`(+ 8 ~@x))
;; => (clojure.core/+ 8 1 2 (3 4))
View line4.clj
`(defmacro ~macro-name [x# y#]
`(if (> ~~num (rand-int 100)) ~x# ~y#))))
View line2.clj
(let [macro-name (symbol (str "if" num))]
View generated.clj
(defmacro if0 [x__2603__auto__ y__2604__auto__] `(if (> 0 (rand-int 100)) ~x__2603__auto__ ~y__2604__auto__))
(defmacro if1 [x__2604__auto__ y__2605__auto__] `(if (> 1 (rand-int 100)) ~x__2604__auto__ ~y__2605__auto__))
(defmacro if2 [x__2606__auto__ y__2607__auto__] `(if (> 2 (rand-int 100)) ~x__2606__auto__ ~y__2607__auto__))
...
(defmacro if99 [x__2609__auto__ y__2601__auto__] `(if (> 99 (rand-int 100)) ~x__2609__auto__ ~y__2601__auto__))
View make-percents.clj
(defmacro make-percents []
`(list ~@(map (fn [num]
(let [macro-name (symbol (str "if" num))]
`(defmacro ~macro-name [x# y#]
`(if (> ~~num (rand-int 100)) ~x# ~y#))))
(range 100))))
(make-percents)