A Clojure library designed to ... well, that part is up to you.
$ lein run ">++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>>+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++."
Hello World!
(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 | |
; | |
; https://www.haskell.org/haskellwiki/Shootout/Fannkuch |
--- 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 | |
Ltmp4: | |
.cfi_def_cfa_register %rbp | |
- leaq _divmod.n(%rip), %rax | |
movl %edi, -4(%rbp) | |
movl %esi, -8(%rbp) | |
- movl -4(%rbp), %esi |
(ns divmod.core) | |
; division by repeated subtraction | |
; http://en.wikipedia.org/wiki/Division_algorithm#Division_by_repeated_subtraction | |
(defn divmod | |
[n d] | |
(cond | |
(= d 0) (throw (Throwable. "Division By Zero")) | |
(< d 0) |
; Douglas Hofstadter's MU puzzle from Gödel, Escher, Bach | |
; written in miniKanren | |
; | |
; https://github.com/miniKanren/miniKanren/blob/master/mk.scm | |
(load "mk.scm") | |
(define print | |
(lambda (exp) | |
(display exp) |
<?php | |
$permutations = [ | |
['a', 'c', 'f'], | |
['b', 'd'], | |
['a', 'b', 'd'], | |
['e', 'f'], | |
]; | |
/* |
(ns interp.core) | |
(def empty-state {:ip 0, :code [], :stack '(), :labels {}}) | |
(defn step | |
[state] | |
(let [instr (get (:code state) (:ip state)) | |
state (update-in state [:ip] inc)] | |
(cond | |
(nil? instr) |
<?php | |
// AVL tree | |
class Node { | |
public $value; | |
public $left; | |
public $right; | |
public $height; |
; miniKanren solution to fox-goose-bag-of-corn | |
; https://github.com/gigasquid/wonderland-clojure-katas/blob/master/fox-goose-bag-of-corn/README.md | |
(load "mk.scm") | |
(define print | |
(lambda (exp) | |
(display exp) | |
(newline))) |
(load "mk.scm") | |
(define print | |
(lambda (exp) | |
(display exp) | |
(newline))) | |
(define peanoo | |
(lambda (n) | |
(conde |