wip(0.S3): packages and examples migrated in one run - ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d490d4f9f1
commit
3eda72e8c2
172 changed files with 3094 additions and 2966 deletions
|
|
@ -9,12 +9,14 @@ program FunctionValues {
|
|||
function double(x: int) -> int { return x * 2 }
|
||||
function square(x: int) -> int { return x * x }
|
||||
function half(x: float) -> float { return x / 2.0 }
|
||||
var op: fn(int) -> int = null
|
||||
state FunctionvaluesState {
|
||||
op: fn(int) -> int = null
|
||||
}
|
||||
function run_with(f: fn(int) -> int, v: int) -> int { return f(v) }
|
||||
function pass_on(f: fn(float) -> float) -> fn(float) -> float { return f }
|
||||
entry {
|
||||
op = fn double
|
||||
print(op(21))
|
||||
entry (functionvalues_st: mut FunctionvaluesState) {
|
||||
functionvalues_st.op = fn double
|
||||
print(functionvalues_st.op(21))
|
||||
let ops = new []fn(int) -> int
|
||||
push(ops, fn double)
|
||||
push(ops, fn square)
|
||||
|
|
@ -26,6 +28,6 @@ program FunctionValues {
|
|||
print(run_with(fn square, 9))
|
||||
let h = pass_on(fn half)
|
||||
print(h(3.0))
|
||||
if op != null { print(1) }
|
||||
if functionvalues_st.op != null { print(1) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue