From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Lisp Live buffer Date: Wed, 28 Dec 2022 10:25:24 +0100 Message-ID: References: <87sfhsczaa.fsf@dataswamp.org> <8A1A0B61-1853-4EEE-AB2E-A5975D8B8241@gnu.support> <87lenjq35z.fsf@dataswamp.org> <87bknpgbdn.fsf@dataswamp.org> <87wn6dejjb.fsf@dataswamp.org> <878rismkp7.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CMkuQTIYRD7Og6WC" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32301"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 28 10:26:10 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pAShO-0008C7-8E for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 28 Dec 2022 10:26:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pASgm-0001HA-50; Wed, 28 Dec 2022 04:25:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pASgk-0001Gj-4H for help-gnu-emacs@gnu.org; Wed, 28 Dec 2022 04:25:30 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pASgi-0003Ec-DZ for help-gnu-emacs@gnu.org; Wed, 28 Dec 2022 04:25:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=IRJVVsvjTisE3ZGZjzNld70m92AmMWr6b2ZAPOf123Y=; b=vHJuc/J2TI2YZW1XweNO4M/Cfi Uda6XP7OdnbRH5jPExt+GiB83k39UqipF+Hl6d1fYX4Be5K5YzOUt9QCNWjjogYONJbRzGMJAdUQ5 wSwOhtgARkUyuzKyi4DsuUJFXrfZMzZsm2/r79VvaB4+Og5kzXUrYOIUyavPC4ZAcYGNpokAtKGxi lLGOTVeHcLLS2L72a6e7gxsT3lsXpffqgbhuqbLc7BZVI4HzvGEI1FUWditngR/jDnyhOjgrs7SQG E47fSCg4TkmJktLacZAaSWACnUbYu2dRSIIGJTZ867BE5AqvviBf7YknrgjKHkrQy7dOljgb7/oDF IHcONV7Q==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1pASge-0003AS-GZ for help-gnu-emacs@gnu.org; Wed, 28 Dec 2022 10:25:24 +0100 Content-Disposition: inline In-Reply-To: <878rismkp7.fsf@dataswamp.org> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URI_DOTEDU=0.949 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141991 Archived-At: --CMkuQTIYRD7Og6WC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 28, 2022 at 01:32:52AM +0100, Emanuel Berg wrote: > Why doesn't this work? >=20 > For sure, there is a mistake somewhere but it seems now matter how > I change it I get the same result ... >=20 > ;;; -*- lexical-binding: t -*- > ;; > ;; this file: > ;; https://dataswamp.org/~incal/emacs-init/mvc/model.el >=20 > (require 'cl-lib) >=20 > (defun make-world (dim len &optional init) > (or init (setq init ".")) > (if (zerop dim) > init > (make-list len (make-world (1- dim) len init)) )) Heh. When you are making a higher-order world, you are storing a ref to the same list in each of its slots. So if you change something at a lower level *poof* all are changed. Read the subsection "samenes and change" in 3.1 of SICP [1] for a beautiful treatment (actually, re-read SICP: a beautiful book) Oh, I nearly forgot: if you want it to work, you'll have to regenerate the lower-level worlds (or deep copy them). Cheers [1] https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0= /6515/sicp.zip/full-text/book/book-Z-H-20.html (Sorry: fragment links seem to be disfunctional) --=20 t --CMkuQTIYRD7Og6WC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCY6wLfgAKCRAFyCz1etHa RtS4AJ91ZQzXO4U+pYGDlW+qUi0nEv7a0wCfZj30FnqHoCVsA8Lxdp7F8H4zlXY= =j/Hn -----END PGP SIGNATURE----- --CMkuQTIYRD7Og6WC--