evaluator: add user-defined functions
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
as yet unclassified
|
||||
testLambdaProcedureExecution
|
||||
self assert: (ph parseAndEval: '((lambda (x) (* x x)) 3)') equals: 9.
|
@@ -0,0 +1,7 @@
|
||||
as yet unclassified
|
||||
testProcedureDefinition
|
||||
| proc |
|
||||
ph parseAndEval: '(define squared (lambda (x) (* x x)))'.
|
||||
proc := ph parseAndEval: #squared.
|
||||
self assert: proc params equals: #(#x).
|
||||
self assert: proc body equals: #(#* #x #x)
|
@@ -0,0 +1,4 @@
|
||||
as yet unclassified
|
||||
testProcedureExecution
|
||||
ph parseAndEval: '(define squared (lambda (x) (* x x)))'.
|
||||
self assert: (ph parseAndEval: '(squared 3)') equals: 9
|
Reference in New Issue
Block a user