mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-11-05 04:51:40 +03:00
21 lines
560 B
Plaintext
21 lines
560 B
Plaintext
(StrTail (0, str)) = (0, str)
|
|
(StrTail (+n, (h, t))) = (n, t)
|
|
Main = (StrTail (2, ('a', 'b')))
|
|
|
|
/*
|
|
(Main) = (StrTail$R0 (2, (97, 98)))
|
|
|
|
// Destructure first tup
|
|
(StrTail$R0) = λa_1 let (b_1, c_1) = a_1; (StrTail$F0 b_1 c_1)
|
|
|
|
// Match on len
|
|
(StrTail$F0) = λa_1 match a_1 { 0: StrTail$F0$R0; +: StrTail$F0$P+ }
|
|
|
|
// Len 0
|
|
(StrTail$F0$R0) = λa_1 (0, a_1)
|
|
|
|
// Len >0
|
|
(StrTail$F0$P+) = λa_1 λb_1 (StrTail$F0$P+$P b_1 a_1)
|
|
(StrTail$F0$P+$P) = λa_1 λb dup b_1 b_2 = b; (StrTail$F0$R1 b_2 a_1 b_1)
|
|
(StrTail$F0$R1) = λa_1 λb_1 let (*, d_1) = b_1; (a_1, d_1)
|
|
*/ |