On Thu, 21 Sep 2006, Roger Hui wrote:

> v^:u
>

Beware of the fact that anything nonzero is "true",
so this (delightful!) idiom won't always be equivalent to
Pascal's  UpdateWhere:

NB. begin J session
NB.
   UpdateWhere=: 2 : 'if. u y do. v y else. y end.'
   (>&0 UpdateWhere *:)"0 i: 3
_3 _2 _1 0 1 4 9
   (* UpdateWhere *:)"0 i: 3
9 4 1 0 1 4 9
   (] UpdateWhere *:)"0 i: 3
9 4 1 0 1 4 9
   (*:^:(>&0))"0 i: 3
_3 _2 _1 0 1 4 9
   (*:^:*)"0 i: 3
0j1.73205 0j1.41421 0j1 0 1 4 9
   (*:^:])"0 i: 3
1.05988j0.439015 0.840896j0.840896 0j1 0 1 16 6561
NB.
NB. end J session

        Regards, Ewart Shaw
>
>
> ----- Original Message -----
> From: Pascal Jasmin <[EMAIL PROTECTED]>
> Date: Thursday, September 21, 2006 6:12 pm
> Subject: [Jprogramming] UpdateWhere conjunction
>
> > What would be a good definition for the following
> > conjunction, or a better way to achieve the same?
> >
> > UpdateWhere=: 2 : 'if. u y do. v y else. y end.'
> >
> > is there a tacit definition?
>...

J.E.H.Shaw   [Ewart Shaw]      [EMAIL PROTECTED]    TEL: +44 2476 523069
  Department of Statistics,  University of Warwick,  Coventry CV4 7AL,  UK
  http://www.warwick.ac.uk/statsdept            http://www.ewartshaw.co.uk
3  ((4&({*.(=+/))++/=3:)@([:,/0&,^:(i.3)@|:"2^:2))&.>@]^:([EMAIL PROTECTED])  
<#:3 6 2

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to