?: Operator in APL+Win

General discussions on potential enhancements to the APL+Win system.

?: Operator in APL+Win

Postby Ajay Askoolum » September 17th, 2016, 5:13 am

In C#, this has the following syntax:

(condition) ? (return if true) : (return if false)

The nearest syntax in APL+Win is:

Code: Select all
      ⍬⍴(condition↓falseValue),truevalue


Works fine, as is; except that in C#, the argument following ? (or :) can be another ?: operator statement (which can also include another ?: operator, etc.)

Can APL+Win implement the ?: operator within the interpreter?
Ajay Askoolum
 
Posts: 632
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: ?: Operator in APL+Win

Postby Davin Church » September 17th, 2016, 7:02 pm

Ajay, what about "Inline Control Sequences" (ICS)? Won't that do just what you want?

From the documentation...
Code: Select all
The following list shows all recognized forms of ICS expression (for brevity the :OR form of each expression is not shown; wherever :AND appears it can be replaced by :OR):

( Cond  :THEN   Case1 :ELSE Case0 )
( Cond  :THEN   Case1 )
( Cond  :ELSE   Case0 )
( Cond1 :AND    Cond2 )
( Cond1 :AND    Cond2 ... :AND  CondN )
( Cond1 :AND    Cond2 ... :THEN Case1 :ELSE Case0 )
( Cond1 :AND    Cond2 ... :THEN Case1 )
( Cond1 :AND    Cond2 ... :ELSE Case0 )
( Index :CHOOSE Case1 : Case2 : ... : CaseN :ELSE Else )
( Index :CHOOSE Case1 : Case2 : ... : CaseN )
Davin Church
 
Posts: 388
Joined: February 24th, 2007, 1:46 am

Re: ?: Operator in APL+Win

Postby Ajay Askoolum » November 19th, 2016, 4:45 pm

I omitted to follow this; thanks Davin, ICS will do nicely.
Ajay Askoolum
 
Posts: 632
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom


Return to APL+Win Wish-List

Who is online

Users browsing this forum: No registered users and 1 guest