You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first :: rest vs [first, ..rest]: I like the latter because I feel like it's easier to scale it for patterns like [1, 2, 3, ..rest], on the other hand :: is definitely more friendly for LLMs coming from Scala
the exact syntax for .. (..., *): here I took inspiration from C# / Rust / JS / Swift(ish) / Zig(ish)
should it be ..rest or rest @ .. ala Rust (making the .. an irrefutable pattern)? or something else like rest..? the @ variant would force us to also newly add @ patterns!
should we also allow [..init, 1] to match against the last element? It would be consistent, but might lead to programs with unusually bad perf...
how would we take advantage of this / something similar later for other collections? what about streams?
do we need/want this at all?
The text was updated successfully, but these errors were encountered:
Motivation
Effekt has list literals, but no list patterns, therefore one cannot use lists in patterns :(
To remedy this, we could allow, let's say:
as "syntax sugar" for:
Reasoning
I thought about this syntax specifically in order to also later allow:
[..xs, ..ys]
Questions
Feel free to bikeshed:
first :: rest
vs[first, ..rest]
: I like the latter because I feel like it's easier to scale it for patterns like[1, 2, 3, ..rest]
, on the other hand::
is definitely more friendly for LLMs coming from Scala..
(...
,*
): here I took inspiration from C# / Rust / JS / Swift(ish) / Zig(ish)..rest
orrest @ ..
ala Rust (making the..
an irrefutable pattern)? or something else likerest..
? the@
variant would force us to also newly add@
patterns![..init, 1]
to match against the last element? It would be consistent, but might lead to programs with unusually bad perf...The text was updated successfully, but these errors were encountered: