Skip to content

Commit

Permalink
crontab: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Feb 1, 2024
1 parent b8db53e commit 7049fd1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions extra/crontab/crontab.factor
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ TUPLE: cronentry minutes hours days months days-of-week command ;

<PRIVATE

:: parse-range ( from/f to/f quot: ( value -- value' ) seq -- from to )
from/f to/f
[ [ seq first ] quot if-empty ]
[ [ seq last ] quot if-empty ] bi* ; inline
:: parse-range ( from/f to/f quot: ( input -- value ) seq -- from to )
from/f [ seq first ] quot if-empty
to/f [ seq last ] quot if-empty ; inline

:: parse-value ( value quot: ( value -- value' ) seq -- value )
value {
:: parse-value ( input quot: ( input -- value ) seq -- value )
input {
{ [ dup "*" = ] [ drop seq ] }
{ [ CHAR: , over member? ] [
"," split [ quot seq parse-value ] map concat ] }
Expand Down

0 comments on commit 7049fd1

Please sign in to comment.