Skip to content

Instantly share code, notes, and snippets.

View danking's full-sized avatar

Dan King danking

View GitHub Profile
@danking
danking / Makefile
Last active August 29, 2015 14:21
The challenge problem for Real Semantics' final presentation challenge in cs260r Spring 2015 (http://read-new.seas.harvard.edu/cs260r/2015/w/Main_Page)
BITCODEFILES=test.bc challenge.bc
READABLEFILES=test.ll challenge.ll
LLVM_LINK=./llvm-link
REAL_LLI=../llvm-3.6.0/build/bin/lli
default: $(BITCODEFILES)
$(LLVM_LINK) $(BITCODEFILES) -o a.bc
readable: $(READABLEFILES)
instance Monoid a => Monoid [(Either a b)] where
mempty = []
mappend [] vs = vs
mappend vs [] = vs
mappend [(Left v1)] ((Left v2):vs) = (Left $ mappend v1 v2):vs
mappend (v1:v2:vs) vs' = v1 : (mappend (v2:vs) vs')

Keybase proof

I hereby claim:

  • I am danking on github.
  • I am danking (https://keybase.io/danking) on keybase.
  • I have a public key whose fingerprint is 674F E774 16FE 8E97 E226 35FE 9FDB E002 5BA6 55AA

To claim this, I am signing this object:

T[[#1 e]] = T[[e]] (λ x. λ y. x)
T[[(e₁, e₂)]] = λ f. f T[[e₁]] T[[e₂]]
T[[(e₁, e₂)]] = (λ x. λ y. λ f. f x y) T[[e₁]] T[[e₂]]
T[[Ω]] = (λ x . (x •) (x •)) (λ_. λ x. (x •) (x •))
p = (λx.x, Ω)
T[[#1 e]] = T[[e]] (λ x. λ y. x)
T[[(e₁, e₂)]] = λ f. f T[[e₁]] T[[e₂]]
T[[(e₁, e₂)]] = (λ x. λ y. λ f. f x y) T[[e₁]] T[[e₂]]
p = (λx.x, Ω)
* CBN w/ pairs
@danking
danking / gist:f0cfb4bd1a45973022fc
Created February 17, 2015 01:08
Inability to connect behavior with a Class

Inability to connect behavior with a Class

Use two interfaces: A and AFactory

A is the interface.

AFactory implements all the factory methods as well as behavior relevant to the Class rather than any particular object.

Then you have

@danking
danking / gist:d2682500fd54bbe5e1e3
Created May 7, 2014 03:41
untyped lambda calculus
#lang racket
(require redex)
(require redex/tut-subst)
(define-language L
(e (e e)
x
v)
(v (lambda (x) e))
#lang shill/ambient
require shill/native;
require "syscall-test.cap";
val wallet = create-wallet();
populate-native-wallet(wallet
,open-dir("/")
,"/home/danking/tests/individual-system-call-tests"
,"/libexec:/lib:/usr/lib"
#lang shill/cap
require shill/contracts
shill/io;
provide [find : forall [X:+path,+lookup,+contents] . [f: X]
[filter: [_: X] -> boolean?]
[cmd: [_: X] -> any]
->
any ];
root@shillbsd:/home/danking # cat out
Session: fffffe009e640ba0 Message: Initializing new session
Session: fffffe009e640ba0 Capability: fffffe009e747d20
Session: fffffe009e640ba0 Capability: fffffe009e70b450
+chdir +chroot +create-dir { fffffe009e70b450 } +lookup { fffffe009e70b450 } +addlink +read +stat
Session: fffffe009e640ba0 Message: Granted capabilities on fffffe009e4357e0: fffffe009e70b450
Session: fffffe009e640ba0 Message: Granted capabilities on fffffe009e4357e0: fffffe009e70b450
Session: fffffe009e640ba0 Message: Granted capabilities on fffffe00041319d8: fffffe009e70b450