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
(def check= (fn [a b] | |
(println "calling check= with: " a b) | |
(if (= a b) | |
'😃 | |
'😡))) | |
(check= 5 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
((fn [m] (((fn [f] (f f)) | |
(fn [func] | |
(fn [n a b i] | |
(if (= n i) | |
b | |
((func func) n b (+ a b) (inc i)))))) m 0 1 1)) | |
20) |
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
(def Y (fn [f] | |
((fn [x] | |
(x x)) | |
(fn [x] | |
(f (fn [y] | |
((x x) y))))))) | |
(defn memo [] | |
(let [hist (atom {})] | |
(fn [f] |
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
((f => f(f))) | |
(func => n => (n === 0) ? 1 : (n * func(func)(n - 1))) | |
(19) |
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
(ns zones.tests.core | |
(:refer-clojure :exclude [binding get set]) | |
(:require [zones.core-fn :refer [default-zone]]) | |
(:require-macros [zones.core :refer [binding bound-fn*]])) | |
; -- helpers ---------------------------------------------------------------------------------------------------------------- | |
(defn default-zone-str [] |
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
(ns my.ns | |
(:require-macros | |
[gadjett.core :as gadjett :refer [dbg]])) | |
(dbg (map inc [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
(ns my.lambda$macros) | |
; from here: http://matt.might.net/articles/implementing-a-programming-language/ | |
(defmacro dbg[x] | |
`(let [x# ~x] | |
(println (str '~x ": " x#)) | |
x#)) | |
(def car first) | |
(def cdr rest) |
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
; in klipse, add the gadjett path: | |
; http://app.klipse.tech/?external-libs=[https://raw.githubusercontent.com/viebel/gadjett/master/src/] | |
(ns my.ns | |
(:require-macros [gadjett.core :refer [dbg]])) | |
(defn reduce-by-key [s] | |
(into [] (let [f +] | |
(reduce (fn [res [k v]] | |
(assoc res k (f (res k 0) v))) |
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
(ns my.color | |
(:require | |
[goog.dom :as dom] | |
[viebel.gist-3800b8ebae5292921c7d6fcb6c995c1f.raw.body-color :refer [set-bg-color-element]])) | |
(let [colors ["blue" "red" "yellow" "magenta" "cyan" "green" "purple" "coral" "dodgerblue" "pink"]] | |
(set-bg-color-element (dom/getElement "klipse-color") (rand-nth colors))) |
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
(ns my.color | |
(:require | |
[goog.dom :as dom] | |
[viebel.gist-3800b8ebae5292921c7d6fcb6c995c1f.raw.body-color :refer [set-bg-color-element]])) | |
(let [colors ["blue" "red" "yellow" "magenta" "cyan" "green" "purple" "coral" "dodgerblue" "pink"]] | |
(set-bg-color-element (dom/getElement "klipse-color") (rand-nth colors))) |