Hi Ala'a

the trick with ⎕EA is actually to return a value from a function only on success and no value
(instead of an empty value) if not.

'Z←bar B'  ⎕EA  'Z←foo B'    ⍝ ... ⎕EA 'Z←XYZ B' ...

If foo B returns no value then Z←
foo B fails and (only then) will bar B be performed.
As I said: "abuse ⎕EA".

I believe your function below can be simplified like this:

 words candidates word
  →(⍴words←known word)↓0
  →(⍴words←know edits1 word)↓0
  →(⍴words←know edits2 word)↓0
  words←⊂word
 
/// Jürgen


On 09/17/2016 08:02 PM, Ala'a Mohammad wrote:
Hi Jürgen,

Thanks for the pointer.

I understand that ⎕EA is a guard and so 'does not succeed' does not
include the 'empty set' or 'no result'. for example in Gnu APL
      '3' ⎕EA '0 0 0/ 1 2 3'

      '3' ⎕EA '0 1 0/ 1 2 3'
2

What I was thinking of is something that will return 3 in the first,
since ⍬≡0 0 0/ 1 2 3

Please correct me If I got something-or-all wrong.

The following is what I was trying to simplify
∇ words candidates word
  words ← known word
  (0<⍴words)/exit
  words ← know edits1 word
  (0<⍴words)/exit
  words ← know edits2 word
  (0<⍴words)/exit
  words ← ⊂word
exit:

Regards,

Ala'a


Reply via email to