Skip to content

Instantly share code, notes, and snippets.

View christineponyl's full-sized avatar

Adam Jallad christineponyl

View GitHub Profile
actor Main
new create(env: Env) =>
None
primitive TokenCount
primitive TokenItem
type Token[A: Any #share] is ((TokenCount, None, USize) | (TokenItem, A))
interface Tokens[A: Any #share]
class Counter
var value: U32 = 0
fun ref increment(delta: Delta ref) =>
value = value + 1
delta.diff = delta.diff + 1
class Delta
var diff: U32 = 0
var foo: Any box = None
use "debug"
class Foo
new create() =>
Debug("create called")
fun apply() =>
Debug("apply called")
actor Main
actor Main
var max: I32 = 100
let sink: Prime
new create(env: Env) =>
try
max = env.args(1)?.i32()?
end
let n: I32 = 2
sink = Prime(env, n)
class JsonParser
let _input: String
var _index: ISize = 0
new create(input: String) =>
_input = input
fun _char(): U32 ? => _input.utf32(_index)?._1
fun _atom(c: U32): Bool => (c >= 'a') and (c <= 'z')
fun _digit(c: U32): Bool => (c >= '0') and (c <= '9')
class JsonParser
let _input: String
var _index: ISize = 0
new create(input: String) =>
_input = input
fun _current_char(): U32 ? => _input.utf32(_index)?._1
fun _is_atom(c: U32): Bool => (c >= 'a') and (c <= 'z')
fun _is_digit(c: U32): Bool => (c >= '0') and (c <= '9')
actor Main
new create(env: Env) =>
env.out.print("Hello, world!")
use "net"
use "time"
use "json"
use "net/http"
use "promises"
use "buffered"
use "collections"
use @time[USize](ptr: USize)
interface tag Source[A: Any val]
be poll(out: Out[A])
type Out[A: Any val] is {(A)} val
actor Func2[A: Any val, B: Any val, C: Any val] is Source[C]
let a: Source[A]
let b: Source[B]
let fn: {(A, B): C} val
new create(a': Source[A], b': Source[B], fn': {(A, B): C} val) =>
actor Main
new create(env: Env) =>
env.out.print("Hello, world!")