From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alex Sassmannshausen Newsgroups: gmane.lisp.guile.user Subject: Re: Lenses in Guile? Date: Tue, 18 Feb 2020 15:04:10 +0100 Message-ID: <87eeusng9x.fsf@gmail.com> References: <874kvq1syo.fsf@gnu.org> <50ca1e5e81fcd034f6ff19b4c51a7da5d1d5285e.camel@gnu.org> <87lfp2mitc.fsf@elephly.net> <874kvpd15f.fsf@gnu.org> Reply-To: alex.sassmannshausen@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="60914"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.2.0; emacs 26.3 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Feb 18 15:04:33 2020 Return-path: Envelope-to: guile-user@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 1j43UG-000Fh4-4w for guile-user@m.gmane-mx.org; Tue, 18 Feb 2020 15:04:32 +0100 Original-Received: from localhost ([::1]:35536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j43UF-00050Y-79 for guile-user@m.gmane-mx.org; Tue, 18 Feb 2020 09:04:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51882) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j43U2-0004yR-EW for guile-user@gnu.org; Tue, 18 Feb 2020 09:04:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j43U1-0008HZ-5V for guile-user@gnu.org; Tue, 18 Feb 2020 09:04:18 -0500 Original-Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:33438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j43U0-0008HC-VX for guile-user@gnu.org; Tue, 18 Feb 2020 09:04:17 -0500 Original-Received: by mail-wm1-x329.google.com with SMTP id m10so2285066wmc.0 for ; Tue, 18 Feb 2020 06:04:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:reply-to:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=nt2LUSOd8JnHv06+A0YfuxdPReT4+qX0P5oZZfZV+Fo=; b=tve7FqpV+Jv//gJCvfhzmSzEDX8FTRPHvZVRUHaun/iEU1utTP/Or9cTxOyoymL30G TrjbGIQmtgPD/wHBzXCu2vSXuPI1+syvyxnZBRyZK8qjEJ2OFShuXDfn8jFKCkCluwg6 YfLCPFaLnsf5F0fdWwzKKmQppZXZhMlpdiDSRP/3/EFyWe6aIMZ0+zDTIn+NkUNnKqUP zxZZgueipRHPs+KGqsSwxqstRTn/Nd8T30hZqHq1oNIxOTsCGslueP50rtktoqTh0Lin JGGKKwzy2rg8uDc5xY0wNUTnqiL89sLzlFGxQlQtmJ28DfIAxOgCLq5Fq4KkdfmtpqUk ubhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:reply-to :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=nt2LUSOd8JnHv06+A0YfuxdPReT4+qX0P5oZZfZV+Fo=; b=o1AoEKoJipr8fyucZHNoCvNNXB/at3EVZOnidDqobmQpsMIXYj+tw7n8cWt8sB6J+u uj4kXpibvIButRNnmGhx2fC+CXGVtpq7TQN3jxECtMJx/jVUSEeXopNqN21brKqol4bc +1yVS77+QRBuEvpgwSYXWy2ih97jByMyMKyog9040hoP4DUhkhH1rbiSx2JZhdsw6qLu IF4CXx+8Wz5jtR5wWRTrDstpAnlxwtR5PbcgB30OZATBVEZfJQWDjJIuYcJC4HynnE2D XYeZjLeeLTgy1K60LKyXbT4QTWYz0+QpDRDGl4rC21uelritDMM71lM9wRd70ixFc5eq krgA== X-Gm-Message-State: APjAAAXqc8xxdCcWSkYWHoQtjTGX8KCKXZI15kGRnbNNIysX5gFBOxIe rXL89/ptnnnwi1ftlgfK7awdkpdp X-Google-Smtp-Source: APXvYqwy3CXrrrLQSJ6DyDa+8Wxuwn03UNDijLoHknEeiMw5KHa5zrfpPcPBtytj2ww55djGXP8xqw== X-Received: by 2002:a1c:b7c4:: with SMTP id h187mr3519636wmf.105.1582034655227; Tue, 18 Feb 2020 06:04:15 -0800 (PST) Original-Received: from watership ([136.173.180.16]) by smtp.gmail.com with ESMTPSA id 18sm3639349wmf.1.2020.02.18.06.04.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 06:04:14 -0800 (PST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16207 Archived-At: Heya, Zelphir Kaltstahl writes: > Hi! > > This reminds me of something: Is there something like > https://docs.racket-lang.org/lens/index.html for Guile? Or perhaps an > easy to understand tutorial on implementing it? Check out https://gitlab.com/a-sassmannshausen/guile-lens It's an implementation I did for fun a while ago. Can't remember how faithfully it implements lenses as compared with racket's=E2=80=A6 Best wishes, Alex > > Regards, > Zelphir > > On 2/18/20 2:38 PM, Christopher Lam wrote: >> A bit late, and perhaps not as sophisticated as some bigger modules here. >> >> Two functions defined as follows: nested-alist-set! nested-alist-get at >> https://github.com/Gnucash/gnucash/blob/1f83cfaf64d1cd3c8862b427dd043154= f780a772/gnucash/report/html-chart.scm#L37 >> >> Consider a nested alist describing unix file system >> (define lst >> (list >> (cons 'usr (list >> (cons 'bin "binary files") >> (cons 'games "g4m3s") >> (cons 'include (list >> (cons 'guile (list >> (cons '2.2 "old"))) >> (cons 'linux "da best"))))))) >> >> We can access a leaf node via (nested-alist-get lst '(usr include linux)) >> --> "da best", and set a leaf node via (nested-alist-set! lst '(usr incl= ude >> python) "boo"). This is probably easy to seasoned schemers, but still a >> nice pair of functions to use in modifying nested alists before conversi= on >> into json. >> >> On Mon, 17 Feb 2020 at 09:16, Ludovic Court=C3=A8s wrote: >> >>> Hi! >>> >>> Ricardo Wurmus skribis: >>> >>>> What do you think about adding these things to >>>> https://notabug.org/cwebber/guile-webutils/ ? This was once intended = to >>>> be a collection of useful tools that come in handy when writing web >>>> applications. >>> I didn=E2=80=99t know about guile-webutils but consolidating Web tools = in this >>> package sounds like a great idea! >>> >>> Ludo=E2=80=99. >>> >>>