From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0JZiBDFyimP28gAAbAwnHQ (envelope-from ) for ; Fri, 02 Dec 2022 22:46:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IORMBDFyimNtDQAA9RJhRA (envelope-from ) for ; Fri, 02 Dec 2022 22:46:25 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A6F83335E3 for ; Fri, 2 Dec 2022 22:46:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1Dqx-0003uv-E9; Fri, 02 Dec 2022 16:45:51 -0500 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 1p1Dqn-0003t8-Vn for guix-devel@gnu.org; Fri, 02 Dec 2022 16:45:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1Dqn-0005I3-IB; Fri, 02 Dec 2022 16:45:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=7zhybbeAQ3IME9LdDpRS7hBv8MRk4azazfSkfKOx48Q=; b=M0nYAb/Xt8R8aNs9FMnH wvG0LIPl4MoIM7Kci9O93elN2f82thevDx/g3vRkULZL0pB6SzyXR83N/afUpuWvfCHnXs163s492 W1gIMsCWLvdMIzi87jYhZBUxJGVcpAeJDhjCVb2vr6n5mjF/x1zLjuzbAn1MeHcPVyLLb8a6drHlu s3N/u3xlpuXylJlkRRd2TKOMwuH/fiQm0QfCQiVzi9HAGmpxPI886hiHDKaukNYr2QdqKKWzBLWFA DU3qGzGjjpclNh14shOwEt8N1OPfQAjrF+Om0H12Lx8qwnuYekEWza7MStrTEdX/ZU1FWrdW2J2YU PuFZ47y8lOwDeA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1Dqn-0006ep-4s; Fri, 02 Dec 2022 16:45:41 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Aleksandr Vityazev Cc: guix-devel@gnu.org Subject: Re: match-record References: <87o7sliqd0.fsf@posteo.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 12 Frimaire an 231 de la =?utf-8?Q?R=C3=A9volu?= =?utf-8?Q?tion=2C?= jour du Raifort X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 02 Dec 2022 22:45:32 +0100 In-Reply-To: <87o7sliqd0.fsf@posteo.org> (Aleksandr Vityazev's message of "Fri, 02 Dec 2022 18:59:23 +0000") Message-ID: <87v8mtpjib.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670017584; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=7zhybbeAQ3IME9LdDpRS7hBv8MRk4azazfSkfKOx48Q=; b=I3bIvr6aZ6YwsTClVNZS4AqMVuEmhkt4r71DQueLT4DFC2TFEwmNmhg9sK1AT0F/1Zzz+n GWFhzzCYOEoCRtH0g+R9hGp7xnZkp2IiKAmtgyG7OWMxunKnJKLrMwLieTces/V8Cn2lDM DGo5ISciA6HaFy6iM4yOWLID7+Po75i65FwsH9wKwnnWqnhE4ItMdMm9aKLZNQPu/avdG5 viWYd/fYX1/PHq7okIo0YzfcQPC9ZXhTvQhDxSH6ZDrE5m1itDWxgHlxhzEQFVgZ37Wga9 DAVgNRF8BQp+W76UDwRVMElsDSBFfc01FAhs/66FMW89bhJZ4BlKlQdxo+lSjA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670017584; a=rsa-sha256; cv=none; b=AU63lJIRmpvSHUNmy3XpPiCFy6TBMuc2/HHxSfCQUegYLei3NPVHGcD3BuzUgJKxjHMqKA Idvj1+NtOMMfChc1s9RKAxIjPbfiwZ8K8qJdXSyJaRrwrF3fI+M/gD1Z1g7nya+gVrkanb VFqLoezZcQ5rscA4psILEw3PGG8nwogIAKWlvhw2ewhPg2ZRI1RPQgJwkaReQh+CdxXoqp zB+Mgq7CE4wfW18b8CG7IWAWLYlR6xi2BwdCPmh2bbzeEYIi6wiR4KSKC2XTSpTxcFki/9 gX5et7kTMkmaGdlAlDP3Tp6+643FnYJXTY02bXT//tt6kg7keC9PfY4LKtmV+w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b="M0nYAb/X"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.17 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b="M0nYAb/X"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: A6F83335E3 X-Spam-Score: -5.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: nZgY65wUj5W3 Hi Aleksandr, Aleksandr Vityazev skribis: > Before cc9ee514e37f6ec74dd9cab91a13d51f7b8d47e7 commit the code below > worked: > > #+begin_src scheme :scheme guile :season guile > > (define (iwd-etc-service config) > (match-record config (config) > `(("iwd/main.conf" > ,(apply mixed-text-file > "main.conf" > (serialize-ini-config config)))))) > #+end_src > > > then this lead to an error: > Syntax error: > test.scm:109:44: lookup-field: unknown record type field in subform > config of (lookup-field config (+ 1 (+ 1 (+ 1 0))) ()) > > > If you fix the code to the following one, it will work.=20 > > #+begin_src scheme :scheme guile :season guile > > (define (iwd-etc-service cfg) > (match-record cfg (config) [...] > Should the code from the first block work, or should I not write it that > way? You have to write it that way. (Though I would recommend a different name for the field anyway, maybe =E2=80=98raw-file=E2=80=99?) This is due to how =E2=80=9Cliterals=E2=80=9D are matched in syntax-{case,r= ules} (info "(guile) Syntax Rules"): A literal matches an input expression if the input expression is an identifier with the same name as the literal, and both are unbound(1). Here, because of the =E2=80=98config=E2=80=99 parameter, one of the two ide= ntifiers was bound while the other is not, hence the match error. HTH! Ludo=E2=80=99.