case now throws the value it can't find
parent
07caee3405
commit
8bad9f014a
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in New Issue