diff --git a/spec.md b/spec.md index 879d065..d045283 100644 --- a/spec.md +++ b/spec.md @@ -132,6 +132,11 @@ def example6-error(): Option[Unit] { } ``` +### pattern 1: labelled arguments +``` +def [t] List.remove_prefix(prefix: List[t], list: 'from List[t]) +``` + ## automatic return types ``` def add(a: Num, b: Num) -> _ { @@ -181,7 +186,17 @@ def example(li: List[Char]) -> {t:Token,rem:List[Char]} { } ``` -## pattern 1: labelled arguments +## recursive data types ``` -def [t] List.remove_prefix(prefix: List[t], list: 'from List[t]) +type List[t] = {head:t, tail:List[t]} +# now you might notice an issue with this +# `type` defines non-distinct type alisases +# so what is the type of this... +# Introducing: type self references +# the above example is the same as this: +type List[t] = &a {head:t, tail:a} + +# example 2: +# a List[List[t]] is just: +&b {head: &a {head:t, tail:a}, tail: b} ``` \ No newline at end of file