Re: [EXTERNAL] Re: [elixir-core:11224] [proposal] Use patterns to filter data (good for pipes)

2022-12-15 Thread 'Matt Farabaugh' via elixir-lang-core
veloped. :) On Thu, Dec 15, 2022 at 10:31 PM 'Matt Farabaugh' via elixir-lang-core mailto:elixir-lang-core@googlegroups.com>> wrote: Hi Ben, I agree that it reduces its applicability, but I see that as a virtue. Filter and Map are useful despite being less applicable than Reduce, since

Re: [EXTERNAL] Re: [elixir-core:11221] [proposal] Use patterns to filter data (good for pipes)

2022-12-15 Thread 'Matt Farabaugh' via elixir-lang-core
might fail on nil anyway. Or maybe a with/1 pipeline might work better than the pipe operator if you want a succession of happy-path matches? If we move forward, it might be better to explicitly declare the returned expression, not just infer it from dangling variables: it isn't obvious what sho

Re: [EXTERNAL] Re: [elixir-core:11219] [proposal] Use patterns to filter data (good for pipes)

2022-12-15 Thread 'Matt Farabaugh' via elixir-lang-core
variables: it isn't obvious what should `{a, b}` or `{a, b, a}` return. Something like: {1, 2, 1} |> pattern_filter(b <- {a, b, a}) Le mer. 14 déc. 2022 à 05:50, 'Matt Farabaugh' via elixir-lang-core a écrit : All, I wrote a macro which allows for using a pattern to essentially e

Re: [EXTERNAL] Re: [elixir-core:11217] [proposal] Use patterns to filter data (good for pipes)

2022-12-15 Thread 'Matt Farabaugh' via elixir-lang-core
it might be better to explicitly declare the returned expression, not just infer it from dangling variables: it isn't obvious what should `{a, b}` or `{a, b, a}` return. Something like: {1, 2, 1} |> pattern_filter(b <- {a, b, a}) Le mer. 14 déc. 2022 à 05:50, 'Matt Farabaugh' via elixir-lan

Re: [EXTERNAL] Re: [elixir-core:11216] [proposal] Use patterns to filter data (good for pipes)

2022-12-14 Thread 'Matt Farabaugh' via elixir-lang-core
ht be better to explicitly declare the returned expression, not just infer it from dangling variables: it isn't obvious what should `{a, b}` or `{a, b, a}` return. Something like: {1, 2, 1} |> pattern_filter(b <- {a, b, a}) Le mer. 14 déc. 2022 à 05:50, 'Matt Farabaugh' via elixir-lang-core

Re: [EXTERNAL] Re: [elixir-core:11214] [proposal] Use patterns to filter data (good for pipes)

2022-12-13 Thread 'Matt Farabaugh' via elixir-lang-core
isn't obvious what should `{a, b}` or `{a, b, a}` return. Something like: {1, 2, 1} |> pattern_filter(b <- {a, b, a}) Le mer. 14 déc. 2022 à 05:50, 'Matt Farabaugh' via elixir-lang-core mailto:elixir-lang-core@googlegroups.com>> a écrit : All, I wrote a macro which allows for using a

[elixir-core:11211] [proposal] Use patterns to filter data (good for pipes)

2022-12-13 Thread 'Matt Farabaugh' via elixir-lang-core
All, I wrote a macro which allows for using a pattern to essentially extract a value from a data structure: @doc """ Filter a value out of data using a pattern with one variable. Returns a default value if no match. Raises if pattern contains no variables or more than one variable. ##