Skip to content

Instantly share code, notes, and snippets.



A Clojure library designed to ... well, that part is up to you.


$ lein run ">++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>>+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++."
Hello World!


View fannkuch.clj
(ns fannkuch.core
(:require [clojure.math.combinatorics :as combo]))
; Fannkuchen
; it's super slow though
; also I was too stupid to implement permutations, so I used Mark Engelberg's library
View divmod.s.diff
--- divmod2.s 2015-01-09 21:58:10.000000000 +0100
+++ divmod.s 2015-01-09 21:56:08.000000000 +0100
@@ -12,20 +12,27 @@
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
- leaq _divmod.n(%rip), %rax
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
- movl -4(%rbp), %esi
View divmod.clj
(ns divmod.core)
; division by repeated subtraction
(defn divmod
[n d]
(= d 0) (throw (Throwable. "Division By Zero"))
(< d 0)
igorw / mu.scm
Created Jan 7, 2015
GEB MU puzzle in miniKanren
View mu.scm
; Douglas Hofstadter's MU puzzle from Gödel, Escher, Bach
; written in miniKanren
(load "mk.scm")
(define print
(lambda (exp)
(display exp)
View imitating-kayla.php
$permutations = [
['a', 'c', 'f'],
['b', 'd'],
['a', 'b', 'd'],
['e', 'f'],
View interp.clj
(ns interp.core)
(def empty-state {:ip 0, :code [], :stack '(), :labels {}})
(defn step
(let [instr (get (:code state) (:ip state))
state (update-in state [:ip] inc)]
(nil? instr)
View avl-tree.php
// AVL tree
class Node {
public $value;
public $left;
public $right;
public $height;
igorw / fox-goose-bag-of-corn.scm
Created Dec 28, 2014
miniKanren implementation of Lewis Carroll's "Fox, Goose, and Bag of Corn" puzzle, described by Carin Meier (@gigasquid)
View fox-goose-bag-of-corn.scm
; miniKanren solution to fox-goose-bag-of-corn
(load "mk.scm")
(define print
(lambda (exp)
(display exp)
igorw / fizz-buzzo.scm
Last active Aug 29, 2015
fizzbuzz in miniKanren. See also and
View fizz-buzzo.scm
(load "mk.scm")
(define print
(lambda (exp)
(display exp)
(define peanoo
(lambda (n)
You can’t perform that action at this time.