git @ Cat's Eye Technologies Robin / master stdlib / literal.robin
master

Tree @master (Download .tar.gz)

literal.robin @masterraw · history · blame

;'<<SPEC'

<!--
Copyright (c) 2012-2024, Chris Pressey, Cat's Eye Technologies.
This file is distributed under a 2-clause BSD license.  See LICENSES/ dir.
SPDX-License-Identifier: LicenseRef-BSD-2-Clause-X-Robin
-->

### `literal` ###

    -> Tests for functionality "Evaluate Robin Expression (with Small)"

One of the most basic identifiers available in `small` is `literal`,
which evaluates to the literal content of its sole argument, which can be
any S-expression.

    | (literal symbol)
    = symbol

    | (literal (hello (there) world))
    = (hello (there) world)

`literal` requires at least one argument; otherwise, an abort value will
be produced.

    | (literal)
    ? abort

Any arguments beyond the first argument are simply ignored and discarded.

    | (literal a b c)
    = a

`literal` is basically equivalent to Scheme's `quote`.

'<<SPEC'

(define literal (fexpr (args env) (head args)))