Skip to content

How to assign part of a matched pattern to a variable? #62

Open
@Qiyamah

Description

@Qiyamah

Hi,
Here is an example, but it would be nice to have a syntax to (ex = :{P,pattern}) to have the matched part of the expression.

@metafunction collectwheres(member1 where *{params1}) begin
  	member2, params2 = collectwheres(member1)
  	(member2, (params1..., params2...))
end
@metafunction collectwheres(other) begin
  	(other,())
end
@metafunction parse_fn(function(*{args},) where w; *{stmts} end) begin
end

for me to use collectwheres method, i need to assign the matched part of the expression by "function(*{args},) where w;" pattern. So is there a way to assign the matched part to a variable so that i can pass it to collectwheres?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions