Skip to content

Commit 698ccbf

Browse files
committed
WIP
1 parent 3b5415f commit 698ccbf

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(defun reduce (fun i lst)
2+
(if lst
3+
(reduce fun (a fun (list i (f lst))) (r lst))
4+
i
5+
)
6+
)
7+
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
(include *standard-cl-23*)
3+
(import std.reduce exposing reduce)
4+
(reduce (lambda (a b) (+ a b)) 0 (list 1 2 3))
5+
6+
7+
8+

src/tests/compiler/modules.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,3 +619,21 @@ fn test_constant_multiple_rounds() {
619619
]
620620
);
621621
}
622+
623+
#[test]
624+
fn test_lib_reduce() {
625+
let filename = "resources/tests/module/test-reduce.clsp";
626+
let content = fs::read_to_string(filename).expect("file should exist");
627+
let f_hex_file = "resources/tests/module/test-reduce.clsp.hex";
628+
test_compile_and_run_program_with_modules(
629+
filename,
630+
&content,
631+
&[
632+
HexArgumentOutcome {
633+
hexfile: f_hex_file,
634+
argument: "()",
635+
outcome: ContentEquals
636+
}
637+
]
638+
);
639+
}

0 commit comments

Comments
 (0)