Raul, Rosetta code came back.
Is there a way to get from cr2 to cr ?
]ehs=: 5$a:
]cr=: (('English';'red') 0 3} ehs);<('Dane';'tea') 0 2}ehs
]cr=: cr, (('German';'Prince') 0 4}ehs);<('Swede';'dog') 0 1 }ehs
]A=: ;: 'English Dane German Swede'
┌───────┬────┬──────┬─────┐
│English│Dane│German│Swede│
└───────┴────┴──────┴─────┘
]B=:4 4$'';' ';'red';' ';' ';'tea';' ';'';'';' ';' ';'Prince';'dog';' ';'
';' '
┌───┬───┬───┬──────┐
│ │ │red│ │
├───┼───┼───┼──────┤
│ │tea│ │ │
├───┼───┼───┼──────┤
│ │ │ │Prince│
├───┼───┼───┼──────┤
│dog│ │ │ │
└───┴───┴───┴──────┘
cr2=:A,.B
]>cr-:cr2
0
(>cr)-:cr2
0
>cr
┌───────┬───┬───┬───┬──────┐
│English│ │ │red│ │
├───────┼───┼───┼───┼──────┤
│Dane │ │tea│ │ │
├───────┼───┼───┼───┼──────┤
│German │ │ │ │Prince│
├───────┼───┼───┼───┼──────┤
│Swede │dog│ │ │ │
└───────┴───┴───┴───┴──────┘
cr2
┌───────┬───┬───┬───┬──────┐
│English│ │ │red│ │
├───────┼───┼───┼───┼──────┤
│Dane │ │tea│ │ │
├───────┼───┼───┼───┼──────┤
│German │ │ │ │Prince│
├───────┼───┼───┼───┼──────┤
│Swede │dog│ │ │ │
└───────┴───┴───┴───┴──────┘
cr
┌────────────────┬─────────────┬──────────────────┬──────────────┐
│┌───────┬┬┬───┬┐│┌────┬┬───┬┬┐│┌──────┬┬┬┬──────┐│┌─────┬───┬┬┬┐│
││English│││red││││Dane││tea│││││German││││Prince│││Swede│dog│││││
│└───────┴┴┴───┴┘│└────┴┴───┴┴┘│└──────┴┴┴┴──────┘│└─────┴───┴┴┴┘│
└────────────────┴─────────────┴──────────────────┴──────────────┘
<cr2
┌────────────────────────────┐
│┌───────┬───┬───┬───┬──────┐│
││English│ │ │red│ ││
│├───────┼───┼───┼───┼──────┤│
││Dane │ │tea│ │ ││
│├───────┼───┼───┼───┼──────┤│
││German │ │ │ │Prince││
│├───────┼───┼───┼───┼──────┤│
││Swede │dog│ │ │ ││
│└───────┴───┴───┴───┴──────┘│
└────────────────────────────┘
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf
Of Raul Miller
Sent: Thursday, March 16, 2017 11:03 AM
To: Programming forum
Subject: Re: [Jprogramming] Who owns the zebra? with J
Rosettacode seems to be down right now, but...
https://web.archive.org/web/20161126092915/http://rosettacode.org/wiki/Zebra_puzzle#J
I hope this helps,
--
Raul
On Thu, Mar 16, 2017 at 8:42 AM, 'Jon Hough' via Programming
<[email protected]> wrote:
> I stumbled across this Stackoverflow question[0], based on an old puzzle, and
> I really liked some of the answers. And of course, I started thinking how to
> do it in J.
>
> Has anyone written a J solution to this problem?
>
> [0]
> http://stackoverflow.com/questions/318888/solving-who-owns-the-zebra-programmatically/42184547#42184547
>
> Regards,
> Jon
> ----------------------------------------------------------------------
> 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