|
From: | Juergen Sauermann |
Subject: | Re: [Bug-apl] Short circuiting expressions like OR and AND |
Date: | Sat, 17 Sep 2016 18:28:31 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
Hi Ala'a APL has boolean operators ∧ for AND, ∨ for OR, ⍱ for NAND, ⍱ for NOR, ≠ for EITHER-OR, = for NOT-EITHER-OR, and so on (<, ≤, >, ≥, ...). For two boolean values A and B, there are 16 possible functions (some trivial) with a boolean result, and for most of them there is an APL function. If you want to execute one function only if another does not succeed (like || or in C++ then you can (ab-) use ⎕EA for that. Many APL programmers use compress (/) for selecting some of several values, e.g.: X←(Y<0)(Y=0)(Y>0) / 'Y negative' 'Y null' 'Y positive' /// Jürgen On 09/17/2016 03:48 PM, Ala'a Mohammad
wrote:
Hi, Some languages support short circuiting evaluation for example in Python known([word]) or known(edits1(word)) or known(edits2(word)) or [word] Returns the first part ( 'or' is the delimiter) that return a True (not False of which is the empty {}, others are None 0 "" () []) Do I need to use definition with goto/labels in APL? or How to express this in APL? Regards, Ala'a |
[Prev in Thread] | Current Thread | [Next in Thread] |