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:
parent
d1a5100ea9
commit
c714889a98
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user