Linear lazy-evaluation in ATS2

FYI.

Linear lazy-evaluation is now supported in ATS2. Here is an implementation
of Erathosthene’s sieve of primes based on linear lazy-evalutation:

Every piece of allocated memory is freed at the end in this implementation.
In terms of efficiency,
it takes less than 1/4 of the time taken by a corresponding implementation
based on non-linear lazy
evaluation to find the 10000th prime number.

Cheers!

What does ~ns stand for in the following?

and sieve (ns: stream_vt N2): stream_vt (N2) = $ldelay (sieve_con ns, ~ns)On Saturday, September 28, 2013 11:31:10 PM UTC-4, gmhwxi wrote:

FYI.

Linear lazy-evaluation is now supported in ATS2. Here is an implementation
of Erathosthene’s sieve of primes based on linear lazy-evalutation:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/INTRO/sieve_llazy.dats

Every piece of allocated memory is freed at the end in this
implementation. In terms of efficiency,
it takes less than 1/4 of the time taken by a corresponding implementation
based on non-linear lazy
evaluation to find the 10000th prime number.

Cheers!

I believe you would say this is a linear notation specifying that $ldelay
should free ns.

Brandon Barker
brandon…@gmail.comOn Sun, Sep 29, 2013 at 4:38 PM, Zhiqiang Ren alex.r...@gmail.comwrote:

What does ~ns stand for in the following?

=====================================
and sieve (ns: stream_vt N2): stream_vt (N2) = $ldelay (sieve_con ns, ~ns)

On Saturday, September 28, 2013 11:31:10 PM UTC-4, gmhwxi wrote:

FYI.

Linear lazy-evaluation is now supported in ATS2. Here is an implementation
of Erathosthene’s sieve of primes based on linear lazy-evalutation:

https://github.com/githwxi/**ATS-Postiats/blob/master/doc/**
EXAMPLE/INTRO/sieve_llazy.datshttps://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/INTRO/sieve_llazy.dats

Every piece of allocated memory is freed at the end in this
implementation. In terms of efficiency,
it takes less than 1/4 of the time taken by a corresponding
implementation based on non-linear lazy
evaluation to find the 10000th prime number.

Cheers!


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.
To post to this group, send email to ats-lan...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/027d3366-a076-4173-8cac-49eb973b83af%40googlegroups.com
.

Right. This makes sure that resources contained in a linear lazy-value can
be freed.

See:

https://sourceforge.net/p/ats2-lang/code/ci/master/tree/prelude/SATS/lazy_vt.sats?force=True

The function for freeing a lazy-value is declared as follows:

fun
lazy_vt_free{a:vt0p}
(lazyval: lazy_vt (a)):<!wrt> void = “mac#atspre_lazy_vt_free”
overload ~ with lazy_vt_freeOn Sunday, September 29, 2013 4:43:15 PM UTC-4, Brandon Barker wrote:

I believe you would say this is a linear notation specifying that $ldelay
should free ns.

Brandon Barker
brand...@gmail.com <javascript:>

On Sun, Sep 29, 2013 at 4:38 PM, Zhiqiang Ren <alex...@gmail.com<javascript:> wrote:

What does ~ns stand for in the following?

=====================================
and sieve (ns: stream_vt N2): stream_vt (N2) = $ldelay (sieve_con ns, ~ns)

On Saturday, September 28, 2013 11:31:10 PM UTC-4, gmhwxi wrote:

FYI.

Linear lazy-evaluation is now supported in ATS2. Here is an
implementation
of Erathosthene’s sieve of primes based on linear lazy-evalutation:

https://github.com/githwxi/**ATS-Postiats/blob/master/doc/**
EXAMPLE/INTRO/sieve_llazy.datshttps://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/INTRO/sieve_llazy.dats

Every piece of allocated memory is freed at the end in this
implementation. In terms of efficiency,
it takes less than 1/4 of the time taken by a corresponding
implementation based on non-linear lazy
evaluation to find the 10000th prime number.

Cheers!


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...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com<javascript:>
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/027d3366-a076-4173-8cac-49eb973b83af%40googlegroups.com
.