]> gitweb.factorcode.org Git - factor.git/commitdiff
remove memoized words from calendar. more docs
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 1 Sep 2008 16:43:57 +0000 (11:43 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 1 Sep 2008 16:43:57 +0000 (11:43 -0500)
basis/calendar/calendar-docs.factor
basis/calendar/calendar.factor

index 8ee104d16e0c6e0b36854d33e52e99b7282dfc59..64e3e1e004a272f087fc0f912fb3bbd4d9e9076a 100644 (file)
@@ -278,8 +278,6 @@ HELP: time-
     }
 } ;
 
-{ time+ time- } related-words
-
 HELP: convert-timezone
 { $values { "timestamp" timestamp } { "duration" duration } { "timestamp" timestamp } }
 { $description "Converts the " { $snippet "timestamp" } "'s " { $snippet "gmt-offset" } " to the GMT offset represented by the " { $snippet "duration" } "." }
@@ -299,3 +297,28 @@ HELP: >local-time
                "t"
     }
 } ;
+
+HELP: >gmt
+{ $values { "timestamp" timestamp } { "timestamp" timestamp } }
+{ $description "Converts the " { $snippet "timestamp" } " to the GMT timezone." }
+{ $examples
+    { $example "USING: accessors calendar kernel prettyprint ;"
+               "now >gmt gmt-offset>> hour>> ."
+               "0"
+    }
+} ;
+
+HELP: time*
+{ $values { "obj1" object } { "obj2" object } { "obj3" object } }
+{ $description "Multiplies each time slot of a timestamp or duration by a number and make a new duration from the result.  Used in the implementation of " { $link before } "." } ;
+{ time+ time- time* } related-words
+
+HELP: before
+{ $values { "duration" duration } { "-duration" duration } }
+{ $description "Negates a duration." }
+{ $examples
+    { $example "USING: accessors calendar prettyprint ;"
+               "3 hours before now noon time+ hour>> ."
+               "9"
+    }
+} ;
index ff002bb16cb15ecdfb563896da19547443607aac..216d9aac664c3d96f5370d60609cdfc6cb235ea4 100755 (executable)
@@ -3,7 +3,7 @@
 USING: arrays kernel math math.functions namespaces sequences
 strings system vocabs.loader calendar.backend threads
 accessors combinators locals classes.tuple math.order
-memoize summary combinators.short-circuit ;
+summary combinators.short-circuit ;
 IN: calendar
 
 TUPLE: duration
@@ -304,14 +304,14 @@ M: timestamp time-
 M: duration time-
     before time+ ;
 
-MEMO: <zero> ( -- timestamp )
+: <zero> ( -- timestamp )
 0 0 0 0 0 0 instant <timestamp> ;
 
 : valid-timestamp? ( timestamp -- ? )
     clone instant >>gmt-offset
     dup <zero> time- <zero> time+ = ;
 
-MEMO: unix-1970 ( -- timestamp )
+: unix-1970 ( -- timestamp )
     1970 1 1 0 0 0 instant <timestamp> ;
 
 : millis>timestamp ( n -- timestamp )