]> gitweb.factorcode.org Git - factor.git/commitdiff
fix holiday-names word
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 13 Nov 2009 20:59:48 +0000 (14:59 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 13 Nov 2009 20:59:48 +0000 (14:59 -0600)
extra/calendar/holidays/holidays.factor

index a50c709cf57747b79085bc53caa2a176fa2cac1c..0b8a1bb781d4e94cf7954014502f439f496182b7 100644 (file)
@@ -37,19 +37,19 @@ M: all holidays
 : holiday? ( timestamp/n singleton -- ? )
     [ holidays ] [ drop ] 2bi '[ _ same-day? ] any? ;
 
-: holiday-assoc ( timestamp/n singleton -- assoc )
-    [ >gmt midnight ] dip
-    [ dup (holidays) ] [ drop ] 2bi
-    '[ [ _ swap execute( ts -- ts' ) >gmt midnight ] keep ] { } map>assoc
-    rot '[ drop _ same-day? ] assoc-filter
-    values [ "holiday" word-prop at ] with map ;
+: holiday-assoc ( timestamp singleton -- assoc )
+    (holidays) swap
+    '[ [ _ swap execute( ts -- ts' ) >gmt midnight ] keep ] { } map>assoc ;
 
 : holiday-name ( singleton word -- string/f )
     "holiday" word-prop at ;
 
 : holiday-names ( timestamp/n singleton -- seq )
-    [ nip ] [ holiday-assoc ] 2bi
-    [ holiday-name ] with map ;
+    [
+        [ >gmt midnight ] dip
+        [ drop ] [ holiday-assoc ] 2bi swap
+        '[ drop _ same-day? ] assoc-filter values
+    ] keep '[ _ swap "holiday" word-prop at ] map ;
 
 HOLIDAY: armistice-day november 11 >>day ;
 HOLIDAY-NAME: armistice-day world "Armistice Day"