mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-18 19:10:18 +00:00
fix bugs
This commit is contained in:
parent
0247237fe8
commit
9c85fb90d3
44 changed files with 2585 additions and 2505 deletions
|
@ -3147,6 +3147,29 @@ fn dbg_str_followed_by_number() {
|
|||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn linked_list_reverse() {
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
LinkedList a : [Nil, Cons a (LinkedList a)]
|
||||
|
||||
reverse : LinkedList a -> LinkedList a
|
||||
reverse = \list -> reverseHelp Nil list
|
||||
|
||||
reverseHelp : LinkedList a, LinkedList a -> LinkedList a
|
||||
reverseHelp = \accum, list ->
|
||||
when list is
|
||||
Nil -> accum
|
||||
Cons first rest -> reverseHelp (Cons first accum) rest
|
||||
|
||||
main : LinkedList I64
|
||||
main = reverse (Cons 42 Nil)
|
||||
"#
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn linked_list_map() {
|
||||
indoc!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue