From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49704 invoked by alias); 15 Sep 2017 14:55:17 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 49276 invoked by uid 89); 15 Sep 2017 14:55:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 14:55:15 +0000 Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1dss1P-00045t-Q6; Fri, 15 Sep 2017 16:55:11 +0200 Received: from 70-36-239-177.dsl.dynamic.fusionbroadband.com ([70.36.239.177] helo=localhost.localdomain) by mailfront11.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1dss1D-00081b-KP; Fri, 15 Sep 2017 16:54:59 +0200 Subject: Re: putting symbols into Environment To: Sonny To , Kawa mailing list References: <7ebc09b0-2243-a1c0-4da2-d4f0fb73827e@bothner.com> From: Per Bothner Message-ID: Date: Fri, 15 Sep 2017 14:55:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00044.txt.bz2 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/