chickadee » srfi-127 » lseq-rest

lseq-cdr lseqprocedure
lseq-rest lseqprocedure

These procedures are synonymous. They return an lseq with the contents of lseq except for the first element. The exact behavior is as follows:

  • If lseq is a pair whose cdr is a procedure, then the procedure is invoked with no arguments to produce an object obj.
    • If obj is an end-of-file object, then the cdr of lseq is set to the empty list, which is returned.
    • If obj is any other object, then a new pair is allocated whose car is obj and whose cdr is the cdr of lseq (i.e. the procedure). The cdr of lseq is set to the newly allocated pair, which is returned.
  • If lseq is a pair whose cdr is not a procedure, then the cdr is returned.
  • If lseq is not a pair, it is an error.

Implementations that inline cdr are advised to inline lseq-cdr if possible.