langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
37
Task/Mutual-recursion/TXR/mutual-recursion.txr
Normal file
37
Task/Mutual-recursion/TXR/mutual-recursion.txr
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
@(define f (n out))
|
||||
@ (local n1 fn1 mfn1)
|
||||
@ (cases)
|
||||
@ (bind n "0")
|
||||
@ (bind out "1")
|
||||
@ (or)
|
||||
@ (next `!echo $(( @n - 1 ))`)
|
||||
@ n1
|
||||
@ (f n1 fn1)
|
||||
@ (m fn1 mfn1)
|
||||
@ (next `!echo $(( @n - @mfn1 ))`)
|
||||
@ out
|
||||
@ (end)
|
||||
@(end)
|
||||
@(define m (n out))
|
||||
@ (local n1 mn1 fmn1)
|
||||
@ (cases)
|
||||
@ (bind n "0")
|
||||
@ (bind out "0")
|
||||
@ (or)
|
||||
@ (next `!echo $(( @n - 1 ))`)
|
||||
@ n1
|
||||
@ (m n1 mn1)
|
||||
@ (f mn1 fmn1)
|
||||
@ (next `!echo $(( @n - @fmn1 ))`)
|
||||
@ out
|
||||
@ (end)
|
||||
@(end)
|
||||
@(next `!seq 0 15`)
|
||||
@(collect :vars ())
|
||||
@ n
|
||||
@ (f n fn)
|
||||
@ (m n mn)
|
||||
@ (output)
|
||||
f(@n) = @fn; m(@n) = @mn
|
||||
@ (end)
|
||||
@(end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue