Hello again
I managed to solve it, but I don't like it much, so feel free to educate me.

Reading the file, and evaluating the result is something that looked nice:

p =. 1!:1<'day02.input'

+/>ev each cutopen p

xxxx

+/>ev2 each cutopen p

xxxx

Now are the evaluating functions. I really don't like how they are done.
I'd even prefer to create a table and search in it, but I don't know how.
So a select. is used.


ev=: 3 : 0

select. y

case. 'A X' do.

4

case. 'A Y' do.

8

case. 'A Z' do.

3

case. 'B X' do.

1

case. 'B Y' do.

5

case. 'B Z' do.

9

case. 'C X' do.

7

case. 'C Y' do.

2

case. 'C Z' do.

6

end.

)


And the same with different numbers for ev2.

Would this be an appropriate way to approach the problem? Is there a
"better" way?


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

Reply via email to