Recursion schemes in ATS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DATS
SATS
test
.atsfmt.toml
.ctags
.gitignore
.travis.yml
LICENSE
README.md
TODO.md
atspkg.dhall
pkg.dhall

README.md

recursion

Build Status

Example

Sum a list of integers using a catamorphism:

staload "SATS/recursive.sats"

#include "DATS/recursive.dats"
#include "DATS/recursive_list0.dats"

fun sum(is : list0(int)) : int =
  let
    fn go(i : list0f(int, int)) : int =
      case+ i of
        | list0_consf (x, xs) => x + xs
        | list0_nilf() => 0
  in
    cata(lam x0 =<cloref1> go(x0), is)
  end