From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id KKXADWQCyWUsbAEAqHPOHw:P1 (envelope-from ) for ; Sun, 11 Feb 2024 18:22:44 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id KKXADWQCyWUsbAEAqHPOHw (envelope-from ) for ; Sun, 11 Feb 2024 18:22:44 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HcsfZT4P; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707672164; 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=wRUaaiFbwV/M2qffpX3gktqQw2MdbGPynLbZOiWScVA=; b=AXuZcwsFAfY5c23czQER1KC8hQExUwsnzv4/Q20bdY1GypuoaMAWtfFph8ugnjhtna/IR+ 6qxsJ6s9dHFemVtKdDwnyuz7KCsGJieASY864pgpHw1jia1BYUiZh7t/U+I2tm+ChKSvNW VT/uDb/iBEB7bO7GCT2WDhTA4YiYmj+u744mcZsV7rIsv++uNLyjuY70P+j4+isBaXi/vo mRKN70Ae6+fPRqlBXKWaYUE2TmG7eue/VwMHtXdAIp1rY+sVe9dRkBprnK0xwYDZQXmIKQ dxVoV8qJC6IaB0RRGfv9/XqE2SnAsIpNzqiiTHyzyOxyCx0pheMPKBItEHJsGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HcsfZT4P; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707672164; a=rsa-sha256; cv=none; b=HDu9gBzAzfDojhQUhtrO5Gk6rl19SK3pXOAJ3/oXi/aypTdJBD/Dqlwie14I6njiON/1Zb TpE9FyvlfcD/HXrPNDgkshPC7vsS+slPSCnvlLkXaq9t/YpfLN6Ypj/2dvYqur9pzFydyZ 4dp7rylrCJEbcmCPmQJt3McecWrDMNG6tSYmIojH2a1oE6SbGMLV7T9+Q+c76XjLqZBM+K aeAgbf0OsJyaWQ8zcfKFwVBUAZa3kqS1+9MkY+Wsarlnc14xWGztXaIgZoFUzAoYUTxEMP T8TvEHwa6nDNbcemuUxnvN0YD7P76uPKH5GOnJZgXJVl2Bb9EW8BEyQn0gGZsQ== 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 E8F4B52475 for ; Sun, 11 Feb 2024 18:22:43 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZDWZ-0000Xu-HM; Sun, 11 Feb 2024 12:21: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 1rZDWQ-0000Wg-Ve for guix-devel@gnu.org; Sun, 11 Feb 2024 12:21:44 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZDWM-0003ov-7o; Sun, 11 Feb 2024 12:21:40 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-410826218a7so1319335e9.1; Sun, 11 Feb 2024 09:21:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707672095; x=1708276895; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wRUaaiFbwV/M2qffpX3gktqQw2MdbGPynLbZOiWScVA=; b=HcsfZT4PQADbiPViEexAiYlnWawGMK6P0ocw0j1Tf+/U8ZaiJ2za2t+khnaxpc9xdf UdSbD3PqwgudoIHHaSU25L3+BX/R0uQjyQkqD5VGPFYjOrJbBnONiDGkqFaGXn3780Tb BKkDj48Lxbl/y1rGzyCVpWX+CO1/pOzPlnV7qRK51uqnGZ0Y+36P8MvuqF8lansCdf/o MM1GMcU2F9qAmAIxdCMwlEpx+pFtGLdlYFBVC9txEXqEKH4AnGg3BEEyHmOYrwNd4wYb lhIc1E8WVOP9XXGioAx66jSnibJqsyQqUdNo+GLbi9/hJcCtYb2k9nBigaaHMAi3MxFT c2TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707672095; x=1708276895; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wRUaaiFbwV/M2qffpX3gktqQw2MdbGPynLbZOiWScVA=; b=nISMDzOKxRMA3/wWJbdjfShYU3hofCR3iG7DZalXGhyAQve9VHwVdl3VGtIF7yruGn i0LHY/PI2WtbvpJjyizsCrfR+LLBYMy+g6rO36T3YUEFO9wsFm9hkWEzleqB+69HIq4H ok8lCpHjmnCWV8HS6jd27q3x7sgdabGsaa+oBppfuq6a135nxz7sHEjq4FNj7X9yFI4C FPKyxNQtjI/IplU4OQarI0xHn5CwvaJVH+5kpYy3AIPQRnUin5tnrDcgYSkugOi+U1K0 VUfEXwFlQpT/mFYeCWMYbGbzABU6SB7t5uE2AGLlTt27JaopO515sKPKszo2waO//ZIP HiyA== X-Forwarded-Encrypted: i=1; AJvYcCUwWIeF7cTjtsPWYOPaNPHLrCni/sbQUhSsAoUyDhwhmrpgJpIaUTfVvukZz1nVEyCAf08/RGKmWAM4v4E= X-Gm-Message-State: AOJu0YxdVYAbtFlEKB+pHfHiNNgjG+RAz5yIHfRQoVpzHE7Gsvof1X2+ pRdb1zXs2YeiEfY8oSBqtYvM+6qKr4i0+h3VavwcVE4kFmNG+aB5nuyLBB+G X-Google-Smtp-Source: AGHT+IHwCuBCj0x6QUZc222kAjxEv4fIny47k5JA9LeC4BraxVUe0/c0TIk7KEfwZJDLiGRXrKSACg== X-Received: by 2002:a05:6000:68a:b0:33b:2309:63e6 with SMTP id bo10-20020a056000068a00b0033b230963e6mr4413085wrb.5.1707672094683; Sun, 11 Feb 2024 09:21:34 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWl8nJTomN3VHsf2cwC8yT0BaPG0Onhr94ZgkJoP9jFfIICtUCdVQIIY8iCp57/1NfMYY2gYNdplVR1Tkw= Received: from lili ([2a01:e0a:59b:9120:bebc:44ea:80f6:f7e5]) by smtp.gmail.com with ESMTPSA id i13-20020adffc0d000000b0033b63a0bd0dsm4672476wrr.109.2024.02.11.09.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 09:21:34 -0800 (PST) From: Simon Tournier To: Carlo Zancanaro Cc: Guix Devel , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: ice-9 match penalty depending on pattern? In-Reply-To: <87il31upn1.fsf@zancanaro.id.au> References: <87wmrh6zwl.fsf@gmail.com> <87il31upn1.fsf@zancanaro.id.au> Date: Wed, 07 Feb 2024 10:22:03 +0100 Message-ID: <87h6ikvdc4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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 X-Migadu-Spam-Score: -7.52 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -7.52 X-Migadu-Queue-Id: E8F4B52475 X-TUID: 6JlgsSID6PSZ Hi, On mer., 07 f=C3=A9vr. 2024 at 10:41, Carlo Zancanaro wrote: >> Why not? Do I miss something in the implementation of =E2=80=99match=E2= =80=99? > > The only reason I can think of would be if these matches are sometimes > provided improper lists, which need to fail these match conditions. That > seems unlikely to me, but it should be clear from looking at the other > match clauses in each case. Well, I have not pruned the list returned by just grepping. :-) And I have just grepped with the term =E2=80=99head=E2=80=99, =E2=80=99tail=E2=80= =99 and =E2=80=99\.\.\.=E2=80=99 Somehow, my question is twofold: 1. Is the =E2=80=9Cexpensive=E2=80=9D check worth for such case: (match paths ((head tail ...) (if (visited? head) (loop tail visited result) (call-with-values (lambda () (loop (references store head) (visit head) result)) (lambda (visited result) (loop tail visited (cons head result)))))) (() (values visited result))))) seen in =E2=80=99topologically-sorted=E2=80=99 procedure from (guix store) = module. 2. Is the =E2=80=9Cexpensive=E2=80=9D check worth for such multi-cases: (match sexp ((? string? str) (let ((prefix "swh:1:dir:")) (if (string-prefix? prefix str) (cons (string-drop str (string-length prefix)) ids) ids))) ((head tail ...) (loop tail (loop head ids))) (_ ids)) =20=20=20=20=20=20=20=20 seen in =E2=80=99lookup-disarchive-spec=E2=80=99 from (guix lint). Well, I am not saying to rely on =E2=80=99car=E2=80=99 and =E2=80=99cdr=E2= =80=99. Instead, I am asking what is the idiomatic Guile pattern matching for Guile? My main concern is about chasing the unnecessary checks for making Guix a bit faster. :-) Cheers, simon