Ifcase-expressions

ATS2 now supports ifcase-expressions, which are similar to
the if-expressions in Erlang. Here is an example:

//
fun
acker
{m,n:nat}
.<m,n>.
(
m: int(m)
, n: int(n)
) : intGte(0) =
(
ifcase
| m = 0 => n + 1
| n = 0 => acker(m-1, 1)
| _(else) => acker(m-1, acker(m, n-1))
// end of [ifcase]
)
//

Note that the ifcase-expression in the above code is equivalent
to the following one:

if m=0 then n+1 else if n=0 then acker(m-1, 1) else acker(m-1, acker(m,
n-1))

Like an if-expression, an ifcase-expression can also be
annotated with a state type. Please see an example by visiting
the following link:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/TESTATS/ifcase.datsOn Sunday, May 22, 2016 at 12:24:21 AM UTC-4, gmhwxi wrote:

ATS2 now supports ifcase-expressions, which are similar to
the if-expressions in Erlang. Here is an example:

//
fun
acker
{m,n:nat}
.<m,n>.
(
m: int(m)
, n: int(n)
) : intGte(0) =
(
ifcase
| m = 0 => n + 1
| n = 0 => acker(m-1, 1)
| _(else) => acker(m-1, acker(m, n-1))
// end of [ifcase]
)
//

Note that the ifcase-expression in the above code is equivalent
to the following one:

if m=0 then n+1 else if n=0 then acker(m-1, 1) else acker(m-1, acker(m,
n-1))

This is cool!On Sunday, May 22, 2016 at 12:24:21 AM UTC-4, gmhwxi wrote:

ATS2 now supports ifcase-expressions, which are similar to
the if-expressions in Erlang. Here is an example:

//
fun
acker
{m,n:nat}
.<m,n>.
(
m: int(m)
, n: int(n)
) : intGte(0) =
(
ifcase
| m = 0 => n + 1
| n = 0 => acker(m-1, 1)
| _(else) => acker(m-1, acker(m, n-1))
// end of [ifcase]
)
//

Note that the ifcase-expression in the above code is equivalent
to the following one:

if m=0 then n+1 else if n=0 then acker(m-1, 1) else acker(m-1, acker(m,
n-1))