feat: support self recursion functions and fix making constrs

This commit is contained in:
Kasey White
2022-11-24 15:14:01 -05:00
committed by Kasey White
parent 09e77e1918
commit 6babebde28
2 changed files with 416 additions and 109 deletions

View File

@@ -28,20 +28,20 @@ pub fn final_check(z: Int) {
z < 4
}
pub fn incrementor(counter: Int, target: Int) -> Int {
if counter == target {
target
} else {
incrementor(counter + 1, target)
}
}
pub fn spend(
datum: sample.Datum,
rdmr: Redeemer,
ctx: spend.ScriptContext,
) -> Bool {
let x = datum.rdmr
let y = [datum.fin, 2, 3]
let z = [1, ..y]
when z is {
[] -> False
[a] -> a == 1
[a, b] -> b == 2
[a, b, c] -> a > 1
[a, b, c, ..d] -> b > 1
_other -> True
}
let x = Sell
let z = incrementor(0, 4) == 4
z
}