Introductory programming courses using Scheme often use a version which includes primitive functions like first
and bf
(described here).
I have MIT Scheme running locally thanks to this question, but it throws the following error when I try to use one of these primitive functions.
MIT/GNU Scheme running under OS X
Type `^C' (control-C) followed by `H' to obtain information about interrupts.
Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Image saved on Saturday May 17, 2014 at 2:39:25 AM
Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118
Edwin 3.116
1 ]=> (first 'hello)
;The object hello, passed as an argument to safe-car, is not a pair.
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.
How can I import these primitive functions into scheme to use?
first
, which you are calling on a symbol,hello
, which is causing it to raise an error, asfirst
is defined only on conses (and perhaps the empty list, or even if your scheme is fussy enough (Racket is) only on proper lists which are not empty). – user5920214