This file contains hidden or 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
var ZERO = function (f) { | |
return function(z) { | |
return z; | |
}; | |
}; | |
var SUCC = function (n) { | |
return function (f) { | |
return function (z) { | |
return f(n(f)(z)); |
This file contains hidden or 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
function numerify(churchNumeral) { | |
return churchNumeral(function (x) { | |
return x + 1; | |
})(0); // f is a function that increments the value by 1; z=0 | |
} | |
// example | |
numerify(ZERO) // returns 0 | |
var ONE = SUCC(ZERO) | |
numerify(ONE) // returns 1 |
This file contains hidden or 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
function incr(x) { return x+1;}; | |
var zero = 0; | |
// so numerify is | |
function numerify(churchNumeral){ | |
return churchNumeral(incr)(zero); | |
}; |
This file contains hidden or 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
var PLUS = function (n) { | |
return function(m) { | |
return function(f) { | |
return function(z) { | |
return n(f)(m(f)(z)); | |
}; | |
}; | |
}; | |
}; |
This file contains hidden or 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
import sys, os | |
import turtle as tt | |
screen = tt.Screen() | |
class Lsystem: | |
"Class to compile and draw lsystem with turtle" | |
def __init__(self, save_every_frame=False, | |
speed=0): | |
self.name = '' |
This file contains hidden or 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
# L-System code for pythagorian tree | |
variables: A B | |
constants: [ ] + - | |
axiom: A | |
rules: (B->BB) (A->B[+A]-A) | |
angle: 60 | |
length: 20 |
This file contains hidden or 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
Generated code: | |
[ 0 ] A | |
[ 1 ] B[+A]-A | |
[ 2 ] BB[+B[+A]-A]-B[+A]-A | |
[ 3 ] BBBB[+BB[+B[+A]-A]-B[+A]-A]-BB[+B[+A]-A]-B[+A]-A | |
[ 4 ] BBBBBBBB[+BBBB[+BB[+B[+A]-A]-B[+A]-A]-BB[+B[+A]-A]-B[+A]-A]-BBBB[+BB[+B[+A]-A]-B[+A]-A]-BB[+B[+A]-A]-B[+A]-A |
This file contains hidden or 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
[ FRWD ] B | |
[ FRWD ] B | |
[ PUSH ] ((0.00,-160.00), 90.0) | |
[ RGHT ] + | |
[ FRWD ] B | |
[ PUSH ] ((17.32,-150.00), 30.0) | |
[ RGHT ] + | |
[ FRWD ] A | |
[ POP ] ((17.32,-150.00), 30.0) | |
[ LEFT ] - |
This file contains hidden or 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
import argparse, re, math, sys, time, os | |
class HuffmanNode: | |
""" | |
Node Object that supports Merging operation as in the | |
Huffman Encoding Algorithm. | |
self.list_of_chars: list of characters at a node which share | |
a common ancestors in the Huffman Tree. | |
self.count: number of times the element in the list of |
This file contains hidden or 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
_='_=%r;print _%%_';print _%_ |