From 9d19fb939a1835aacd6d82d7dddc2fc54874f665 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 6 Feb 2018 20:53:49 -0800 Subject: [PATCH] calendar.holidays: simplify M\ all holidays. --- extra/calendar/holidays/holidays.factor | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extra/calendar/holidays/holidays.factor b/extra/calendar/holidays/holidays.factor index 273e2609a2..aa022ace65 100644 --- a/extra/calendar/holidays/holidays.factor +++ b/extra/calendar/holidays/holidays.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs calendar fry kernel locals parser -sequences vocabs words memoize ; +sequences vocabs words ; IN: calendar.holidays SINGLETONS: all world commonwealth-of-nations ; @@ -15,7 +15,10 @@ SYNTAX: HOLIDAY: parse-definition ( timestamp/n -- timestamp ) define-declared ; SYNTAX: HOLIDAY-NAME: - [let scan-word "holiday" word-prop :> holidays scan-word :> name scan-object :> value + [let + scan-word "holiday" word-prop :> holidays + scan-word :> name + scan-object :> value value name holidays set-at ] ; >> @@ -24,16 +27,14 @@ GENERIC: holidays ( n singleton -- seq ) -M: all holidays - drop - all-words [ "holiday" word-prop key? ] with filter ; +M: all holidays drop (holidays) ; : holiday? ( timestamp/n singleton -- ? ) [ holidays ] [ drop ] 2bi '[ _ same-day? ] any? ; -- 2.34.1