pattern matching

18 views
Skip to first unread message

Steve

unread,
Jun 14, 2012, 6:32:21 AM6/14/12
to looplang
Hi

Look like a great little language. Nice sytax, compact, not
overloaded. Very promising.
Working through the tutorial I stumbled across a basic problem.
Am I doing something wrong?

>> :reset
Context reset.
>> test(lst) =>
| [] : true
| * : false
|
ok
>>
>> [].test()
Exception in thread "main" java.lang.VerifyError: (class: _shell,
method: test s
ignature: (Ljava/lang/Object;)Ljava/lang/Object;) Illegal local
variable number
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at loop.Executable.main(Executable.java:230)
at loop.Loop.safeEval(Loop.java:60)
at loop.LoopShell.evalInFunction(LoopShell.java:275)
at loop.LoopShell.shell(LoopShell.java:190)
at loop.Loop.main(Loop.java:17)

Dhanji R. Prasanna

unread,
Jun 16, 2012, 3:44:20 AM6/16/12
to loop...@googlegroups.com, kennedy...@googlemail.com
Thanks for the kind words!

Ouch, that looks like a weird problem. ASM is generating an incorrect local variable count in the bytecode. There is no good reason for this =( Let me take a closer look at that.

In the meantime, using only list patterns should fix your issue:


>> test(ls) =>
|    [] : true
|    [x:xs] : false
|    
ok
>> [].test()
true
>> [1, 2].test()
false
>> 
Reply all
Reply to author
Forward
0 new messages