Add another failing test example (d)
``` Error: × Main thread panicked. ├─▶ at crates/lang/src/uplc.rs:3264:35 ╰─▶ called `Option::unwrap()` on a `None` value help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace. ```
This commit is contained in:
parent
d78e2c9c6f
commit
8f69a4b600
|
@ -0,0 +1,2 @@
|
|||
name = "test_d"
|
||||
version = "0.0.0"
|
|
@ -0,0 +1,18 @@
|
|||
pub fn foldr(xs: List(a), f: fn(a, b) -> b, zero: b) -> b {
|
||||
when xs is {
|
||||
[] -> zero
|
||||
[x, ..rest] -> f(x, foldr(rest, f, zero))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prepend(x: a, xs: List(a)) -> List(a) {
|
||||
[x, ..xs]
|
||||
}
|
||||
|
||||
pub fn concat(left: List(a), right: List(a)) -> List(a) {
|
||||
foldr(left, prepend, right)
|
||||
}
|
||||
|
||||
test concat_1() {
|
||||
concat([1, 2, 3], [4, 5, 6]) == [1, 2, 3, 4, 5, 6]
|
||||
}
|
Loading…
Reference in New Issue