public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Sonny To <son.c.to@gmail.com>, Kawa mailing list <kawa@sourceware.org>
Subject: Re: putting symbols into Environment
Date: Fri, 15 Sep 2017 14:55:00 -0000	[thread overview]
Message-ID: <a5fe8977-e310-69f0-92a0-af61fd532c15@bothner.com> (raw)
In-Reply-To: <CAJxjsJvvPmORvtcPLn1XQ65A27Nx-mTy07vGfoQDp67Er_QFhw@mail.gmail.com>

On 09/15/2017 05:48 AM, Sonny To wrote:
> How close does kawa stick to standard scheme? I'm trying these
> functions described here
> https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Environment-Operations.html
> and none of work

That page is for MIT Scheme - a specific Scheme implementation/dialect,
not "standard Scheme".

> #|kawa:5|# (define e (environment))
> #|kawa:6|# (environment-bindings e)
> /dev/stdin:6:2: unbound location: environment-bindings

The Git version of Kawa (and soon Kawa 3.0) includes environment-fold

-- Procedure: (environment-fold environment proc init)
      Call PROC for each key in the ENVIRONMENT, which may be any
      argument to ‘eval’, such as ‘(interaction-environment)’ or a call
      to the ‘environment’ procedure.  The PROC is called with two
      arguments: The binding’s key, and an accumulator value.  The INIT
      is the initial accumulator value; the result returned by PROC is
      used for subsequent accumulator values.  The value returned by
      ‘environment-fold’ is the final acumulator value.

      A key is normally a symbol, but can also be a ‘KeyPair’ object (a
      pair of a symbol and a property symbol used to implement Common
      Lisp-style property lists).
           (environment-fold (environment '(scheme write)) cons '())
             ⇒ (display write-shared write write-simple)
      To get all the predefined bindings use
          (environment '(kawa base))


-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

  reply	other threads:[~2017-09-15 14:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  0:05 Sonny To
2017-09-14  0:28 ` Per Bothner
     [not found]   ` <CAJxjsJv-_yabJvr7PkxyqKS+b7bQ2RoL40ORsfJG5vmRv0KAWA@mail.gmail.com>
2017-09-15 12:48     ` Sonny To
2017-09-15 14:55       ` Per Bothner [this message]
2017-09-15 13:48     ` Sonny To

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5fe8977-e310-69f0-92a0-af61fd532c15@bothner.com \
    --to=per@bothner.com \
    --cc=kawa@sourceware.org \
    --cc=son.c.to@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).