sequences.product: product-each and product-map
misc/vim.syntax.fgen: small fix for quotation highlightingdb4
parent
f86073733c
commit
8738b3d219
|
@ -24,3 +24,6 @@ IN: sequences.product.tests
|
||||||
[ [ % ] each ] product-each
|
[ [ % ] each ] product-each
|
||||||
] "" make
|
] "" make
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
[ { } ] [ { { } { 1 } } [ ] product-map ] unit-test
|
||||||
|
[ ] [ { { } { 1 } } [ drop ] product-each ] unit-test
|
||||||
|
|
|
@ -37,7 +37,7 @@ M: product-sequence length lengths>> product ;
|
||||||
: product-iter ( ns lengths -- )
|
: product-iter ( ns lengths -- )
|
||||||
[ 0 over [ 1 + ] change-nth ] dip carry-ns ;
|
[ 0 over [ 1 + ] change-nth ] dip carry-ns ;
|
||||||
|
|
||||||
: start-product-iter ( sequence-product -- ns lengths )
|
: start-product-iter ( sequences -- ns lengths )
|
||||||
[ [ drop 0 ] map ] [ [ length ] map ] bi ;
|
[ [ drop 0 ] map ] [ [ length ] map ] bi ;
|
||||||
|
|
||||||
: end-product-iter? ( ns lengths -- ? )
|
: end-product-iter? ( ns lengths -- ? )
|
||||||
|
@ -50,8 +50,10 @@ M: product-sequence nth
|
||||||
|
|
||||||
:: product-each ( sequences quot -- )
|
:: product-each ( sequences quot -- )
|
||||||
sequences start-product-iter :> lengths :> ns
|
sequences start-product-iter :> lengths :> ns
|
||||||
|
lengths [ 0 = ] any? [
|
||||||
[ ns lengths end-product-iter? ]
|
[ ns lengths end-product-iter? ]
|
||||||
[ ns sequences nths quot call ns lengths product-iter ] until ; inline
|
[ ns sequences nths quot call ns lengths product-iter ] until
|
||||||
|
] unless ; inline
|
||||||
|
|
||||||
:: product-map ( sequences quot -- sequence )
|
:: product-map ( sequences quot -- sequence )
|
||||||
0 :> i!
|
0 :> i!
|
||||||
|
|
|
@ -155,18 +155,18 @@ syn match factorLiteralStackEffect /\<(( .*--.* ))\>/
|
||||||
|
|
||||||
"adapted from lisp.vim
|
"adapted from lisp.vim
|
||||||
if exists("g:factor_norainbow")
|
if exists("g:factor_norainbow")
|
||||||
syn region factorQuotation matchgroup=factorDelimiter start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ matchgroup=factorDelimiter end=/\<\]\>/ contains=ALL
|
syn region factorQuotation matchgroup=factorDelimiter start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ matchgroup=factorDelimiter end=/\<\]\>/ contains=ALL
|
||||||
else
|
else
|
||||||
syn region factorQuotation0 matchgroup=hlLevel0 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1,factorArray1
|
syn region factorQuotation0 matchgroup=hlLevel0 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1,factorArray1
|
||||||
syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2,factorArray2
|
syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2,factorArray2
|
||||||
syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3,factorArray3
|
syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3,factorArray3
|
||||||
syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4,factorArray4
|
syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4,factorArray4
|
||||||
syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5,factorArray5
|
syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5,factorArray5
|
||||||
syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6,factorArray6
|
syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6,factorArray6
|
||||||
syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7,factorArray7
|
syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7,factorArray7
|
||||||
syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8,factorArray8
|
syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8,factorArray8
|
||||||
syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9,factorArray9
|
syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9,factorArray9
|
||||||
syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\(\('\|\$\|\)\[\)\|\[\(let\||\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0,factorArray0
|
syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\(\(\('\|\$\|\)\[\)\|\[\(let\||\)\)\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0,factorArray0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("g:factor_norainbow")
|
if exists("g:factor_norainbow")
|
||||||
|
|
Loading…
Reference in New Issue