If you need help, try to find the answer through the following path: `Help` in the console ⇒ [Red by Example](https://www.red-by-example.org/) ⇒ [Official Red Docs](https://github.com/red/docs/blob/master/en/SUMMARY.adoc) ⇒ [Rebol Core Manual](http://www.rebol.com/docs/core23/rebolcore.html ⇒ [Red Wiki](https://github.com/red/red/wiki ⇒ Net search "redlang + your-question" ⇒ Ask us, we are here to help!
collect
should be followed by a block of some rule [rule]
. Is this correct? I'm asking this because you used collect some
, not collect [some
select
sees select singles cl-id + 1
, which is select (singles) (cl-id + 1)
.
>> parse ["[1518-02-24 " "[123-45-6 "][collect some [into [thru "[" keep to space skip]]]
== ["1518-02-24" "123-45-6"]
[
and
.
read
to import the input. Except that the input was not sorted. Had to use read/lines
to then sort
it. That's where the block took the place of the string.into
or mold
do the job.Now, one step ahead. The first expression is parsed correctly, but the following are not.
input-txt: ["[1518-02-24 23:58] Guard #853 begins shift" "[1518-02-25 00:20] falls asleep" "[1518-02-25 00:43] wakes up"]
digit: charset "0123456789"
shift-date: [thru "[" keep to space skip keep to "]" skip]
action: ["Guard #" copy guard keep some digit keep (7) thru {"} | "falls asleep" keep (load guard) keep (0) | "wakes up" keep (load guard) keep
(1)]
rule: [collect some collect [into [shift-date space action skip opt txt]]]
shifts: parse input-txt txt: rule
Added the txt:
before rule and added opt txt
to rule
but it's not working.
input: [
"[1518-02-24 23:58] Guard #853 begins shift"
"[1518-02-25 00:20] falls asleep"
"[1518-02-25 00:43] wakes up"
]
actions: [begins falls wakes]
forall input [
probe parse load input/1 [
collect [
into [keep pick to end]
[thru set ID keep issue! | keep (ID)]
set action skip keep (index? find actions action)
]
]
]