From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.bugs Subject: bug#72347: Mismatch between documentation and real implementation of list-index Date: Mon, 29 Jul 2024 12:28:00 +0200 Message-ID: References: <18A0D20D-B19C-44AF-8BE7-486CE2DF6844@disroot.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="E3OzkoWqjR5K6Z1S" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20211"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72347@debbugs.gnu.org To: Marius Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Jul 29 12:29:16 2024 Return-path: Envelope-to: guile-bugs@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 1sYNcx-00057l-8r for guile-bugs@m.gmane-mx.org; Mon, 29 Jul 2024 12:29:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYNcZ-0004TZ-TN; Mon, 29 Jul 2024 06:28:51 -0400 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 1sYNcX-0004TH-U2 for bug-guile@gnu.org; Mon, 29 Jul 2024 06:28:49 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYNcX-00038M-LG for bug-guile@gnu.org; Mon, 29 Jul 2024 06:28:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:MIME-Version:References:From:Date:To:Subject; bh=uIc8yl+T+YwKLIqTTpMHBebA/ZRHNNKsM38DDk1dlSo=; b=aR6a226Syk2sbnTQjlL7hePorAkkjIjfy2JaJPjtvXtMAjPx7j2aIMq6RoIwIWXc5tmG0dhbTEIYy/0Hkv0WQnSOFGX0I1cc1bnx/Z8G/wyn85sD3kIm382uwz9aFuqiqI0tDmI46pb2kk3ygriu5vP1s9VueKt5QmFbNCruUMiWiR2r744ixzBZkEaU9u5hsk7iVyUqG9yJspdpVWUHgG5HfDCZLuJztLKh/7xX3fL6ftrgH51t8v9vQalSuDtEfiEtav9JwjN2Lp/kyi+f+CuDNtY1pov311Mz5U5C+wz1oYqWdQZXZCw50xybRyiZelcturs4uouuDUospvC53w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sYNck-0007qL-2O for bug-guile@gnu.org; Mon, 29 Jul 2024 06:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 29 Jul 2024 10:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72347 X-GNU-PR-Package: guile Original-Received: via spool by 72347-submit@debbugs.gnu.org id=B72347.172224890730109 (code B ref 72347); Mon, 29 Jul 2024 10:29:02 +0000 Original-Received: (at 72347) by debbugs.gnu.org; 29 Jul 2024 10:28:27 +0000 Original-Received: from localhost ([127.0.0.1]:44929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sYNcB-0007pY-03 for submit@debbugs.gnu.org; Mon, 29 Jul 2024 06:28:27 -0400 Original-Received: from wolfsden.cz ([37.205.8.62]:53334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1sYNc5-0007pK-TO for 72347@debbugs.gnu.org; Mon, 29 Jul 2024 06:28:25 -0400 Original-Received: by wolfsden.cz (Postfix, from userid 104) id 872E32912A2; Mon, 29 Jul 2024 10:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1722248886; bh=ds96s3387XeLOuj1Fv3mA9y+iP7DgQkBZKoINIjoalA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=voZ1VcHsAfIk1DoiY/BZQhoWdYqOe/UBi1Soto9JgFecvBjVzJ/OwAEbIhX+k5Xjp vTyDz6/1mXUceB+O7GgUlJNsEuQmPNTqGyqtuNxFhwi3VJ7WtRQtl+s5i9tqVwjOuj qn+e5loxQk0frwybWrt8b4Q7aVTjxV018QcpY+7sCfLsdFX2+wJk8sG+PJQWQYxrpl Ct3NgaJq33kCipBuhMedD6qyaunRG0K6r4X1/mQJBOayQonuXa+zP/m0+xqnu48Lbm /yrqjj5Cdd7EInnJI765+NTq98WS+z+rbYffZwYEf1fyQLs1dDoyl9IvFADKTa9QRN Gnlfi380omoIsh7j1xT9uj5B3ocN7Z4sYPWIk/G2TV9168nKCazZkNSRNgKlO66o35 e84Lo/FNrxjgzcyx0dcztR4djIP0QaVZq76sjN+RC5AtQt3sWXoSXcJpmhhQyx7Bkt H30Vw1LV9wUDzROpi4jlbvC+jGSPN0h+YEdql4eWK+3q6PYdtAJKoDXPa1A+t4zb9G 9WD9ER27kUTD3GeqvL+tDErWKyGuOaNRekM3iql7OfKIT1Zj9HOkB3GBz7Tn6EnZHB JTR8BqNdlXMvKrJamSU821kGsWNw9DOSi/tdG9R5zsxan+6pQuMVffhC9ps5UG/Tti ZeFmFwGNE3C+h9uAjSgeiXjo= Original-Received: from localhost (unknown [193.32.127.135]) by wolfsden.cz (Postfix) with ESMTPSA id 57A0C291799; Mon, 29 Jul 2024 10:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1722248882; bh=ds96s3387XeLOuj1Fv3mA9y+iP7DgQkBZKoINIjoalA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Ms6Iu0CSSzArA3H1A4DUfniAsqsnMaUoVIlVDRiy6QBH50nt4+C7yRZ1aW5flULsF Wy+a/RbYAxjv5B1SYrvfHtL8gyyO/YIfiBF+Xr3Kt/KDPzFIDZWp8p6bR289lxqOAY kHw+tN0UcbwSmhOJkvdlUA1N1cFhjZJkCnNG11YzBr3Fu4bKxnaXi0T0opw3fZscGX eyAqU3VODGM+RcJPOfLvI5ExJwPEuwJV5EC0REzwfCFi90eyAxp6LUuVuIMEBFHTeP bDc0DKwbXurcBuR5oynRoFmFzDybIVPdGCRVi5yDacplejakpMH82ka7DwACssQ/rs FvYJ7LiIKFYvz29iUwo6/tk1Y5zM+DiFfAzPJQrNO14xV+rsrpb7aN6rLVlPOIO/RX 2dQsvIoFFGTyclGeNQ2CBni2yBMzBfq4wGAkPw/4yGFk13fZr9yoRS6EHQyMBKg2ej OUf5nhSExXQFssS9uID+SFZiltuiE5OEJGM0bTbcOR1wbey/xhWRun9ryDaZG1YBTl vnswI3rfmMq4QJ/+1ZP1julv06ASmjDWYaVkFpxGcd8oaOE3AAZ3fxJVAaN3GI6oOf yDGTftC/KuBhjiZtn21DLfgkQ07Vc1thvT2EZ20Ns4IAXy9HnAnMytGXhr5uhIFKGf 2K269NLIRJ0N5gTAp7FkTE/4= Content-Disposition: inline In-Reply-To: <18A0D20D-B19C-44AF-8BE7-486CE2DF6844@disroot.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10912 Archived-At: --E3OzkoWqjR5K6Z1S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, On 2024-07-29 00:34:14 +0000, Marius via Bug reports for GUILE, GNU's Ubiquitous Extension Language wrote: > Good evening, > > I don't know if this is actually a Guile bug or a documentation bug, but I'm currently learning Guile from the "Guile reference manual" and I've found a mismatch between what the documentation says and what "my" guile does. I use Guile 3.0.9. > > In my Guile instance (from what I can deduce), last-index is a procedure that returns the index of the first element of a list that matches with a s-expresion. > > For example: > > (list-index '(1 2 3) 3) -> 2 > (list-index '(height width) 'width) -> 1 > > But the documentation says otherwise (): > > list-index pred lst1 lst2 ... > > Returns the index of the first set of elements, one from each of lst1 lst2 ..., which satisfies pred. This is documentation for SRFI-1, and that is not available by default (at least not fully), you need to (use-modules) it. See below. > > > If I try to run list-index examples (from the documentation) I get an error because it doesn't know how to deal with a procedure as the first argument. > > > I'm missing something? I understand that list-index it's defined in SRFI-1 and maybe a Guile definition is shadowing the SRFI-1 definition. But where is the Guile documentation for this shadowing list-index? In the Guile Reference Manual list-index it's only described inside SRFI-1 module. It seems that Guile provides 2 different list-index procedures. One defined in the ice-9/boot-9.scm, and one in the srfi-1 module. By default the boot-9's one is available. $ guile -q GNU Guile 3.0.9 Copyright (C) 1995-2023 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> list-index $1 = # scheme@(guile-user)> ,use (srfi srfi-1) scheme@(guile-user)> list-index $2 = # Notice that by importing srfi-1 the list-index changes to the documented one. You are right that the "default" list-index indeed does not seem to be documented. It also uses `eq?' for comparisons and does not allow changing that. I hope this sheds some light on the problem. Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --E3OzkoWqjR5K6Z1S Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmanbrAACgkQL7/ufbZ/ wakj7RAAkiu1XLillP0+NAJQ4tBVUErWI/zTs9O1ohZ0fl4l8oQK8lRGWkSLeaSn PWnQFYfnFJpmbp/HCd+DE2bgxLWLm8gw0B6PtP9UUv9Vzx+j335inSIF3658SM7o 8KDxh3Wv1WhbQSDGanerOp5YqLoJ8owiOqXvQ3Fz6lNF2y7uvBt7EdL2FCzlVkID w6SoKOd6FdUwU2GgLHpvEoUy/C1rRBQlDm8lU8fk95KL/Y5r7X7eLWc10uscp1Qr mH6dMT12NhmrZurepyBkjmLPEI+rnuBupchbCzZV+MfwQbL1qdmIx8jlNa8fCgeT 0wMs8ebI2DoMgvwRngpyuLIeX5P6DjDoQJNPmvQtXcKA6sosY8cSZI/4/GiBfo5x 4rmUhUAvdCLOilWeLtZ20a82TcOhYJ1PBMRdtkfIPzsUfOJjkTHbUR42wC+ieRr5 oUAraJxpStXvLCewJ6+Sak+uMxLZ/sxzROMhGhiu/tgmBQ3rWCfK9zPCDnqNRVOW /E2458ip+mombAbHAzFPzI1zceX/sn2IP6lMnx/zqiIPLP+wGPgY6HadermJnr/y RbyYggKpdHviPfRuZ9Zy6kuMb4MRkaA8VsDRBrPk1cXgETBzsKZDG9UjZjaFE/hE nH6yYmX+JIsTjLjtk4rH6WVg2FJPeWeySnVh+rk3gWPM8kX/QMg= =Wj++ -----END PGP SIGNATURE----- --E3OzkoWqjR5K6Z1S--