Skip to content

Match body traversal algorithm #3

@chouzar

Description

@chouzar

Erlang matchspecs are composed of tuple functions of 3 parts:

MatchFunction ::= { MatchHead, MatchConditions, MatchBody }

Usually literal values will be interpreted "as is" on the head or body with the exception of tuples and records on the MatchBody, as the engine requires those to be wrapped in a single element tuple.

Examples

To represent the tuple #(1, 2, 3) we will require:

let body = #(#(1, 2, 3))

To represent the record User(name: "Raúl") we will require:

let body = #(#(tag("user"), "Raúl"))

Instead of having the user specifying double tuples everywhere in the body we could automate it, can be done for primitives but the hard part is how to solve for custom datastructures.

This is partially implemented in v0.4.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions