This file contains 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
(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)))]) |
This file contains 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
~@(map (fn [num] (...)) | |
(range 100)) | |
This file contains 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
(list ‘a ‘b ‘c) | |
;;=> (a b c) |
This file contains 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
(let [x ‘(1 2 (3 4))] | |
`(+ 8 ~@x)) | |
;; => (clojure.core/+ 8 1 2 (3 4)) |
This file contains 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
`(defmacro ~macro-name [x# y#] | |
`(if (> ~~num (rand-int 100)) ~x# ~y#)))) |
This file contains 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
(let [macro-name (symbol (str "if" num))] |
This file contains 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
`(list ~@(map (fn [num] |
This file contains 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
(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__)) |
This file contains 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
(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) |
This file contains 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
(if25 (doFirst) (doSecond)) |
NewerOlder