Skip to content

Commit

Permalink
We can't apply, so we have to do our own splitting of the args.
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Marchán committed Jan 16, 2010
1 parent 1338be0 commit f18d6ef
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions facile.factor
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@ quots [ { } ] initialize

: log ( string -- ) (log) respond ;

: add-quot ( string -- ) eval( -- quot ) quots [ swap prefix ] change-global t respond ;

: reset ( -- ) { } quots set t respond ;
: (map-doc) ( doc -- results ) quots get-global swap [ swap call-map-quot ] curry map ;

: call-map-quot ( doc quot -- result )
{ } map-results
[ call( doc -- ) map-results get ] with-variable ;

: (map-doc) ( doc -- results ) quots get-global swap [ swap call-map-quot ] curry map ;

: map-doc ( doc -- ) (map-doc) respond ;

: true-respond ( response -- ) t swap 2array respond ;

: split-kv ( keys-and-values -- values keys ) unzip swap keys ;
Expand All @@ -47,17 +41,23 @@ quots [ { } ] initialize

: (filter-docs) ( docs req user-context -- response ) 2drop ; ! todo

: reduce-results ( quot-strings keys-and-values -- ) (reduce-results) true-respond ;
: add-quot ( string -- ) eval( -- quot ) quots [ swap prefix ] change-global t respond ;

: reset ( args -- ) quots set t respond ;

: map-doc ( args -- ) first (map-doc) respond ;

: reduce-results ( args -- ) first2 (reduce-results) true-respond ;

: rereduce ( quot-strings values -- ) (rereduce) true-respond ;
: rereduce ( args -- ) first2 (rereduce) true-respond ;

: filter-docs ( docs req user-context -- ) (filter-docs) true-respond ;
: filter-docs ( args -- ) first3 (filter-docs) true-respond ;

: validate ( quot-string new-doc old-doc user-context -- ) 2drop 2drop ; ! todo
: validate ( args -- ) first4 2drop 2drop ; ! todo

: show ( quot-string doc req -- ) 3drop ; ! todo
: show ( args -- ) first3 3drop ; ! todo

: update ( quot-string doc req -- ) 3drop ; ! todo
: update ( args -- ) first3 3drop ; ! todo

!
! View server
Expand Down

0 comments on commit f18d6ef

Please sign in to comment.