From owner-freebsd-questions@FreeBSD.ORG Tue May 20 14:44:04 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB8DA1065680 for ; Tue, 20 May 2008 14:44:04 +0000 (UTC) (envelope-from fbsd06+WD=b45b2392@mlists.homeunix.com) Received: from mxout-03.mxes.net (mxout-03.mxes.net [216.86.168.178]) by mx1.freebsd.org (Postfix) with ESMTP id 923D98FC28 for ; Tue, 20 May 2008 14:44:04 +0000 (UTC) (envelope-from fbsd06+WD=b45b2392@mlists.homeunix.com) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id 37E7923E3E7 for ; Tue, 20 May 2008 10:44:02 -0400 (EDT) Date: Tue, 20 May 2008 15:44:00 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20080520154400.115e8817@gumby.homeunix.com.> In-Reply-To: <200805201133.50963.jonathan@hst.org.za> References: <7d6fde3d0805190149y7a3bfa75j2ca6a67cef66e8f6@mail.gmail.com> <20080519094603.GC12033@osiris.chen.org.nz> <20080520014133.3447c282@gumby.homeunix.com.> <200805201133.50963.jonathan@hst.org.za> X-Mailer: Claws Mail 3.4.0 (GTK+ 2.12.9; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: Now what would you expect this to print out? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 May 2008 14:44:04 -0000 On Tue, 20 May 2008 11:33:50 +0200 Jonathan McKeown wrote: > On Tuesday 20 May 2008 02:41, RW wrote: > > On Mon, 19 May 2008 21:46:03 +1200 > > > > Jonathan Chen wrote: > > > find /usr/src \( -name Makefile -or -name '*.mk' \) -print > > > > Why does that make a difference, when print always evaluates to > > true? > > > > x AND true = x > > > > so > > > > (a OR b) AND true = a OR b > > a OR (b AND true) = a OR b > > It makes a difference (as in programming) because -print is used for > its side-effect rather than its value, and the binding order > influences when the side-effect happens. That's still a bit counter-intuitive because in normal programming languages the binding order modifies side-effects via the evaluation order. And in both cases the evaluation order would be expected to be left-to-right, with -print running last. I guess what you are saying is that the side-effect of print is based-on a Boolean "running-value". And without the brackets, the first test has been evaluated, but not yet ORed into that "running-value", by the time that print runs.