Skip to content

Commit 075bcb1

Browse files
committed
Made define more efficient by ensuring that its expansion only happens once.
1 parent b7d8958 commit 075bcb1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/core-meta.l2

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -764,15 +764,14 @@
764764
(closure (func) (l r)
765765
`:(with percent.return [,:func percent.return , l]):r r)))
766766

767-
(-- A macro to define C-style substitution macros. Does the following transformation:
768-
((define id macro) frags ...)
767+
(-- A macro to alias a macro. Does the following transformation:
768+
(define id macro)
769769
->
770-
(macro frags ...))
770+
(function id (l r) [macro l r]))
771771

772772
(function define (l r)
773-
`:(function ,:[@fst l] (l r)
774-
(let (macro ,:[meta.qval [@frst l] r])
775-
[lst macro l r])):r)
773+
`:(function ,:[@fst l] (define.l define.r)
774+
[,:[@frst l] define.l define.r]):r)
776775

777776
(-- This macro exists to form a pair with Value.)
778777

0 commit comments

Comments
 (0)