Created
August 24, 2017 23:01
-
-
Save U007D/916448ee026e402687392d3b37b03e32 to your computer and use it in GitHub Desktop.
Test code from Graydon Hoare's initial commit to the Rust repository on July 23, 2006
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
module foo; | |
syntax rx, html; | |
use bar.baz.(a,b,c); | |
type nat = int : positive(*); | |
type natvec1 = vec[nat]; | |
type natvec2 = vec[int : positive(*)]; | |
pred bounded1(int a, int b, int c) = le(a,b), lt(b,c); | |
pred bounded2(int a, int b, int c) | |
{ | |
ret a <= b & b < c; | |
} | |
const str x = "hello"; | |
const str y = replace(x, ~rx.pat{(el+)o}, ~rx.sub{$1foo}); | |
const str z = ~html.doc(4.0, "xhtml") | |
{ | |
<head><title>hello</title></head> | |
}; | |
iter span(int a, int b) : le(a,b) | |
-> int : le(a,*), lt(*,b) | |
{ | |
int i = a; | |
while (i < b) | |
{ | |
yield i; | |
i += 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment