wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic 1804 vars into 126 states, 64 into lets; 23498 edits in 460 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 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 (function_values_st: mut FunctionValuesState) {
|
||||
function_values_st.op = fn double
|
||||
print(function_values_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 function_values_st.op != null { print(1) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue