Skip to content

Instantly share code, notes, and snippets.

@calebsmith
calebsmith / church.clj
Created October 5, 2015 15:35
Church numbers and pairs in Clojure (WIP)
; This uses only fn and def in Clojure to create non-negative integers and pairs.
; (This restricts the language to only using lambda calculus.)
; Church numerals
(defn succ [n]
(fn [f]
(fn [x]
@calebsmith
calebsmith / gist:e30e6e863a575cef1fd9
Created November 10, 2015 02:08
Floyd's Cycle Detection Algorithm
(define (contains-cycle? lst)
(let inner ((a (nil-safe-cdr lst))
(b (nil-safe-cdr (nil-safe-cdr lst))))
(cond ((or (not (pair? a))
(not (pair? b))) #f)
((or (eq? a b)
(eq? a (nil-safe-cdr b))) #t)
(else (inner (nil-safe-cdr a) (nil-safe-cdr (nil-safe-cdr b)))))))
@calebsmith
calebsmith / script.sh
Created December 18, 2023 21:39
loading click-ingest with data
kcat -b localhost:29092 -t catchall_legacy -P -l test_events.jsonl