modern: Fix arity for paths.

locals-and-roots
Doug Coleman 2016-06-27 20:23:28 -07:00
parent b7c82eed0c
commit 0ad2c54f55
2 changed files with 12 additions and 5 deletions

View File

@ -259,4 +259,4 @@ IN: sequences.extras.tests
[ 3 { 1 1 2 1 1 1 } [ 2 = not ] head-nth-match ] unit-test [ 3 { 1 1 2 1 1 1 } [ 2 = not ] head-nth-match ] unit-test
{ { 1 1 2 1 } { 1 1 } } { { 1 1 2 1 } { 1 1 } }
[ 3 { 1 1 2 1 1 1 } [ 2 = not ] cut-nth-match ] unit-test [ 3 { 1 1 2 1 1 1 } [ 2 = not ] cut-nth-match ] unit-test

View File

@ -233,10 +233,6 @@ M: compound-sequence-literal write-literal
call call
] if ; inline recursive ] if ; inline recursive
: rewrite-path ( path quot -- )
! dup print
$[ [ path>literals [ _ map-literals ] map ] [ ] bi write-modern-path ]
[ drop . ] recover ; inline
GENERIC: split-arity ( obj -- seq ) ; GENERIC: split-arity ( obj -- seq ) ;
@ -254,6 +250,17 @@ M: less-than-literal split-arity
M: object split-arity ; M: object split-arity ;
: rewrite-path ( path quot -- )
! dup print
$[
[
path>literals
[ _ map-literals ] map
[ split-arity ] map
] [ ] bi write-modern-path ]
[ drop . ] recover ; inline
: rewrite-string ( string quot -- ) : rewrite-string ( string quot -- )
! dup print ! dup print
[ string>literals ] dip $[ _ map-literals ] map [ string>literals ] dip $[ _ map-literals ] map