This file contains 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
#!/usr/bin/env ruby | |
require 'fiber' | |
# This state machine corresponds to the regular expression /ab*(c|d)/ | |
@start = Fiber.new do | |
loop do | |
case (@string.next rescue nil) | |
when 'a' then @state1.transfer |
This file contains 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
digraph Reia { | |
Planner -> Prolog [label="Logic Programming"]; | |
Planner -> Actors [label="Carl Hewitt"]; | |
Prolog -> Erlang [label="Syntax, Semantics"]; | |
Erlang -> Reia [label="Execution and Concurrency Semantics"]; | |
Planner -> "Smalltalk-71" [label="Pattern-directed Execution"]; | |
"Smalltalk-71" -> Actors [label="Message-directed Execution"]; | |
Actors -> Erlang [label="Execution and Concurrency Semantics"]; | |
Actors -> Reia [label="Execution and Concurrency Semantics"]; | |
"Smalltalk-71" -> Smalltalk [label="Object Semantics"]; |
This file contains 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
{"businesses":[ | |
{"address1":"466 Haight St", | |
"city":"San Francisco", | |
"mobile_url":"http://mobile.yelp.com/biz/yyqwqfgn1ZmbQYNbl7s5sQ", | |
"name":"Nickies", | |
"address2":"", | |
"avg_rating":4, | |
"latitude":37.772201, | |
"zip":"94117", | |
"address3":"", |
This file contains 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
require 'rack' | |
class Object | |
def webapp | |
tap { | |
def self.call(env) | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end | |
} |
This file contains 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
# We want a uniform way of reducing a code tree | |
# so the easiest way to do that is to extend | |
# Object with a call method and whenever any | |
# object does not define it's own call method we | |
# assume the object is implicitly claiming it wants | |
# to return itself. Since Object is almost at the top | |
# of the hierarchy almost anything we are interested | |
# in will work as expected. | |
class Object | |
def call |
This file contains 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
;; This is the Ioke code for comparison. | |
;; See <http://JoergWMittag.GitHub.Com/lambdaconscarcdr/> for | |
;; what this is supposed to do. | |
cons = fn(hd, tl, fn(x, if(x, hd, tl))) | |
car = fn(l, l(true )) | |
cdr = fn(l, l(false)) | |
l = cons(1, cons(2, nil)) |
This file contains 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
class A(object): | |
def p(__self__): | |
print("1") | |
a = A() | |
a.p() | |
def p2(__self__): | |
print("2") |
This file contains 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
class MutableInt { | |
private int value; | |
MutableInt(int value) { | |
this.value = value; | |
} | |
void mutate() { | |
value++; | |
} |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<title>list.c</title> | |
<style type="text/css"> | |
body { color:#000000; background-color:#ffffff } | |
body { font-family:Helvetica, sans-serif; font-size:10pt } | |
h1 { font-size:14pt } | |
.code { border-collapse:collapse; width:100%; } | |
.code { font-family: "Monospace", monospace; font-size:10pt } |