fun vs fn

63 views
Skip to first unread message

Yves Dorfsman

unread,
Apr 11, 2014, 3:08:11 AM4/11/14
to ats-lan...@googlegroups.com

In the ATS book, it says:

"Therefore, a non-recursive function is just a special kind of of recursive
function: the kind that does not make any calls to itself in its body."

But then a recursive function is defined differently than a non-recursive (fun
vs fn). Why is that? Is this to help the compiler?

What would be the impact of bind a non-recursive function with "fun"?


Thanks.

--
Yves.

gmhwxi

unread,
Apr 11, 2014, 10:10:40 AM4/11/14
to ats-lan...@googlegroups.com
In ATS, non-termination (ntm) is considered a kind of effect.
Any function declared using the keyword 'fun' is assumed to have
the ntm effect unless a termination metric is provided.

fn foo (...) ...

is just a shorthand for

fun foo .<>. (...) ...

where .<>. is the empty termination metric.

For most uses, the difference btween fn and fun is probably irrelevant.

Yves Dorfsman

unread,
Apr 11, 2014, 2:47:56 PM4/11/14
to ats-lan...@googlegroups.com

Thanks, that actually makes more sense. Would it make sense to explain it like
that in the book, rather than recursive vs. non-recursive?
> --
> 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-user...@googlegroups.com
> <mailto:ats-lang-user...@googlegroups.com>.
> To post to this group, send email to ats-lan...@googlegroups.com
> <mailto:ats-lan...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/0d8552a0-4230-4cf2-b201-6ab070d6d355%40googlegroups.com
> <https://groups.google.com/d/msgid/ats-lang-users/0d8552a0-4230-4cf2-b201-6ab070d6d355%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Yves.
Reply all
Reply to author
Forward
0 new messages