1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00

Move test that macro do not mutate functions as optional in stepA

This commit is contained in:
Nicolas Boulenguez 2019-05-15 06:07:45 +02:00
parent d1a5100ea9
commit c714889a98
3 changed files with 13 additions and 8 deletions

View File

@ -1537,6 +1537,10 @@ diff -urp ../process/step9_try.txt ../process/stepA_mal.txt
result of reading the next next form (2nd argument) (`read_form`) and the
next form (1st argument) in that order
(metadata comes first with the ^ macro and the function second).
* If you implemented as `defmacro!` to mutate an existing function
without copying it, you can now use the function copying mechanism
used for metadata to make functions immutable even in the
defmacro! case...
* Add a new "\*host-language\*" (symbol) entry to your REPL
environment. The value of this entry should be a mal string

View File

@ -172,11 +172,3 @@ x
;=>"MAL"
(->> [4] (concat [3]) (concat [2]) rest (concat [1]))
;=>(1 3 4)
;; Test that defining a macro does not mutate an existing function.
(def! f (fn* [x] (number? x)))
(defmacro! m f)
(f (+ 1 1))
;=>true
(m (+ 1 1))
;=>false

View File

@ -279,3 +279,12 @@
;=>55
(> (time-ms) start-time)
;=>true
;;
;; Test that defining a macro does not mutate an existing function.
(def! f (fn* [x] (number? x)))
(defmacro! m f)
(f (+ 1 1))
;=>true
(m (+ 1 1))
;=>false