Skip to content

Commit

Permalink
Fix bug in map: should pass args as list
Browse files Browse the repository at this point in the history
This appeared only for variadic function which is used in EVAL.

Added a test to step 9 to catch this earlier.
  • Loading branch information
bendudson committed Dec 21, 2017
1 parent 7f5572b commit e2ada64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nasm/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2211,14 +2211,16 @@ core_map:
mov cl, BYTE [r9]
and cl, content_mask

mov ch, cl
or cl, container_list
call alloc_cons
mov [rax], BYTE cl ; set content type
mov rbx, [r9 + Cons.car]
mov [rax + Cons.car], rbx ; Copy content
mov rsi, rax

cmp cl, content_pointer
cmp ch, content_pointer
jne .run

; A pointer, so increment ref count
Expand Down
3 changes: 3 additions & 0 deletions tests/step9_try.mal
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
(map (fn* (a) (* 2 a)) [1 2 3])
;=>(2 4 6)

(map (fn* [& args] (list? args)) [1 2])
;=>(true true)

;; Testing vector functions

(vector? [10 11])
Expand Down

0 comments on commit e2ada64

Please sign in to comment.