Skip to content

Commit 1e33a40

Browse files
committed
Add ?memoize argument to `@fun'
1 parent 174a3b9 commit 1e33a40

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

skill/macros/function.scm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
);foreach mapcan
128128
));let ;fun
129129

130-
(defglobalfun _\@fun ( name args doc global strict out body )
130+
(defglobalfun _\@fun ( name args doc global memoize strict out body )
131131
"`@fun' helper, generates S-expression to define a valid SKILL function."
132132
(assert doc "@fun - when defining '%N' ?doc is required and should be a string: %N" name doc)
133133
(let ( ( lambda_sexp
@@ -139,6 +139,7 @@
139139
body)
140140
) )
141141
)
142+
(when memoize (setq lambda_sexp `(@memoize ,lambda_sexp)))
142143
`( prog1
143144
(define ,name ,lambda_sexp)
144145
,@(when global `( ( when (theEnvironment) ( putd ',name ,name) ) ))
@@ -292,23 +293,25 @@ Raise an error otherwise."
292293
@key
293294
doc
294295
global
296+
memoize
295297
( strict (equal "TRUE" (getShellEnvVar "SKILL_SHARP_STRICT_TYPE_CHECKING")) )
296298
( out '__undefined__ )
297299
@rest body )
298300
"TODO - `@fun' implementation is still a draft..."
299-
(_\@fun name args doc global strict out body))
301+
(_\@fun name args doc global memoize strict out body))
300302

301303
(@macro @proc ( name_and_args
302304
@key
303305
doc
304306
global
307+
memoize
305308
( strict (equal "TRUE" (getShellEnvVar "SKILL_SHARP_STRICT_TYPE_CHECKING")) )
306309
( out '__undefined__ )
307310
@rest body )
308311
"This macro allows C-style writing.
309312
`@proc' is only `@fun' wrapper (like `procedure' for `defun' or `globalProc' for `defglobalfun').
310313
Please refer to `@fun' documentation."
311-
(_\@fun (car name_and_args) (cdr name_and_args) doc global strict out body)
314+
(_\@fun (car name_and_args) (cdr name_and_args) doc global memoize strict out body)
312315
)
313316

314317
;*/

0 commit comments

Comments
 (0)