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
staload "libc/SATS/signal.sats" | |
staload "libc/SATS/stdio.sats" | |
staload "libc/SATS/unistd.sats" | |
staload "libc/sys/SATS/wait.sats" | |
staload "libc/sys/SATS/types.sats" | |
staload "libc/sys/SATS/socket.sats" | |
staload "libc/netinet/SATS/in.sats" | |
staload "libc/arpa/SATS/inet.sats" | |
staload "prelude/DATS/array0.dats" |
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
staload "libc/SATS/random.sats" | |
staload "libc/SATS/unistd.sats" | |
staload "libats/SATS/parworkshop.sats" | |
staload "libats/DATS/parworkshop.dats" | |
staload "prelude/DATS/array.dats" | |
#define ITER 100000000 | |
#define NCPU 2 | |
fn random_double (buf: &drand48_data): double = let |
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
staload "libc/SATS/random.sats" | |
staload "libc/SATS/unistd.sats" | |
staload "libats/SATS/parworkshop.sats" | |
staload "libats/DATS/parworkshop.dats" | |
staload "prelude/DATS/array.dats" | |
#define ITER 100000000 | |
#define NCPU 2 | |
fn random_double (buf: &drand48_data): double = let |
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
/* | |
Copyright (c) 2011, Chris Double | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
%{^ | |
typedef struct resource { | |
void* data; | |
int x; | |
} resource; | |
%} | |
absviewtype data_vt (l:addr) | |
extern fun data_vt_make (): [l:agz] (data_vt l ) = "mac#data_make" | |
extern fun data_vt_free {l:addr} (r: data_vt l): void = "mac#data_free" |
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
fun foo {v:view} (pf: !v | b1: (!v | int) -<cloref> void):void = { | |
val v = 5 | |
val () = b1(pf | v) | |
} | |
implement main () = { | |
var x: int? with pf_x | |
viewdef V = int? @ x | |
val () = foo {V} (pf_x | lam (pf | newval) => x := newval) | |
val () = printf("%d\n", @(x)) |
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
staload "contrib/task/SATS/task.sats" | |
dynload "contrib/task/DATS/task.dats" | |
fn do_main (sch: scheduler) = begin | |
set_global_scheduler (sch); | |
task_spawn (16384, lam () => begin | |
print ("hello\n"); | |
task_yield (); | |
print ("world\n") |
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
all: base64 | |
base64: base64.dats | |
atscc -o base64 base64.dats |
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
all: stack1 stack2 stack3 stack4 stack5 | |
stack1: stack1.dats | |
atscc -o stack1 stack1.dats | |
stack2: stack2.dats | |
atscc -o stack2 stack2.dats | |
stack3: stack3.dats | |
atscc -tc stack3.dats |
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
/* From an example in the ATS distribution */ | |
dataprop FACT (int, int) = | |
| FACTzero (0, 1) | |
| {n,r,r1:int | n > 0} FACTsucc (n, r) of (FACT (n-1, r1), MUL (n, r1, r)) | |
fun fact {n:nat} .<n>. (n: int n): [r:int] (FACT (n, r) | int r) = | |
if n > 0 then let | |
val (pf1 | r1) = fact (n - 1) | |
val (pf_mul | r) = n imul2 r1 | |
in |
OlderNewer