1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: parser arrays namespaces sequences random help.markup kernel io
4 io.styles colors.constants ;
9 tips [ V{ } clone ] initialize
11 SYNTAX: TIP: parse-definition >array tips get push ;
13 : a-tip ( -- tip ) tips get random ;
15 SYMBOL: tip-of-the-day-style
18 { page-color COLOR: lavender }
21 } tip-of-the-day-style set-global
23 : $tip-of-the-day ( element -- )
26 tip-of-the-day-style get
29 "Tip of the day" $heading a-tip print-element nl
30 "— " print-element "all-tips-of-the-day" ($link)
35 : tip-of-the-day. ( -- ) { $tip-of-the-day } print-content nl ;
37 : $tips-of-the-day ( element -- )
38 drop tips get [ nl nl ] [ print-element ] interleave ;