Thanks to Raul for having taken the time & effort to comment these
tasks and sharing his solutions.
AoC 2021, Day 01
"Warming up" (RM), I took a slightly different route;
doing a copy/paste from the website data window to a (Windows) .txt file.
With
dacr=: -. & CR NB. delete all CRs (from a string)
dalf=: -. & LF NB. delete all LFs (~~~)
daeb=: -. & a: NB. delete all empty boxes
abes =: ' ' ,~ ] NB. append blank (to end of string)
I handled data entry (conversion from file entry to list)
data_path_file=: 'X:\J_AoC\AoC_2021_01_x.txt' NB. small sample
data ... (one number per line)
fetch_data_from_file=: 13 : '". ,> abes each daeb dalf each dacr
each ;: 1!:1 < y' f.
fetch_data_from-file
[: ". [: , [: > [: (' ' ,~ ])&.> [: -.&a: [: -.&(10{a.)&.> [:
-.&(13{a.)&.> [: ;: [: 1!:1 <
and finally got hold of the file content as a list:
] data=. fetch_data_from_file data_path_file
199 200 208 210 200 207 240 269 260 263
Am now looking out for suggestions on how to tame the blown-up
monster fetch_data_from_file (possibly arriving at a simpler and/or
condensed version of that verb).
Thanks.
-M
At 2021-12-04 14:05, you wrote:
If nothing else, you can email yourself the text then copy and paste
from the email message into your J session, and wrap it in 0 :0 ... )
or {{)n ... }}
Depending on your email system, you might have to correct for
characters which have silently been changed in flight. (Typically,
anything that's not in the first 127 elements of a.)
I hope this helps,
--
Raul
On Sat, Dec 4, 2021 at 8:52 AM Brian Schott <[email protected]> wrote:
> How can iOS J be fed multi line aoc text data (ideally via copy/paste)?
> On Tue, Nov 30, 2021 at 6:44 PM Raul Miller <[email protected]> wrote:
> > For the people who like that kind of thing, December 1st hits in a few
> > hours.
> >
> > https://adventofcode.com/
> >
> > FYI,
> >
> > --
> > Raul
> > ----------------------------------------------------------------------
> >
> >
> ----------------------------------------------------------------------
> 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