Look at BB.  You left a space.

Henry Rich

On 3/19/2017 12:27 AM, Linda A Alvord wrote:
Here's what I got without the spaces.
  ]BB=:4 4$'';'';'red';'';'';'tea';'';'';'';'';'';'Prince';'dog';'';' ';''
┌───┬───┬───┬──────┐
│   │   │red│      │
├───┼───┼───┼──────┤
│   │tea│   │      │
├───┼───┼───┼──────┤
│   │   │   │Prince│
├───┼───┼───┼──────┤
│dog│   │   │      │
└───┴───┴───┴──────┘
    cr3=:A,.BB
cr-:cr2
0
    cr-:cr3
0
    (>cr)-:>cr2
0
    (>cr)-:>>cr3
0
    (>>cr)-:>>cr2
1
    (>>cr)-:>>cr3
1

But:
(cr2)-:cr3
0
    (>cr2)-:>cr3
1
    (>>cr2)-:>>cr3
1
Linda
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of Henry Rich
Sent: Saturday, March 18, 2017 11:46 PM
To: [email protected]
Subject: Re: [Jprogramming] Who owns the zebra? with J

It did for me.

Henry Rich

On 3/18/2017 11:45 PM, Linda A Alvord wrote:
Henry, You got a different result than mine, but it doesn't match cr.

Linda

-----Original Message-----
From: Programming [mailto:[email protected]] On
Behalf Of Henry Rich
Sent: Saturday, March 18, 2017 12:26 PM
To: [email protected]
Subject: Re: [Jprogramming] Who owns the zebra? with J

Just change all your

''

to

''

(<' ') does not match (<'') .

Henry Rich

On 3/17/2017 9:33 PM, Linda A Alvord wrote:
After looking atg the rosetta code I tried the following:

    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│   │   │      ││
│└───────┴───┴───┴───┴──────┘│
└────────────────────────────┘

Linda

-----Original Message-----
From: Programming [mailto:[email protected]]
On Behalf Of 'Jon Hough' via Programming
Sent: Thursday, March 16, 2017 8:43 AM
To: Programming Forum
Subject: [Jprogramming] Who owns the zebra? with J

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
----------------------------------------------------------------------
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