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)) >
-- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To post to this group, send email to ats-lang-users@googlegroups.com. Visit this group at https://groups.google.com/group/ats-lang-users. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/d36821e9-432d-4137-b039-bf7c36b776c4%40googlegroups.com.