On Sun, Oct 26, 2008 at 11:16 AM, Björn Helgason <[EMAIL PROTECTED]> wrote:
> Another experiment
> We have two people Anna and Björn
> They tell the truth on following days
>
>   annas=.    'Monday';'Tuesday';'Wednesday';'Thursday'
>
>   bjorns=.'Sunday';'Monday';'Friday';'Saturday'
>
> Did you tell a lie yesterday?
>
> What day did they both answer yes?

days=:;:'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'
cool=: #&days  :.(days&e.)
warm=: days&e. :.(#&days)
annas=: cool 0 1 1 1 1 0 0
bjorns=:cool 1 1 0 0 0 1 1
admit=: (~: _1&|.)&.warm
   annas *.&.warm&(admit) bjorns
+------+
|Friday|
+------+

Note that my expressions for defining annas and bjorns look
different from yours but produce the same results.  You could
replace mine with yours, if you prefer.

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

Reply via email to