File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments