2
votes

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?

1
Your example doesn't show the problem your question seems to be about: there is a function called first, which you are calling on a symbol, hello, which is causing it to raise an error, as first 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

1 Answers

1
votes

See page 510. The appendix explains that you need to download support code:

https://people.eecs.berkeley.edu/~bh/pdf/ssch27.pdf

FWIW there is a package for Simply Scheme that works with Racket

https://pkgs.racket-lang.org/package/simply-scheme