GH-196 pattern matching lhs (#210)
* Allow block with separate type signature and definition of a function For instance, ``` function add : (int, int) => int add(x, y) = x + y ``` cc #196 * Allow pattern matching in left-hand sides * Changelog * Fix type spec * partial case-on-constructor * Changelog for pattern-matching lets
This commit is contained in:
@@ -8,10 +8,9 @@ contract Stack =
|
||||
|
||||
entrypoint init(ss : list(string)) = { stack = ss, size = length(ss) }
|
||||
|
||||
function length(xs) =
|
||||
switch(xs)
|
||||
[] => 0
|
||||
_ :: xs => length(xs) + 1
|
||||
function
|
||||
length([]) = 0
|
||||
length(_ :: xs) = length(xs) + 1
|
||||
|
||||
stateful entrypoint pop() : string =
|
||||
switch(state.stack)
|
||||
|
||||
Reference in New Issue
Block a user