For the curious, the definition of first is:
(define (first x)
(if (and (pair? x) (list? x))
(car x)
(raise-argument-error 'first "(and/c list? (not/c empty?))" x)))
I found this definition like this:
1. Entered this program in DrRacket:
#lang racket
first
2. Clicked the "Check Syntax" button
3. Right clicked the identifier first and chose "Open defining file"
4. Chose "first" in the definition-drop-down in the upper left corner.
/Jens Axel
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
--
--
Jens Axel Søgaard
____________________
Racket Users list:
http://lists.racket-lang.org/users
> (object-name null?)
'null?
> (object-name empty?)
'empty?
> (define my-empty? empty?)
> (object-name my-empty?)
'empty?
/Jens Axel
--
--
Jens Axel Søgaard
____________________
/Jens Axel
Does this mean we shouldn't cdr functional lists but only use rest?
Well one because rest is more specific, as above. Call it a style question. But two because cdr might destroy any information literally. Though I guess cdr couldn't turn a structure already determined to be a list into an improper list. I just wondered if it interfered with any caching.
See also this previous thread on the Racket list.
____________________
Racket Users list:
http://lists.racket-lang.org/users