Skip to content

Instantly share code, notes, and snippets.

lkuper / gist:1233728
Created Sep 22, 2011
Stuff ignored by the C311 autograder, circa 2010
View gist:1233728
;; Load the assignment we're testing
(load input-filename
(lambda (x)
(pmatch x
;; Ignore any (load ___) expressions that might happen
;; to be in the assignment.
[(load ,anything) (void)]
;; Ignore tests they've written themselves
[(test . ,anything) (void)]
lkuper / gist:1406028
Created Nov 29, 2011
implementation of factorial for brid.js (
View gist:1406028
> ["define", "*", ["lambda", ["n"], ["lambda", ["m"], ["if", ["eq?", "m", 0], 0, ["+", "n", [["*", "n"], ["-", "m", 1]]]]]]]
> ["define", "fact", ["lambda", ["n"], ["if", ["eq?", "n", 0], 1, [["*", "n"], ["fact", ["-", "n", 1]]]]]]
> ["fact", 5]
View gist:1850363
$ make petite install
./tangleit petite
This is CHEZTANGLE, ChezWEB Version 2.0.
Outputing runtime.sls
[: 24: petite: unexpected operator
View gist:1850417
lkuper@lenny:~/repos$ export CHEZWEBHOME=~/repos/ChezWEB/
lkuper@lenny:~/repos$ echo $CHEZWEBHOME
lkuper@lenny:~/repos$ ./ChezWEB/tangleit
./ChezWEB/tangleit: 5: ./ not found
View gist:2228832
;; given a store loc l and two stores S_1 and S_2, return the lub of
;; S_1(l) and S_2(l). We know that every l this function gets is
;; going to be in the domain of either S_1 or S_2 or both.
(define-metafunction lambdapar
lubstore-helper : S S l -> D
[(lubstore-helper S_1 S_2 l)
,(let ([d_1 (term (store-lookup S_1 l))]
[d_2 (term (store-lookup S_2 l))])
[(equal? d_1 (term lookupfailed)) d_2]
View gist:2246519
Title: Monotonic data structures as a guiding principle for
deterministic parallel programming
Kahn process networks, Haskell's monad-par library, and Intel's
Concurrent Collections language are three diverse examples of
deterministic-by-construction models of parallel computation. In a
deterministic-by-construction model, all programs written using the
model are guaranteed to behave deterministically, so they offer
View gist:2728360
fn not_ok(a: &uint) {
let mut g: fn@(x: &uint) = fn@(x: &r.uint) {};
fn main() {
lkuper@lenny:~/rust/build$ x86_64-unknown-linux-gnu/stage0/bin/rustc --debug-rustc ../src/test/run-pass/
../src/test/run-pass/ 4:49 error: mismatched types: expected `fn@(&uint)` but found `fn@(&r.uint)` (references with lifetime & do not necessarily outlive references with lifetime &r)
View gist:2877073
import vec::each;
fn getBigRecord(x: int)-> [int] {
let mut myVec = [], i = 0;
while i <= x {
myVec += [i];
i += 1;
View gist:2878640
type circular_buf<T> = {start: uint,
end: uint,
buf: [mut T]
fn make_circle<T>(s: uint, e: uint, +b: [mut T]) -> circular_buf<T> {
ret {start: s, end: e, buf: b };
fn main() { }
View gist:2885573
fn main() {
// Bitvector to represent sets of integral types
type int_ty_set = uint;
impl methods for int_ty_set {
fn union(s: int_ty_set) -> int_ty_set { self | s }
fn intersection(s: int_ty_set) -> int_ty_set { self & s }
You can’t perform that action at this time.