From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Neil Jerram" Newsgroups: gmane.lisp.guile.bugs Subject: Re: (< complex) and friends Date: Wed, 17 Sep 2008 23:37:24 +0200 Message-ID: <49dd78620809171437r739ec0cave11d0728165e6292@mail.gmail.com> References: <20080811210230.M31889@ccrma.Stanford.EDU> <49dd78620808120218k62cb690aq6251f427fc078a9b@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1221687462 27665 80.91.229.12 (17 Sep 2008 21:37:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Sep 2008 21:37:42 +0000 (UTC) Cc: bug-guile@gnu.org To: "Bill Schottstaedt" Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Sep 17 23:38:37 2008 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kg4jL-0007YS-7b for guile-bugs@m.gmane.org; Wed, 17 Sep 2008 23:38:35 +0200 Original-Received: from localhost ([127.0.0.1]:52744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kg4iK-0007hw-4T for guile-bugs@m.gmane.org; Wed, 17 Sep 2008 17:37:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kg4iF-0007hg-DO for bug-guile@gnu.org; Wed, 17 Sep 2008 17:37:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kg4iE-0007hI-20 for bug-guile@gnu.org; Wed, 17 Sep 2008 17:37:27 -0400 Original-Received: from [199.232.76.173] (port=38913 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kg4iD-0007hF-Sa for bug-guile@gnu.org; Wed, 17 Sep 2008 17:37:25 -0400 Original-Received: from rv-out-0708.google.com ([209.85.198.247]:20491) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kg4iD-00045t-B7 for bug-guile@gnu.org; Wed, 17 Sep 2008 17:37:25 -0400 Original-Received: by rv-out-0708.google.com with SMTP id k29so3773376rvb.6 for ; Wed, 17 Sep 2008 14:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=4k1tbCiOOGjPIVVEKQb9EiMGJ370pjHGYNVbW9k/QZ4=; b=p9NoXtRUrb4TWLjZFKTcArs1iwTgt4ilM55HOnveWy48Ai+7go12oy4skVhsY1N/1P wiVX2cRmPaYFooD8bZaIAcBUGpf6K3f+e8OpqvEMSc+txuaif58giEyiAm1qXxOC6Wwy HzcBwGU68gCavauJWxyhg5h6ATIA40qMKoowE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=VtbZwSMM8+OkyoXAdcBxPPseiqj21Y5X+6ikkssaQARR5jnOKTNw5wyt79c8mBYQWm lJNANyY9xRHLYN86+2jFup0CmTEUKroP5FVyta1jVCpbdTWPjdBClG+ct+d16ex/w7q4 1v56ZGXbLMXaQxJmG/fBpp1JUGirqRit//Ozo= Original-Received: by 10.141.198.2 with SMTP id a2mr6864508rvq.219.1221687444237; Wed, 17 Sep 2008 14:37:24 -0700 (PDT) Original-Received: by 10.140.142.15 with HTTP; Wed, 17 Sep 2008 14:37:24 -0700 (PDT) In-Reply-To: <49dd78620808120218k62cb690aq6251f427fc078a9b@mail.gmail.com> Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3996 Archived-At: This is mostly for the record, as I'm afraid I don't have any fix yet... 2008/8/12 Neil Jerram : > 2008/8/11 Bill Schottstaedt : >> guile> (< 1.0+1.0i) >> #t > My guess (without actually looking at the code) is that > - the single arg case is being optimized before reaching the check for > a complex number. My guess was correct. This comes from < being implemented as a scm_tc7_rpsubr, which means that there is an underlying C primitive (scm_less_p) that takes 2 args, and the evaluator deals with calling this however many times are needed. When there's just 1 arg, the evaluator shortcuts the process and returns #t. Instead of just returning #t, I guess there should be a type predicate call. It's not obvious where one would store the type predicate though, in the subr structure... As a workaround, you could use: (let ((libguile-< <)) (set! < (lambda args (or (null? args) (not (null? (cdr args))) (real? (car args)) (error "wrong type arg" (car args))) (apply libguile-< args)))) Would that help? Regards, Neil