That sounds sort of neat, but I cannot think of a non-contrived case
where this would be useful.

-- 
Raul



On Thu, Mar 2, 2017 at 2:29 AM, 'Pascal Jasmin' via Programming
<[email protected]> wrote:
> The difference with the fcase. example at
> http://www.jsoftware.com/help/dictionary/csel.htm
>
> is the "case 2;3" line below pcase.  where the fcase. example that line is 
> "case 3"
>
> fcase triggers "2 conditions", but the 2nd is triggered automatically even 
> though the input doesn't match that conditions' test.
>
> pcase.  would require that the input match a subsequent condition to be 
> further triggered.
>
> an example of the basic case statement
>
>
> 3 : 'select. y case. 1;2 do. 11 case. 2;3 do. 12 end.' 2
> 11
> 3 : 'select. y fcase. 1;2 do. 11 case. 3 do. 12 end.' 2
> 12
>
> only the first condition gets triggered with case.  with fcase.  the 2nd non 
> matching condition gets returned, though first has chance to impose side 
> effects.  With pcase. the 2nd condition would get returned only if it also 
> matched the input.
>
>
>
>
> ----- Original Message -----
> From: Henry Rich <[email protected]>
> To: [email protected]
> Sent: Wednesday, March 1, 2017 10:44 PM
> Subject: Re: [Jprogramming] fcase.
>
> ?
>
> change your pcase. to fcase.; doesn't it do what you say?  Is there
> something your proposed idea would do that the current syntax doesn't do?
>
> Henry Rich
>
> On 3/1/2017 10:14 PM, 'Pascal Jasmin' via Programming wrote:
>> Do not see the usefulness of the fcase. option.  see example here:
>> http://www.jsoftware.com/help/dictionary/csel.htm
>>
>>
>> I would see a "passthrough case" pcase. usefulness
>>
>> f2=: 3 : 0
>> t=. ''
>> select. y
>> case.  1 do. t=.t,'one '
>> pcase. 2 do. t=.t,'two '
>> case.  2;3 do. t=.t,'three '
>> case. 2;3;4 do. t=.t,'four '
>> end.
>> )
>>
>> f2 2
>> two three
>>
>> a pcase. statement would not abort search after a match.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to