From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Keeter Newsgroups: gmane.lisp.guile.user Subject: Re: Transient environment with standard functions Date: Sat, 11 Jun 2016 15:44:28 -0400 Message-ID: <291A5562-BF41-46D3-AE44-E2E779D0829F@gmail.com> References: <30B0B35B-F6B0-4FD4-A35D-3E6542C3871F@gmail.com> <7B7BC3F7-A25D-427D-8E21-D3583C3C7DEA@gmail.com> <87twh0wxzn.fsf@T420.taylan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1465674308 16104 80.91.229.3 (11 Jun 2016 19:45:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jun 2016 19:45:08 +0000 (UTC) Cc: guile-user@gnu.org To: Basa Centro Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jun 11 21:44:59 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bBoq2-0004yc-Rs for guile-user@m.gmane.org; Sat, 11 Jun 2016 21:44:59 +0200 Original-Received: from localhost ([::1]:48218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBoq1-0008Gw-W1 for guile-user@m.gmane.org; Sat, 11 Jun 2016 15:44:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBopf-0008Ge-Un for guile-user@gnu.org; Sat, 11 Jun 2016 15:44:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBopb-0002GR-Oy for guile-user@gnu.org; Sat, 11 Jun 2016 15:44:34 -0400 Original-Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]:33383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBopb-0002GN-Ht for guile-user@gnu.org; Sat, 11 Jun 2016 15:44:31 -0400 Original-Received: by mail-qk0-x229.google.com with SMTP id a186so1486861qkf.0 for ; Sat, 11 Jun 2016 12:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=8mjIPT1R2R90pouIehIVCEXVt+3ka1bY1h686wDYVbc=; b=c9p9qbNs/B39I2M6odiC9C6AFZAqbDi+0xWxlDdcAPPR51YrI46Cfct/5QBSV98zoN Glpt71MiECoCG01q/HDXpMVQKlnb4WhnVUUje5sLKtRxjJbVHR5mxivXdiOBE+lIM7O2 LVD82VH8dPUXX3NrbiLACc8EhF5FR9jV2XOhbf0tue64xWzBpXhv7hZQlScP3MqSDSFM qZYUyo5hu4R33ayrUs+qwfyuKCzJNpA2AqdvWDKhnRslL29YcElXU6GrvwW4umphKYKc yyLmQuqf9xwDD3pLraEMGJc//M7p6AMAZmwcMCT2cgFNnibI1dumiVPqHQduIf7ahCuT E5sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=8mjIPT1R2R90pouIehIVCEXVt+3ka1bY1h686wDYVbc=; b=a7B2EOyq3uObIn0zl9a60grU28QaVczuCpxarMRC06P2U59AAd298Ri/GRuIiJVVRf IHqKnsKTh1HzpcfAC+NYF6WlyaT5SGijCtLrc9qhLN7DE5qJFMHHeMkTueqAPRfaG1sR bOYg3Kvqe/aLa7WdTtdG6AvhvK+KH4JvSGNdFyKujl4nJ93je0CsUBHDaIqGvOd7m0fb VMh9iacjiADthyOo7cL6l3hR6b/S2d2+qfMzToNeshZ9nKhjtfIJorydS9SgY/vPHuZ7 PMpNfdr2Llr34Q07/07oFMK4RW3+NcoSC6YBLepDoFGL6AZWbnwxFQWYjycCx3Git71P eQ0w== X-Gm-Message-State: ALyK8tLMtYnsCf6PDgB24Paz3oCCnzSBbCe7qXivCHrz3liAHf0tsEGgZ/bHLxM8dudJYg== X-Received: by 10.55.104.213 with SMTP id d204mr7873384qkc.208.1465674270861; Sat, 11 Jun 2016 12:44:30 -0700 (PDT) Original-Received: from [192.168.1.2] (209-6-50-175.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com. [209.6.50.175]) by smtp.gmail.com with ESMTPSA id u131sm4691271qhc.30.2016.06.11.12.44.29 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Jun 2016 12:44:29 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.1878.6) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::229 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12628 Archived-At: Yes, the graph is equivalent to an s-expr (with subgraphs being nested = scopes). The reason that I=92m not just representing the graph as a single = expression is for efficiency =96 I=92m doing incremental updates and change tracking, so = you can update one of the node's expressions and have the changes propagate through the = graph with a minimum number of re-evaluations. A similar Python engine is documented here: http://www.mattkeeter.com/projects/graph/ Regards, Matt On Jun 11, 2016, at 11:15 AM, Basa Centro wrote: > It seems in essence you are building up a Scheme expression using the > graph and the code snippets and evaluating that expression. If this > is the case, do you even need to use a module system and/or to > explicitly create environments? Prima facie, it looks like you are > trying to reinvent the wheel. Is your graph really just equivalent to > an S-exp? >=20 > Scheme is lexically scoped, and creates a "transient environment" for > you through the use of lambdas. >=20 > Your use of thunks suggests that you are doing caching or lazy-eval. >=20 > I'm not sure this helps, but I hope so. When thinking about this > topic, I had this mental image of a GUI for building Scheme > expressions--like "Visual Scheme". :) >=20 > (Basa) >=20 > On 6/10/16, Matthew Keeter wrote: >> The specific use case is for dataflow graphs, where you=92re = evaluating a >> bunch of small >> snippets of code that can refer to each other by name. >>=20 >> I=92d like to make an environment in which the variables in the same = subgraph >> are >> exposed as no-argument thunks. >>=20 >> For example, let=92s say I have one subgraph that contains >> a =3D =9312=94 =3D> evaluates to 12 >> b =3D =93(+ 1 (a))=94 =3D> evaluates to 13, since the (a) thunk = evaluates to 12 >>=20 >> and another subgraph which contains >> x =3D =931=94 =3D> evaluates to 1 >> y =3D =93(* (x) 2)=94 =3D> evaluates to 2 >>=20 >> If I insert the thunks into (scheme-report-environment 5), they leak = from >> one graph >> to another =96 and to be fair, the docs to say that assigning into = this >> environment is >> undefined behavior. >>=20 >> However, if I make an empty environment with (null-environment), it = doesn=92t >> have >> useful functions like + and *; looks like (make-module) has the same = issue. >>=20 >> I'm sure that this is possible in Guile, but I got tired of reading = through >> the source >> files to hunt down undocumented function that do what I need [1]. >>=20 >> -Matt >>=20 >> [1] Another recent incident: How do you programmatically list all of = the >> variables in a module? >> You search the web, find = http://www.draketo.de/proj/guile-basics/#sec-3-2, >> see a a reference to >> module-map, which doesn=92t exist in the documentation, dig it up in = the >> source to see its >> arguments, etc=85 >>=20 >> On Jun 10, 2016, at 6:11 PM, Basa Centro = wrote: >>=20 >>>> First of all: is the "sandboxing" aspect of these environment = important? >>>=20 >>> Taylan, >>>=20 >>> Thanks, that's exactly what I meant by "motivation" in my first = reply. >>> (There was a recent, 6 months ago or so, thread on sandboxing in >>> guile-user by the way.) >>>=20 >>> Was Matt trying to prevent _access_ (inaccessible vs. read-only vs. >>> read/write) to data? Or was he trying to prevent only _visibility_ >>> (e.g. for hygeine)? >>>=20 >>> I think we need to know more about "what" and "why" to answer his >>> question, rather than just "how"--if that makes any sense. Does >>> Racket [1] even _really_ achieve what he needs to do (_prevent_ = access >>> for example)? We don't even know if we don't understand the >>> higher-level purpose. >>>=20 >>> (Basa) >>>=20 >>> [1] Disclaimer: I like Racket too--it is a great project. I just = hate >>> to see someone leave Guile because of a minor technicality. >>=20 >>=20