Skip to content

allow pattern matching parameters on function like elixir #72

Open
@decioferreira

Description

@decioferreira

allow for multiple entries of the same function with pattern matching the parameters, like a case statement.

The following implementation of Fibonacci Sequence:

fib : Int -> Int
fib x =
    case x of
        0 ->
            1

        1 ->
            1

        _ ->
            fib (x - 1) + fib (x - 2)

Could be converted into:

fib : Int -> Int
fib 0 = 1
fib 1 = 1
fib x = fib (x - 1) + fib (x - 2)

The second example should probably be converted back to the original version with the use of the case statement, by using a tuple for the arguments (this might need #70).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions