Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vmchale/recursion
Recursion schemes in ATS
https://github.com/vmchale/recursion
Last synced: 3 months ago
JSON representation
Recursion schemes in ATS
- Host: GitHub
- URL: https://github.com/vmchale/recursion
- Owner: vmchale
- License: bsd-3-clause
- Created: 2018-05-28T21:56:27.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-11T14:46:50.000Z (about 2 years ago)
- Last Synced: 2024-01-23T07:40:14.281Z (5 months ago)
- Language: ATS
- Size: 35.2 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-recursion-schemes - recursion - Demonstration of (Implementations / Hylomorphisms in the Wild)
README
# recursion
[![Build Status](https://travis-ci.org/vmchale/recursion.svg?branch=master)](https://travis-ci.org/vmchale/recusion)
## Example
Sum a list of integers using a catamorphism:
```ats
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 = go(x0), is)
end
```