From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.bugs Subject: bug#63196: Further on this error message Date: Sat, 6 May 2023 14:38:06 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9I2/Ouo9Wrml7WSG" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19993"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63196@debbugs.gnu.org To: Christopher Lam Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat May 06 14:39:31 2023 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 1pvHCE-00054L-Hk for guile-bugs@m.gmane-mx.org; Sat, 06 May 2023 14:39:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvHBp-0001oq-1R; Sat, 06 May 2023 08:39:05 -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 1pvHBm-0001oI-Mo for bug-guile@gnu.org; Sat, 06 May 2023 08:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pvHBm-0004LW-EH for bug-guile@gnu.org; Sat, 06 May 2023 08:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pvHBm-0006s3-AI for bug-guile@gnu.org; Sat, 06 May 2023 08:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 06 May 2023 12:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63196 X-GNU-PR-Package: guile Original-Received: via spool by 63196-submit@debbugs.gnu.org id=B63196.168337669226325 (code B ref 63196); Sat, 06 May 2023 12:39:02 +0000 Original-Received: (at 63196) by debbugs.gnu.org; 6 May 2023 12:38:12 +0000 Original-Received: from localhost ([127.0.0.1]:59602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvHAy-0006qX-7O for submit@debbugs.gnu.org; Sat, 06 May 2023 08:38:12 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:58158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvHAu-0006qJ-Ki for 63196@debbugs.gnu.org; Sat, 06 May 2023 08:38:10 -0400 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:Cc:To:Date:Sender:Reply-To: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=M91fPk+m6O8KwTOVLTRZqh7N6Kt66Pc0EcF9l9ylNvI=; b=uhvxof6gT+B9+pKtV03Z/JhgTm DIvZB5prpm+XdK4B7jC+k0TtwAPNPrF+t4XNGE0D7XDvxb1xOxKoVZQxn0/ltfu23fyTjtsNVKjMH 9EnU634tQQrzeKN0e4OM2nEAtTYO8j2N51AbV/WqaFqu87Y+xBMaV202JeHBJ/MNLpDJ5wiSuSqy3 jgBQzpYj7IR15iV2AKkFTZAXYw80lobEXkr4Akt7uHNghoth7pdEOWPKdN8Kf32d+KzJ31CniHAx0 IUtyZ2wcz5gu5aEaseJP6Hqg6Ksh0V02JaHmaPwtTIaciHX7KABx20JfrOKRuIZnzFBmJMnioy05X N43kjToA==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1pvHAs-0003iM-D4; Sat, 06 May 2023 14:38:06 +0200 Content-Disposition: inline In-Reply-To: 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:10615 Archived-At: --9I2/Ouo9Wrml7WSG Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 01, 2023 at 10:44:18AM +0800, Christopher Lam wrote: > The source seems to be sxpath.scm -- see "yikes" error which triggers when > n is -2 -4 -6 etc. I don't know how to build guile from sources and cannot > debug further. >=20 >=20 > (define (node-pos n) > (lambda (nodeset) > (cond > ((not (nodeset? nodeset)) '()) > ((null? nodeset) nodeset) > ((eqv? n 1) (list (car nodeset))) > ((negative? n) ((node-pos (+ n 1 (length nodeset))) nodeset)) > (else > (or (positive? n) (error "yikes!")) > ((node-pos (1- n)) (cdr nodeset)))))) Hm. It seems that calling `node-pos' with n =3D=3D 0 runs straight into the "yikes" case (unless `nodeset' is #f or null, that is). And we would get this when n =3D=3D-2 and (length nodeset) equals 1 on the next recursive call. Or when n =3D=3D -3 and (length nodeset) =3D=3D 2, and= so on -- i.e. when n =3D=3D -1 - (length nodeset). We reach such a point again when n =3D=3D 2*(-1 - (length nodeset)): it runs into the case (negative? n), retries with n' =3D (+ n 1 (length nodeset)) which is still negative, next try is 0 =3D> yikes. So in your case I guess your (length nodeset) is 1, because you have a cycle length of two :-) Reading between the lines in the code above for the positive case, I gather that the intention is to return an empty nodeset (i.e. '()) when n runs off the nodeset. So I'd extend the ((negative? n) ...) case like so: ((negative? n) (let ((nn (+ 1 (length nodeset)))) (if (positive? nn) (node-pos nn) '()))) Comments? Cheers --=20 t --9I2/Ouo9Wrml7WSG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZFZKJwAKCRAFyCz1etHa Rp4oAJ43XDJdQlBNqobJ3l7To7Khwk1hpgCeM5lc7Ilsnp7y5DT9OoEZPY8QevA= =jOMe -----END PGP SIGNATURE----- --9I2/Ouo9Wrml7WSG--