22 lines
610 B
HTML
22 lines
610 B
HTML
#! /usr/bin/gcl -f
|
|
|
|
; (funcall 'function ...function arguments...)
|
|
; ---------------------------------------------
|
|
; given a function and a sequence of parameters,
|
|
; funcall can be used to apply the function to the arguments
|
|
|
|
; use funcall to evaluate (* 1 2 3 4)
|
|
(setf x (funcall '* 1 2 3 4))
|
|
|
|
; print the result
|
|
(format t "~A~%" x)
|
|
|
|
; function that takes a binary operator and two values as parameters
|
|
; and runs the function on the two values
|
|
(defun binRun (f a b)
|
|
(cond
|
|
((not (functionp f)) (format t "~A is not a function~%" f))
|
|
(t (funcall f a b))))
|
|
|
|
(binRun 'format t "hello!~%")
|
|
|