Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support named tuples #117

Merged
merged 23 commits into from
Dec 18, 2024
Merged

Support named tuples #117

merged 23 commits into from
Dec 18, 2024

Conversation

nystrom
Copy link
Collaborator

@nystrom nystrom commented Nov 16, 2024

Fix #95

Introduces the following patterns:

(; x)       -- match a named tuple with field x
(; x::Int)  -- match a named tuple with field x of type Int
(; x=p)     -- match a named tuple with field x that matches p

The first two patterns bind the field to a variable x. The (; x=p) pattern does not bind x.

@nystrom nystrom requested a review from gafter November 18, 2024 11:00
README.md Outdated Show resolved Hide resolved
@nystrom nystrom marked this pull request as ready for review November 24, 2024 16:10
@nystrom nystrom requested a review from gafter November 25, 2024 17:14
@gafter
Copy link
Member

gafter commented Nov 26, 2024

👀

Copy link
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments. Sorry I took so long to review.

src/binding.jl Outdated Show resolved Hide resolved
src/binding.jl Outdated Show resolved Hide resolved
src/binding.jl Show resolved Hide resolved
src/binding.jl Outdated Show resolved Hide resolved
@nystrom nystrom requested a review from gafter December 17, 2024 17:10
@gafter
Copy link
Member

gafter commented Dec 17, 2024

👀

@nystrom nystrom merged commit a39728c into main Dec 18, 2024
9 checks passed
@nystrom nystrom deleted the nn-named-tuples branch December 18, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible to match a NamedTuple?
2 participants