Having sent this, I went back to the script for day 13.
Resorting to APL (Dyalog version), I wrote a direct definition function
to replace the [ ] & , symbols appropriately, and evaluate the results as
APL expressions. Each of the 8 example pairs sorted correctly - ie
"wrongly"
or "rightly" consistently with the stated requirements!
So, having spent days puzzling over this in December, this approach
yielded the correct results in an hour or so!
You need to put something inside the brackets if there's nothing there, eg
[] becomes [''] which, with suitable symbol changes can be evaluated.
I see Raul mentions recursion, which is what had blown my mind when I
considered it for day 13; however, this evening's effort needed no
explicit
recursion. The APL interpreter might perhaps have used recursion in its
evaluation, but that would be hidden under the bonnet/hood.
Cheers,
Mike
On 02/02/2023 21:19, 'Michael Day' via Programming wrote:
Day 13 was one of my dead-ends. Couldn't get my head round it!
I did try ordering, though I forget how, and didn't get the approach
to work.
anyway!
I thought I could understand day 14 quite well, but couldn't see
what was wrong with my code!
Have at last finished the rest. Day 25 was traditionally (?) easy;
day 24 took
me ages to find a nice model.
Really "Chat" again - sorry!
Cheers,
Mike
On 30/01/2023 18:08, Brian Schott wrote:
Raul,
Yes, your example and its explanation are correct.
I'll rethink this approach, perhaps as you suggested.
----------------------------------------------------------------------
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