bootstrap.image.primitives: array>quotation can't be foldable

char-rename
Björn Lindqvist 2016-10-08 15:12:39 +02:00
parent 88b2ed482c
commit 32825b9f5f
2 changed files with 13 additions and 2 deletions

View File

@ -689,7 +689,7 @@ CONSTANT: all-primitives {
{
{
"array>quotation" ( array -- quot ) "array_to_quotation"
{ array } { quotation } make-foldable
{ array } { quotation } make-flushable
}
}
}

View File

@ -1,4 +1,5 @@
USING: kernel math quotations sequences tools.test ;
USING: kernel math quotations.private sequences tools.test ;
IN: quotations
{ [ 3 ] } [ 3 [ ] curry ] unit-test
{ [ \ + ] } [ \ + [ ] curry ] unit-test
@ -15,3 +16,13 @@ USING: kernel math quotations sequences tools.test ;
{ [ "hi" ] } [ "hi" 1quotation ] unit-test
[ 1 \ + curry ] must-fail
: trouble ( -- arr quot ) { 123 } dup array>quotation ;
{ 999 } [
! Call the quotation which compiles it.
trouble call drop
! Change the array used for it.
999 0 rot set-nth
trouble nip call
] unit-test