! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences combinators parser splitting math
quotations arrays make qualified words ;
-QUALIFIED: make
IN: fry
-: , ( -- * ) "Only valid inside a fry" throw ;
+: _ ( -- * ) "Only valid inside a fry" throw ;
: @ ( -- * ) "Only valid inside a fry" throw ;
<PRIVATE
: (shallow-fry) ( accum quot -- result )
[ 1quotation ] [
unclip {
- { \ , [ [ curry ] ((shallow-fry)) ] }
+ { \ , [ "Oops!!" throw ] }
+ { \ _ [ [ curry ] ((shallow-fry)) ] }
{ \ @ [ [ compose ] ((shallow-fry)) ] }
-
- ! to avoid confusion, remove if fry goes core
- { \ make:, [ [ curry ] ((shallow-fry)) ] }
-
[ swap >r suffix r> (shallow-fry) ]
} case
] if-empty ;
: shallow-fry ( quot -- quot' ) [ ] swap (shallow-fry) ;
-PREDICATE: fry-specifier < word { , make:, @ } memq? ;
+PREDICATE: fry-specifier < word { _ @ , } memq? ;
GENERIC: count-inputs ( quot -- n )
M: callable count-inputs [ count-inputs ] sigma ;
-M: fry-specifier count-inputs drop 1 ;
+M: fry-specifier count-inputs \ , eq? [ "Oops!!" throw ] when 1 ;
M: object count-inputs drop 0 ;
PRIVATE>
[
[
dup callable? [
- [ count-inputs \ , <repetition> % ] [ fry % ] bi
- ] [ make:, ] if
+ [ count-inputs \ _ <repetition> % ] [ fry % ] bi
+ ] [ , ] if
] each
] [ ] make shallow-fry ;