View Source Document

prepend.robin

;'<<SPEC'

### `prepend` ###

    -> Tests for functionality "Evaluate core Robin Expression"

`prepend` evaluates both of its arguments, then evaluates to a list cell
which contains the first value as its data and the second value as the
continuation of the list.

    | (prepend () ())
    = (())

    | (prepend #t (prepend #f ()))
    = (#t #f)

The second argument to `prepend` must be a list.

    | (prepend #t #f)
    ? abort (expected-list #f)

The first argument to `prepend` can be any type, but fewer than or more than
two arguments will produce an abort value.

    | (prepend #t)
    ? abort (illegal-arguments (#t))

    | (prepend #f #t #f)
    ? abort (illegal-arguments (#f #t #f))

Attempting to prepend an `abort` value to a list will produce an
`abort` value.

    | (prepend (abort 999) (prepend #f ()))
    ? abort 999

    | (prepend #t (abort 999))
    ? abort 999

`prepend` is basically equivalent to Scheme's `cons`, except for the
requirement that the second argument be a list.

'<<SPEC'

(require prepend)