[Jprogramming] Questions Advent of Code 2022 Day 5
Raul Miller
rauldmiller at gmail.com
Mon Dec 5 20:49:31 UTC 2022
Yes... we have diverged into a tangent.
Nevertheless, this makes it clear why you had difficulty splitting on
the blank line...
Thanks,
--
Raul
On Mon, Dec 5, 2022 at 3:41 PM 'Mike Day' via Programming
<programming at jsoftware.com> wrote:
>
> In my particular file, these two lines appear to be adjacent:
> 1 2 3 4 5 6 7 8 9
> move 3 from 2 to 5
>
> Sorry - this isn't of much interest for AOC as such!
>
> Mike
>
> Sent from my iPad
>
> > On 5 Dec 2022, at 20:15, Raul Miller <rauldmiller at gmail.com> wrote:
> >
> > It looks like the file transfer also is removing trailing spaces on
> > each line. Is it also removing the blank line?
> >
> > (It's difficult to tell from the index values you listed. But it seems
> > like either it must have removed the blank entirely or it must have
> > used some other characters to represent the blank line.)
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >> On Mon, Dec 5, 2022 at 1:52 PM 'Michael Day' via Programming
> >> <programming at jsoftware.com> wrote:
> >>
> >> Interesting. I hadn't spotted the double LF, which, as I now know,
> >> has its own moniker, LF2.
> >> I'd started looking at the puzzle on this laptop, then moved my
> >> proto-script and the datafile to
> >> the iPad as I was going out for a few hours.
> >>
> >> Ian Clark might note that, and will understand why, I found different
> >> positions for LF:
> >>
> >> on the Windows 11 laptop, J904 beta-g:
> >> I.LF = 350{.data
> >> 35 71 107 143 179 215 251 287 323 324 343
> >> (with the double LF at 323 324)
> >> and on the iPad (iOS 15.xxx) running Jios 903.1 release 52:
> >> I.LF = 350{.data
> >> 27 55 87 119 155 191 227 263 298 317 336
> >> (with no double LF)
> >> - which is possibly why I didn't spot it!
> >>
> >> However, this turns out to be an artefact of transferring data from
> >> laptop to iPad.
> >> I've just logged back in to day 5 for the purpose of this message, and
> >> downloaded
> >> the data from the aoc site to the tablet. It then duplicates the LF
> >> indexes as found
> >> on the laptop.
> >>
> >> Warning to self!
> >>
> >> BTW, my first nearly successful pass on the example gave MCD as the
> >> answer for part 1
> >> before I realised I needed to reverse the removed items as the
> >> CrateMover 9000 could only
> >> manage individual crates, so part 2 was trivial by comparison!
> >>
> >> Mike
> >>
> >>> On 05/12/2022 16:45, Raul Miller wrote:
> >>> To find the splitting point in the file, I used:
> >>>
> >>> split=. 2+I. LF2 E. y
> >>>
> >>> To handle the moves, converted the part after the split to a rank 2
> >>> array of characters (one row per line), defined
> >>> to=: ,
> >>> from=: ,
> >>>
> >>> And used:
> >>> ".parse sample
> >>> and
> >>> ".parse input
> >>>
> >>> This means that I had a (slightly) different 'move' verb for part 2
> >>> from what I had for part 1.
> >>>
> >>> FYI,
> >>>
> >>
> >> ----------------------------------------------------------------------
> >> 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
More information about the Programming
mailing list