ATSLIB/prelude/stream


  • stream
  • stream_con
  • StreamSubscriptExn
  • stream2list
  • stream_take_exn
  • stream_drop_exn
  • stream_nth_exn
  • stream_nth_opt
  • stream_append
  • stream_concat
  • stream_filter
  • stream_filter$pred
  • stream_filter_fun
  • stream_filter_cloref
  • stream_map
  • stream_map$fopr
  • stream_map_fun
  • stream_map_cloref
  • stream_imap
  • stream_imap$fopr
  • stream_imap_fun
  • stream_imap_cloref
  • stream_map2
  • stream_map2$fopr
  • stream_map2_fun
  • stream_map2_cloref
  • stream_merge
  • stream_merge$cmp
  • stream_merge_fun
  • stream_merge_cloref
  • stream_mergeq
  • stream_mergeq$cmp
  • stream_mergeq_fun
  • stream_mergeq_cloref
  • stream_foreach
  • stream_foreach_env
  • stream_foreach$cont
  • stream_foreach$fwork

  • stream

    Synopsis

    typedef
    stream (a:t0p) = lazy (stream_con(a))
    

    stream_con

    Synopsis

    datatype
    stream_con
      (a:t@ype+) =
    //
    // t@ype+: covariant
    //
      | stream_nil of ((*void*))
      | stream_cons of (a, stream(a))
    //
    where stream (a:t@ype) = lazy (stream_con(a))

    StreamSubscriptExn

    Synopsis

    exception StreamSubscriptExn of ((*void*))

    stream2list

    Synopsis

    fun{a:t0p}
    stream2list
      (xs: stream(INV(a))):<!laz> List0_vt(a)

    Description

    This function turns a given stream into a linear list.

    stream_take_exn

    Synopsis

    fun{a:t0p}
    stream_take_exn{n:nat}
      (xs: stream(INV(a)), n: int n):<!laz> list_vt(a, n)

    stream_drop_exn

    Synopsis

    fun{a:t0p}
    stream_drop_exn
      (xs: stream(INV(a)), n: intGte(0)):<!laz> stream(a)

    stream_nth_exn

    Synopsis

    fun{a:t0p}
    stream_nth_exn
      (xs: stream(INV(a)), n: intGte(0)):<!laz> (a)

    Description

    Given a stream xs and a natural number n, this function returns xs[n], that is, element n in xs if xs contains at least n elements. Otherwise, a run-time exception (StreamSubscriptExn) is raised.

    stream_nth_opt

    Synopsis

    fun{a:t0p}
    stream_nth_opt
      (xs: stream(INV(a)), n: intGte(0)):<!laz> Option_vt(a)

    Description

    This function is the optional version of stream_nth_exn.

    stream_append

    Synopsis

    fun{a:t0p}
    stream_append
      (xs: stream(INV(a)), ys: stream(a)):<!laz> stream(a)

    stream_concat

    Synopsis

    fun{a:t0p}
    stream_concat(xss: stream(stream(INV(a)))):<!laz> stream(a)

    stream_filter

    Synopsis

    fun{a:t0p}
    stream_filter
      (xs: stream(INV(a))):<!laz> stream(a)

    stream_filter$pred

    Synopsis

    fun{a:t0p} stream_filter$pred (x: a):<> bool

    stream_filter_fun

    Synopsis

    fun{a:t0p}
    stream_filter_fun
    (
      xs: stream(INV(a)), pred: (a) -<fun> bool
    ) :<!laz> stream(a) // end-of-function

    stream_filter_cloref

    Synopsis

    fun{a:t0p}
    stream_filter_cloref
    (
      xs: stream(INV(a)), pred: (a) -<cloref> bool
    ) :<!laz> stream(a) // end-of-function

    stream_map

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_map
      (xs: stream(INV(a))):<!laz> stream(b)

    stream_map$fopr

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_map$fopr (x: a):<(*none*)> (b)

    stream_map_fun

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_map_fun
      (xs: stream(INV(a)), fopr: (a) -<fun> b):<!laz> stream(b)

    stream_map_cloref

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_map_cloref
      (xs: stream(INV(a)), fopr: (a) -<cloref> b):<!laz> stream(b)

    stream_imap

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_imap
      (xs: stream(INV(a))):<!laz> stream(b)

    stream_imap$fopr

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_imap$fopr (i: intGte(0), x: a):<> (b)

    stream_imap_fun

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_imap_fun
    (
      xs: stream(INV(a)), fopr: (intGte(0), a) -<fun> b
    ) :<!laz> stream(b) // end-of-fun

    stream_imap_cloref

    Synopsis

    fun{
    a:t0p}{b:t0p
    } stream_imap_cloref
    (
      xs: stream(INV(a)), fopr: (intGte(0), a) -<cloref> b
    ) :<!laz> stream(b) // end-of-fun

    stream_map2

    Synopsis

    fun{
    a1,a2:t0p}{b:t0p
    } stream_map2
    (
      xs1: stream(INV(a1))
    , xs2: stream(INV(a2))
    ) :<!laz> stream(b) // end-of-fun

    stream_map2$fopr

    Synopsis

    fun{
    a1,a2:t0p}{b:t0p
    } stream_map2$fopr (x1: a1, x2: a2):<> b

    stream_map2_fun

    Synopsis

    fun{
    a1,a2:t0p}{b:t0p
    } stream_map2_fun
    (
      xs1: stream(INV(a1))
    , xs2: stream(INV(a2)), fopr: (a1, a2) -<fun> b
    ) :<!laz> stream(b) // end-of-fun

    stream_map2_cloref

    Synopsis

    fun{
    a1,a2:t0p}{b:t0p
    } stream_map2_cloref
    (
      xs1: stream(INV(a1))
    , xs2: stream(INV(a2)), fopr: (a1, a2) -<cloref> b
    ) :<!laz> stream(b) // end-of-fun

    stream_merge

    Synopsis

    fun
    {a:t0p}
    stream_merge
    (
      xs1: stream(INV(a)), xs2: stream(a)
    ) :<!laz> stream(a) // end-of-function

    stream_merge$cmp

    Synopsis

    fun{a:t0p}
    stream_merge$cmp (x1: a, x2: a):<> int

    stream_merge_fun

    Synopsis

    fun
    {a:t0p}
    stream_merge_fun
    (
      xs1: stream(INV(a))
    , xs2: stream(a), cmp: (a, a) -<fun> int
    ) :<!laz> stream(a) // end of [stream_merge_fun]

    stream_merge_cloref

    Synopsis

    fun
    {a:t0p}
    stream_merge_cloref
    (
      xs1: stream(INV(a))
    , xs2: stream(a), cmp: (a, a) -<cloref> int
    ) :<!laz> stream(a) // end of [stream_merge_cloref]

    stream_mergeq

    Synopsis

    fun{a:t0p}
    stream_mergeq
    (
      xs1: stream(INV(a)), xs2: stream(a)
    ) :<!laz> stream(a)

    stream_mergeq$cmp

    Synopsis

    fun{a:t0p}
    stream_mergeq$cmp(x1: a, x2: a):<> int

    stream_mergeq_fun

    Synopsis

    fun{a:t0p}
    stream_mergeq_fun
    (
      xs1: stream(INV(a))
    , xs2: stream(a), cmp: (a, a) -<fun> int
    ) :<!laz> stream(a) // end-of-function

    stream_mergeq_cloref

    Synopsis

    fun{a:t0p}
    stream_mergeq_cloref
    (
      xs1: stream(INV(a))
    , xs2: stream(a), cmp: (a, a) -<cloref> int
    ) :<!laz> stream(a) // end-of-function

    stream_foreach

    Synopsis

    fun
    {a:t0p}
    stream_foreach(xs: stream(a)): void

    stream_foreach_env

    Synopsis

    fun
    {a:t0p}
    {env:vt0p}
    stream_foreach_env(xs: stream(a), &env >> _): void

    stream_foreach$cont

    Synopsis

    fun
    {a:t0p}
    {env:vt0p}
    stream_foreach$cont(x: a, env: &env): bool

    stream_foreach$fwork

    Synopsis

    fun
    {a:t0p}
    {env:vt0p}
    stream_foreach$fwork(x: a, env: &env): void

    This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. SourceForge.net Logo