What a way to get people through their prejudices.
Change the name from Scheme to Racket and bank on people not having a history of being misinformed to believe Lisp and Scheme are dead.
They ain’t of course. Been hanging on for a Renaissance.
Go figure functional languages have resurged. You remember those.
Of course Erlang does Lisp (aka lfe).
But what ballsy misdirection. Just don’t call it Scheme no more no more, just don’t call it Scheme no more.
Bad form in the examples:
(define (reply-more s) (cond [(equal? “hello” (substring s 0 5)) “hi!”] [(equal? “goodbye” (substring s 0 7)) “bye!”] [(equal? “?” (substring s (– (string-length s) 1))) “I don’t know”] [else “huh?”]))
> (reply-more “hello racket”) “hi!” > (reply-more “goodbye cruel world”) “bye!” > (reply-more “what is your favorite color?”) “I don’t know” > (reply-more “mine is lime green”) “huh?”
The problem being the test for “?” and that one is forced to fall through the first two tests and so it cracks up when a string shorter than 5 char comes through as there is an overrange condition.
. . substring: ending index is out of range
ending index: 5
starting index: 0
valid range: [0, 4]
Still takes me back. I did knock up a lisp interpreter in FORTH years ago … for the shear fun of it.
The safer version thus (forgive the loss of indenting):
> (reply-more “bug?”)
“I don’t know”
I will leave it to the reader to work out if there is a bug if a 6 character string is used.
Now why I like lisp/scheme/forth? The same reason I like python. Very productive code and test and code and test and code and test.
So, now I like Racket too.