functors2: same -> inline

modern-harvey2
Doug Coleman 2017-12-28 18:51:21 -08:00
parent b095c40e73
commit bb07cd3d48
1 changed files with 9 additions and 13 deletions

View File

@ -46,7 +46,7 @@ ERROR: not-all-unique seq ;
_ hashcode number>string % ! narray for all the template parameters _ hashcode number>string % ! narray for all the template parameters
] "" make ; ] "" make ;
: functor-same-vocab-name ( functor-word parameters -- string ) : functor-inline-vocab-name ( functor-word parameters -- string )
drop drop
'[ '[
! box-functor:functors:box:float:1827917291 ! box-functor:functors:box:float:1827917291
@ -83,7 +83,7 @@ ERROR: not-all-unique seq ;
] dip ] dip
] 3tri ; ] 3tri ;
: prepend-input-vocabs-same ( word def effect -- word def effect ) : prepend-input-vocabs-inline ( word def effect -- word def effect )
[ 2drop ] [ 2drop ]
[ [
! make FROM: vocab => word ; for each input argument ! make FROM: vocab => word ; for each input argument
@ -171,10 +171,10 @@ CONSTANT: scanner-table H{
'[ @ @ ] define-syntax '[ @ @ ] define-syntax
] 3bi ; inline ] 3bi ; inline
: (make-functor-same) ( word effect quot -- ) : (make-functor-inline) ( word effect quot -- )
swap swap
make-in-drop-variables make-in-drop-variables
prepend-input-vocabs-same prepend-input-vocabs-inline
! word quot effect ! word quot effect
[ [
[ functor-definer-word-name create-new-word-in ] 2dip [ functor-definer-word-name create-new-word-in ] 2dip
@ -207,27 +207,23 @@ CONSTANT: scanner-table H{
(make-functor-vocab) (make-functor-vocab)
] 4bi ; inline ] 4bi ; inline
: make-variable-functor-same ( word effect bindings string -- ) : make-variable-functor-inline ( word effect bindings string -- )
[ [
nip make-functor-word nip make-functor-word
] [ ] [
[ interpolate-assoc ] dip ! do bindings in series [ interpolate-assoc ] dip ! do bindings in series
'[ @ _ interpolate>string append ] ! append the interpolated string to the FROM: '[ @ _ interpolate>string append ] ! append the interpolated string to the FROM:
(make-functor-same) (make-functor-inline)
] 4bi ; inline ] 4bi ; inline
: make-functor ( word effect string -- ) : make-functor ( word effect string -- )
{ } swap make-variable-functor ; { } swap make-variable-functor ;
: make-same-functor ( word effect string -- ) : make-inline-functor ( word effect string -- )
{ } swap make-variable-functor-same ; { } swap make-variable-functor-inline ;
! FUNCTOR: foo, define-foo, and FOO: go into the vocabulary where the FUNCTOR: appears
! SYNTAX: \FUNCTOR:
! scan-new-word scan-effect scan-object make-functor ;
! SYNTAX: \VARIABLE-FUNCTOR: ! SYNTAX: \VARIABLE-FUNCTOR:
! scan-new-word scan-effect scan-object scan-object make-variable-functor ; ! scan-new-word scan-effect scan-object scan-object make-variable-functor ;
SYNTAX: \INLINE-FUNCTOR: SYNTAX: \INLINE-FUNCTOR:
scan-new-word scan-effect scan-object make-same-functor ; scan-new-word scan-effect scan-object make-inline-functor ;