add const definition
This commit is contained in:
parent
848160c2de
commit
c2b48289ab
2 changed files with 10 additions and 0 deletions
|
@ -64,6 +64,11 @@
|
|||
(code (popd fe)))
|
||||
(register voc name #'(lambda (fe) (exec fe code))))))
|
||||
|
||||
(reg-b "const" #'(lambda (fe)
|
||||
(let ((name (popd fe))
|
||||
(value (popd fe)))
|
||||
(register (car(vocabulary fe)) name #'(lambda (fe) (pushd fe value))))))
|
||||
|
||||
; internal definitions
|
||||
|
||||
(defun popd (fe)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;(format t "~%data-stack ~a" (data-stack fe))
|
||||
(test-def tst fe)
|
||||
(test-exec-str tst fe)
|
||||
(test-const tst fe)
|
||||
(sct:result tst)))
|
||||
|
||||
(defun test-exec (tst fe)
|
||||
|
@ -32,3 +33,7 @@
|
|||
(scf:exec-str fe "16 square")
|
||||
(sct:assert-eq tst (car (scf:data-stack fe)) 256))
|
||||
|
||||
(defun test-const (tst fe)
|
||||
(scf:exec-str fe "17 \"c1\" const")
|
||||
(scf:exec-str fe "c1 square")
|
||||
(sct:assert-eq tst (car (scf:data-stack fe)) 289))
|
||||
|
|
Loading…
Add table
Reference in a new issue