]> gitweb.factorcode.org Git - factor.git/blob - extra/calendar/format/macros/macros.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / calendar / format / macros / macros.factor
1 USING: macros kernel words quotations io sequences combinators
2 continuations ;
3 IN: calendar.format.macros
4
5 MACRO: formatted ( spec -- )
6     [
7         {
8             { [ dup word? ] [ 1quotation ] }
9             { [ dup quotation? ] [ ] }
10             [ [ nip write ] curry [ ] like ]
11         } cond
12     ] map [ cleave ] curry ;
13
14 MACRO: attempt-all-quots ( quots -- )
15     dup length 1 = [ first ] [
16         unclip swap
17         [ nip attempt-all-quots ] curry
18         [ recover ] 2curry
19     ] if ;