- Like a drum machine, you have a memory bank of patterns, where each pattern is a function definition
- You invent a rhythm to signify a function name
- While your functions's rhythm is playing in a loop, you can edit the function body
- Add certain sounds and/or rhythms in a sequence to add commands, such as variable assignment or function application
- To add a nested lexical scope, such as a while loop or a conditional, you loop a "keyword rhythm"
- For example, there may be a special "if-condition" rhythm. While the if-condition rhythm is playing, you are editing the inside of its block. At this point, both the function body and if-condition rhythms will be looping in the background
- When you execute a function, all the sounds and rhythms are played back in execution order at any speed you wanta
- Keywords, commands, and functions are differentiated by rhythm, sound, and/or tone
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
# Right turn directions | |
TURN_DIR = { | |
'u': 'r', | |
'r': 'd', | |
'd': 'l', | |
'l': 'u', | |
} | |
# Right turn coordinate math | |
TURN_FN = { |
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
diff --git a/GenomeFileUtil.spec b/GenomeFileUtil.spec | |
index 9c8c209..d2cb40c 100644 | |
--- a/GenomeFileUtil.spec | |
+++ b/GenomeFileUtil.spec | |
@@ -19,18 +19,18 @@ module GenomeFileUtil { | |
typedef mapping<string, string> usermeta; | |
- /* | |
+ /* |
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 @/table | |
export word_count | |
main | |
# Channel of words | |
| words <- !split_to_channel /\s/ stdin | |
# Hash table of word mapped to count | |
| word_counts <- !word_count words | |
$ iterate line <- !format word_counts |
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
group :num | |
:int :float | |
type :bintree:leaf a | |
@val a | |
type :bintree:branch a | |
@left :bintree a | |
@right :bintree 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
# Sum of multiples of `n` up to `limit | |
# eg: 18 is the sum of multiples of 3 up to 10 (3, 6, 9) | |
fun mul_sum n:int lim:int -> int | |
| sum <- 0 | |
| counter <- 1 | |
| mul <- n | |
$ loop while !lt mul lim | |
| counter <- !inc counter | |
| mul <- !add mul n | |
| sum <- !add sum mul |
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
# Register-based -- all varaibles are stored in registers. Sub-function calls are templated and expanded inline | |
# Compute the nth factorial | |
fun factorial n:int -> int | |
| count <- n | |
$ loop while (gt count 1) | |
| count <- dec count | |
| n <- mul count n | |
$ repeat | |
$ return n |
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 time | |
import zmq | |
import zmq.devices | |
from threading import Thread | |
# Advantages: | |
# - Easier to change the architecture around | |
# - Easier to add other processes, workers, remote workers, etc | |
# Disadvantages: | |
# - Need a little knowledge of zmq |
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 time | |
from threading import Thread | |
from queue import Queue | |
# Advantages: | |
# - a little simpler, uses only builtins | |
# - doesn't require another lib | |
# Disadvantages: | |
# - harder to migrate to other architectures (eg. request/reply, processes, fair share) |
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 time | |
import zmq | |
import atexit | |
import logging | |
from zmq.devices import ProcessDevice | |
from zmq.log.handlers import PUBHandler | |
from multiprocessing import Process | |
# All child processes we create | |
procs = [] # type: list |