Add new acceptance test scenario: 034

```
  Error:
    × Main thread panicked.
    ├─▶ at /Users/ktorz/Documents/Projects/aiken-lang/aiken/crates/aiken-project/src/lib.rs:670:22
    ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "aiken/list_foldr_list_data_data_list_data", unique: Unique(1) })
  ```
This commit is contained in:
KtorZ 2022-12-28 10:59:39 +01:00
parent 722117bfc4
commit 77fbb3cbdb
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# This file was generated by Aiken
# You typically do not need to edit this file
requirements = []
packages = []

View File

@ -0,0 +1,2 @@
name = "aiken-lang/acceptance_test_034"
version = "0.0.0"

View File

@ -0,0 +1,18 @@
pub fn foldr(self: List<a>, with: fn(a, b) -> b, zero: b) -> b {
when self is {
[] -> zero
[x, ..xs] -> with(x, foldr(xs, with, zero))
}
}
pub fn flat_map(self: List<a>, with: fn(a) -> List<b>) -> List<b> {
foldr(self, fn(x, xs) { concat(with(x), xs) }, [])
}
test flat_map_1() {
flat_map([], fn(a) { [a] }) == []
}
test flat_map_2() {
flat_map([1, 2, 3], fn(a) { [a, a] }) == [1, 1, 2, 2, 3, 3]
}