NB. This is the ordinal fraction way of solving the Transylvanian problem.
NB. (My earlier solution had an error)

NB. First the table of explanations.
   NB. 0001 Minna is human

NB. 0002 Minna is vampire
NB. 0010 Minna is sane
NB. 0020 Minna is insane
NB. 0100 Lucy is human
NB. 0200 Lucy is vampire
NB. 1000 Lucy is sane
NB. 2000 Lucy is insane

NB. Next the conditions

NB. "one was a vampire and one was a human". 

NB. Discard 0101 and 0202


NB. Lucy says: "We are both insane"

NB. 1100. Lucy - a sane human - should tell the truth,
NB. but she didn't. Discard 1100.

NB. 1200. Lucy - a sane vampire - should lie, and she did.

NB. 2100. Lucy - an insane human - should lie,
NB. and so Minna is not insane too. Discard 2120.
NB. 2200. Lucy - an insane vampire - tells the truth
NB. and so Minna is not sane. Discard 2210.
NB. Minna says: "We are not both insane"

NB. 0011. Minna - a sane human - tells the truth
NB. that they are not both insane.

NB. 0012. Minna - a sane vampire - lies,
NB. so they are both insane 

NB. but Minna is not. So discard 0012.

NB. 0021. Minna - an insane human - lies,
NB. so they are both insane
NB. and so Lucy is not sane. Discard 1021.

NB. 0022. Minna - an insane vampire - tells the truth

NB. that they are not both insane.

NB. and so Lucy is not insane too. Discard 2022.

NB. The J code:

   f=.[:10&#.(]#"1~0<[)&((4$10)&#:)

   g=.]#~[:-.f=[f[            NB. Discard x from y
NB. list of initial possibilities
   a=.10#.>:(4$2)#:i.4^~2
NB. computation:
   2022 g 1021 g 0012 g 2210 g 2120 g 1100 g 0101 g 0202 g a
1211 2221
NB. The ordinal fraction difference between these two solutions is
NB. 1211 - 2221 = 0201
NB. So Lucy is vampire and Minna is human. 
/Bo, 

    Den 16:02 onsdag den 13. juni 2018 skrev Don Guinn <[email protected]>:
 

 Today the APL display is solved. But it wasn't when J first started.
Unicode was there but support was a mess. The keyboard is still a mess,
Dyalog keyboard works pretty well but conflicts with Windows keys. Looking
at all the glyphs in Dyalog is just as difficult to read as the J
primitives.

On Wed, Jun 13, 2018 at 7:52 AM, Raul Miller <[email protected]> wrote:

> Unicode standardizes the APL representation issue, and creates numerous
> other problems.
>
> It also does not solve the font problems, but that is solvable in many
> environments.
>
> But there’s also the keyboard problem, and it’s almost routine that there’s
> no consistent documented approach there.
>
> Thanks,
>
> —
> Raul
>
> On Tuesday, June 12, 2018, Devon McCormick <[email protected]> wrote:
>
> > I'd like to amend (extend) a previous post:
> >
> > To the best of my recollection APL could be written with EBCDIC so why J?
> > - EBCDIC, to the best of my recollection, supported extended character
> > sets, sometimes through the use of "code pages".  This severe,
> > vendor-specific, limitation of character representation ("since solved",
> > say some) was seen by Iverson and others as enough of a reason to try
> again
> > with a purely ASCII character set. This requires digraphs in order to
> have
> > sufficient tokens to specify a robust array-oriented computational
> > notation, which is what J is.
> >
> >
> > On Fri, May 25, 2018 at 6:07 PM, Jose Mario Quintana <
> > [email protected]> wrote:
> >
> > > My full reply is in the thread:  [Jchat] J, APL, or calendars?
> > >
> > > On Thu, May 24, 2018 at 12:48 AM, 'Bo Jacoby' via Chat <
> > [email protected]
> > > >
> > > wrote:
> > >
> > > > mr Jose Mario Quintana remarks that stopwaches and odometers are
> > 0-origin
> > > > devices. Today is the 24th day in the 5th month in the 2018th year.
> The
> > > > ordinal numbers begin at "first". But a stopwatch would show that
> 2017
> > > > years, 4 months and 23 days have passed. Cardinal numbers begin at
> > zero.
> > > A
> > > > J index shows how many array elements are skipped. This cardinal
> number
> > > is
> > > > confused with the ordinal number of the element. Centuries, decades,
> > > years,
> > > > months and days may be individually adressed by ordinal fractions.
> > > ORDINAL
> > > > FRACTIONS - the algebra of data. Thanks. Bo.
> > > >
> > > > |
> > > > |
> > > > |
> > > > |  |    |
> > > >
> > > >    |
> > > >
> > > >  |
> > > > |
> > > > |    |
> > > > ORDINAL FRACTIONS - the algebra of data
> > > >  This paper was submitted to the 10th World Computer Congress, IFIP
> > 1986
> > > > conference, but rejected by the referee....  |  |
> > > >
> > > >  |
> > > >
> > > >  |
> > > >
> > > >
> > > >
> > > >
> > > >    Den 1:12 torsdag den 24. maj 2018 skrev Jose Mario Quintana <
> > > > [email protected]>:
> > > >
> > > >
> > > >  Forgive me but I find the present situation funny because, taken
> > > > literally,
> > > > one should conclude that currently "It is not yet considered ready to
> > be
> > > > promoted as a complete task, for reasons that"  cannot be found.
> > > >
> > > > On Wed, May 23, 2018 at 6:48 PM, Raul Miller <[email protected]>
> > > > wrote:
> > > >
> > > > > Indeed: you could create that talk page, if you felt that that was
> a
> > > > > good thing. Or, I could. Or anyone else who has registered on that
> > > > > site could.
> > > > >
> > > > > Meanwhile, "draft" means "the task description might change if
> people
> > > > > find significant problems with the current description". That does
> > not
> > > > > seem likely to happen in this case, but it's not like I have never
> > > > > been wrong...
> > > > >
> > > > > Thanks,
> > > > >
> > > > > --
> > > > > Raul
> > > > >
> > > > >
> > > > > On Wed, May 23, 2018 at 6:11 PM, Jose Mario Quintana
> > > > > <[email protected]> wrote:
> > > > > >>  Speaking of which, we don't yet have a J entry for
> > > > > >> http://rosettacode.org/wiki/French_Republican_calendar
> > > > > >
> > > > > > There is a box on that page stating:
> > > > > >
> > > > > > French Republican calendar is a draft programming task. It is not
> > yet
> > > > > > considered ready to be promoted as a complete task, for reasons
> > that
> > > > > should
> > > > > > be found in its talk page.
> > > > > >
> > > > > > Hovering on "talk page" the following text pops up:
> > > > > >
> > > > > > Talk:French Republican calendar (page does not exist)
> > > > > >
> > > > > > :D
> > > > > >
> > > > >
> > > > >
> > > > ------------------------------------------------------------
> ----------
> > > > 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
> > >
> >
> >
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > ----------------------------------------------------------------------
> > 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