View Source Document

env.robin

;'<<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
-->

### `env` ###

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

`env` evaluates to all the bindings in effect at the point of execution
where this form is encountered, as an alist.

    | (bind lookup-r
    |   (fexpr (args env)
    |     (bind self (eval env (head args))
    |       (bind target (eval env (head (tail args)))
    |         (bind items (eval env (head (tail (tail args))))
    |           (if (equal? items ()) ()
    |             (if (equal? (head (head items)) target) (tail (head items))
    |               (self self target (tail items))))))))
    |   (lookup-r lookup-r (literal symbol?) (env)))
    = (symbol?)

`env` expects no arguments.  Any arguments supplied will be simply ignored
and discarded, without being evaluated.

    | (bind lookup-r
    |   (fexpr (args env)
    |     (bind self (eval env (head args))
    |       (bind target (eval env (head (tail args)))
    |         (bind items (eval env (head (tail (tail args))))
    |           (if (equal? items ()) ()
    |             (if (equal? (head (head items)) target) (tail (head items))
    |               (self self target (tail items))))))))
    |   (lookup-r lookup-r (literal symbol?) (env (goofah whatever))))
    = (symbol?)

'<<SPEC'

(define env (fexpr (args env) env))