The case function in SKILL

S

Suresh Jeevanandam

Guest
Andrew and all,
I expect the following code to print "Case 2". But it does not do so.
Why?. Please help/


obj = 1
case( type(obj)
( 'list
println("Case 1")
)
( ('fixnum 'flonum 'string )
println("Case 2")
)
)

thanks,
Suresh
 
Suresh,

Remove all the quotes (') from your example below. They shouldn't
be there, because the match values in the branches of the case
are literals; they are not evaluated, and hence the 'list is seen
as (quote list) and ('fixnum 'flonum 'string) is seen as
((quote fixnum) (quote flonum) (quote string))
which is why they don't match.

Andrew.

On Fri, 16 Jul 2004 13:59:56 +0530, Suresh Jeevanandam
<sureshjeeva@india.ti.com> wrote:

Andrew and all,
I expect the following code to print "Case 2". But it does not do so.
Why?. Please help/


obj = 1
case( type(obj)
( 'list
println("Case 1")
)
( ('fixnum 'flonum 'string )
println("Case 2")
)
)

thanks,
Suresh
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 
Suresh Jeevanandam <sureshjeeva@india.ti.com> wrote in message news:<cd83m8$6ib$1@home.itg.ti.com>...
obj = 1
case( type(obj)
( 'list
println("Case 1")
)
( ('fixnum 'flonum 'string )
println("Case 2")
)
)
Good question, wish I knew the answer. ('fixnum 'flonum 'string)
*is* a list of symbols and lists of strings work, and lists
of reals work, etc. But a list of symbols doesn't seem
to work. Hrmph.

-Jay-
 

Welcome to EDABoard.com

Sponsor

Back
Top