4 ms·
In terms of speed, yes. In terms of functionality, hell no. Compare the following in Racket: (define (add-2 x) (+ x 2)) (add-2 z) Where the result is
by tmtvl 2y ago
In terms of speed, yes. In terms of functionality, hell no. Compare the following in Racket:
(define (add-2 x)
(+ x 2))
(add-2 z)
Where the result is an error without the possibility to provide a value. Compared to in SBCL:
(defun add-2 (x)
(+ x 2))
(add-2 z)
Where we are dropped in the debugger with the following possible restarts:
* Continue, where we retry the operation (best to first define z),
* Use Value, where we can provide a value to use,
* Store Value, where we can set z to a value and use the value,
* Abort, where we just cancel the operation.
There's also setf expansions, so in SBCL we can do, for example:
(setf (car some-pair) 3)
Whereas in Racket we can't do the equivalent:
(set! (car some-pair) 3)