From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: design advice on predicate name Date: Sat, 19 Aug 2006 11:37:22 +0100 Message-ID: <87ejvdt3j1.fsf@ossau.uklinux.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155983910 8695 80.91.229.2 (19 Aug 2006 10:38:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 19 Aug 2006 10:38:30 +0000 (UTC) Cc: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Aug 19 12:38:28 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GEODi-00054F-9y for guile-user@m.gmane.org; Sat, 19 Aug 2006 12:38:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GEODh-0005z6-R4 for guile-user@m.gmane.org; Sat, 19 Aug 2006 06:38:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GEODd-0005yq-Ip for guile-user@gnu.org; Sat, 19 Aug 2006 06:38:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GEODc-0005ye-8s for guile-user@gnu.org; Sat, 19 Aug 2006 06:38:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GEODc-0005yb-1v for guile-user@gnu.org; Sat, 19 Aug 2006 06:38:20 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GEOKW-0002TD-NL for guile-user@gnu.org; Sat, 19 Aug 2006 06:45:28 -0400 Original-Received: from laruns (host86-129-125-104.range86-129.btcentralplus.com [86.129.125.104]) by mail3.uklinux.net (Postfix) with ESMTP id 04F1540A518; Sat, 19 Aug 2006 10:38:19 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 4B83E6FF91; Sat, 19 Aug 2006 11:37:22 +0100 (BST) Original-To: "Marco Maggi" In-Reply-To: (Marco Maggi's message of "Fri, 18 Aug 2006 21:01:54 +0200") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5461 Archived-At: "Marco Maggi" writes: > "Neil Jerram" wrote: >>"Marco Maggi" writes: >>> Example: I have two predicates HIT-NAN? and MAP-NAN? >>> which one it is better to call NAN? >> >>I'm afraid I don't understand. Perhaps you could write >>the down for the two possibilities that you have in mind. > > For a vector of real numbers like this [1 +nan.0 3]: > > * hit-nan? returns #t because at least one element > is nan; > > * map-nan? returns #(#f #t #f), one boolean for each > element; > > the same for matrices. map-nan? works like the 'isnan' > function of GNU Octave, which for the example vector > would return [0 1 0]. > > hit-nan? can be used in the conditional of IF and > COND, while map-nan? must be inspected. For this reason > I guess that hit-nan? should be the nan?, but, to the > best of my knowledge, GNU Octave defines only the map-nan? > equivalent so I do not know how useful can be hit-nan? > in practice. Thanks for explaining. My intuition is that the NAN? name should be used only for a procedure which takes a single number and reports whether it is NAN or not (as #t/#f). For your `hit-nan?' procedure I would use the name `contains-nan?' or `any-nan?'. But on the other hand, if `hit-nan?' is the name that first occurred to you, why not stick with it? For your `map-nan?' procedure I would use `map-nan?', as you have done. Is it a feature of Octave that any predicate can automatically map over a vector, or can `isnan' only be applied to a vector? Regards, Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user