NVM I found elixir can do this straightforwardly with a sequence of 
pattern: 
```
a = {c, _} = {1, 2}
```
在2023年6月8日星期四 UTC+8 11:54:19<Andrey Yugai> 写道:

>
> Could you provide an elixir example with proposed new syntax, for those 
> who is not familiar with haskell? 
>
>
>
>
> -------- Original Message --------
> On 8 Jun 2023, 11:36, Corvo Liu < lyh...@gmail.com> wrote:
>
>
> In haskell there's a syntax sugar called as pattern. For example:
>
> ```
> f (x:xs)                = x:x:xs
> ```
>
> maybe rewrite as:
>
> ```
> f s@(x:xs)             = x:s
> ```
>
> This feature is useful, and I constantly find there's places in my code 
> that I can use it to make my code more concise. 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to elixir-lang-co...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/afbf8a08-354c-48f1-a944-3683a3d0f236n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/afbf8a08-354c-48f1-a944-3683a3d0f236n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/941a899f-e0ab-4ab8-8175-1208ab83dea7n%40googlegroups.com.

Reply via email to