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
;; 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)] |
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
> ["define", "*", ["lambda", ["n"], ["lambda", ["m"], ["if", ["eq?", "m", 0], 0, ["+", "n", [["*", "n"], ["-", "m", 1]]]]]]] | |
"some-lambda" | |
> ["define", "fact", ["lambda", ["n"], ["if", ["eq?", "n", 0], 1, [["*", "n"], ["fact", ["-", "n", 1]]]]]] | |
"some-lambda" | |
> ["fact", 5] | |
120 |
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
$ make petite install | |
./bootstrap | |
./tangleit petite | |
This is CHEZTANGLE, ChezWEB Version 2.0. | |
Tangling chezweb.ss | |
Outputing runtime.ss | |
Outputing chezweave.ss | |
Outputing runtime.sls | |
Outputing cheztangle.ss | |
[: 24: petite: unexpected operator |
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
lkuper@lenny:~/repos$ export CHEZWEBHOME=~/repos/ChezWEB/ | |
lkuper@lenny:~/repos$ echo $CHEZWEBHOME | |
/home/lkuper/repos/ChezWEB/ | |
lkuper@lenny:~/repos$ ./ChezWEB/tangleit | |
./ChezWEB/tangleit: 5: ./cheztangle.ss: not found | |
lkuper@lenny:~/repos$ |
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
;; 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))]) | |
(cond | |
[(equal? d_1 (term lookupfailed)) d_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
Title: Monotonic data structures as a guiding principle for | |
deterministic parallel programming | |
Abstract: | |
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 |
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
fn not_ok(a: &uint) { | |
let mut g: fn@(x: &uint) = fn@(x: &r.uint) {}; | |
g(a); | |
} | |
fn main() { | |
} | |
lkuper@lenny:~/rust/build$ x86_64-unknown-linux-gnu/stage0/bin/rustc --debug-rustc ../src/test/run-pass/regions-fn-subtyping-2.rs | |
../src/test/run-pass/regions-fn-subtyping-2.rs:4:33: 4:49 error: mismatched types: expected `fn@(&uint)` but found `fn@(&r.uint)` (references with lifetime & do not necessarily outlive references with lifetime &r) |
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
code: | |
import vec::each; | |
fn getBigRecord(x: int)-> [int] { | |
let mut myVec = [], i = 0; | |
while i <= x { | |
myVec += [i]; | |
i += 1; | |
} |
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
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() { } |
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
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 } |
OlderNewer