case now throws the value it can't find

db4
Doug Coleman 2009-02-10 16:59:55 -06:00
parent 07caee3405
commit 8bad9f014a
2 changed files with 17 additions and 3 deletions

View File

@ -323,4 +323,18 @@ DEFER: corner-case-1
[ t ] [ \ corner-case-1 optimized>> ] unit-test
[ 4 ] [ 2 corner-case-1 ] unit-test
[ 4 ] [ 2 2 [ + ] curry 1array case ] unit-test
[ 4 ] [ 2 2 [ + ] curry 1array case ] unit-test
: test-case-8 ( n -- )
{
{ 1 [ "foo" ] }
} case ;
[ 3 test-case-8 ]
[ object>> 3 = ] must-fail-with
[
3 {
{ 1 [ "foo" ] }
} case
] [ object>> 3 = ] must-fail-with

View File

@ -49,7 +49,7 @@ ERROR: no-cond ;
reverse [ no-cond ] swap alist>quot ;
! case
ERROR: no-case ;
ERROR: no-case object ;
: case-find ( obj assoc -- obj' )
[
@ -66,7 +66,7 @@ ERROR: no-case ;
case-find {
{ [ dup array? ] [ nip second call ] }
{ [ dup callable? ] [ call ] }
{ [ dup not ] [ no-case ] }
{ [ dup not ] [ drop no-case ] }
} cond ;
: linear-case-quot ( default assoc -- quot )