Re: [elixir-core:6407] [Proposal] List.unwrap/1

2016-09-25 Thread Peter Hamilton
How is its implementation more than just Enum.map(list, /1) ?

I imagine we only conditionally apply hd if it's an element is a list of
length 1. Does it do anything else?
On Sun, Sep 25, 2016, 7:12 PM Chris Keele  wrote:

> I can see how List.unwrap is a confusing–it does sound like the
> mathematical opposite.
>
> Perhaps List.strip/1 is a more intuitive name?
>
>
>
> --
> Chris Keele
> Web Developer
>
> On September 25, 2016 at 6:55:11 PM, Peter Hamilton (
> peterghamil...@gmail.com) wrote:
>
> Is [1,2] valid output of List.wrap? If it's not in the range of output, I
> think we could error on it as input to List.unwrap.
>
> Exactly once might be correct semantics, will have to play with some
> examples.
>
> On Sun, Sep 25, 2016, 3:46 PM Chris Keele  wrote:
>
>> If List.unwrap([1]) = 1, how would you handle List.unwrap([1, 2])? [1, 2]
>> would be inconsistent. That’s more of a splat/unquote_splicing operation.
>> --
>> 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/CAOtzO5KD_BtWo1pkoZOCxPRJ-jqCc8H3p3kqm3AzKFXi5d%2B%3DOg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> You received this message because you are subscribed to a topic in the
> Google Groups "elixir-lang-core" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/elixir-lang-core/rvI1kE8xp3Q/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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/CAOMhEnwu0v%2B-GyT8_QWtLxxCtkiOT7GrowAgY81w0mbtgygbfw%40mail.gmail.com
> 
> .
>
>
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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/CAOtzO5JHUUPss%2BssJ-UBRd3F3eWX3UKLRWGkWfcr12TFCUj9mg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAOMhEnzFbh%3DdFW68v7YNZnkJz009EOkE6ScAaGw3oUjmvYgTRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6406] [Proposal] List.unwrap/1

2016-09-25 Thread Chris Keele
I can see how List.unwrap is a confusing–it does sound like the
mathematical opposite.

Perhaps List.strip/1 is a more intuitive name?



-- 
Chris Keele
Web Developer

On September 25, 2016 at 6:55:11 PM, Peter Hamilton (
peterghamil...@gmail.com) wrote:

Is [1,2] valid output of List.wrap? If it's not in the range of output, I
think we could error on it as input to List.unwrap.

Exactly once might be correct semantics, will have to play with some
examples.

On Sun, Sep 25, 2016, 3:46 PM Chris Keele  wrote:

> If List.unwrap([1]) = 1, how would you handle List.unwrap([1, 2])? [1, 2]
> would be inconsistent. That’s more of a splat/unquote_splicing operation.
> --
> 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/CAOtzO5KD_BtWo1pkoZOCxPRJ-jqCc8H3p3kqm3AzKFXi5d%2B%3DOg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to a topic in the
Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elixir-lang-core/rvI1kE8xp3Q/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAOMhEnwu0v%2B-GyT8_QWtLxxCtkiOT7GrowAgY81w0mbtgygbfw%40mail.gmail.com

.
For more options, visit https://groups.google.com/d/optout.

-- 
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/CAOtzO5JHUUPss%2BssJ-UBRd3F3eWX3UKLRWGkWfcr12TFCUj9mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6405] [Proposal] List.unwrap/1

2016-09-25 Thread Peter Hamilton
Is [1,2] valid output of List.wrap? If it's not in the range of output, I
think we could error on it as input to List.unwrap.

Exactly once might be correct semantics, will have to play with some
examples.

On Sun, Sep 25, 2016, 3:46 PM Chris Keele  wrote:

> If List.unwrap([1]) = 1, how would you handle List.unwrap([1, 2])? [1, 2]
> would be inconsistent. That’s more of a splat/unquote_splicing operation.
>
> --
> 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/CAOtzO5KD_BtWo1pkoZOCxPRJ-jqCc8H3p3kqm3AzKFXi5d%2B%3DOg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAOMhEnwu0v%2B-GyT8_QWtLxxCtkiOT7GrowAgY81w0mbtgygbfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6404] [Proposal] List.unwrap/1

2016-09-25 Thread Chris Keele
If List.unwrap([1]) = 1, how would you handle List.unwrap([1, 2])? [1, 2]
would be inconsistent. That’s more of a splat/unquote_splicing operation.

-- 
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/CAOtzO5KD_BtWo1pkoZOCxPRJ-jqCc8H3p3kqm3AzKFXi5d%2B%3DOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6403] [Proposal] List.unwrap/1

2016-09-25 Thread Peter Hamilton
> List.unwrap ensures its arguments are wrapped in a list only once.

Only once or at most once?

I think it should be a strict mathematical inverse so:

(List.wrap(foo) |> List.unwrap) == foo

On Sun, Sep 25, 2016, 3:17 PM Chris Keele  wrote:

> Simply put, if List.wrap ensures its arguments are wrapped in a list at
> least once, List.unwrap ensures its arguments are wrapped in a list only
> once.
>
> --
> 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/526062e7-6a91-4a54-9e02-d70c7bcfe572%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAOMhEnzA4UQTA7xunN%3Dn2PSENqgtcspVCPHKpgxCm7aPNBoDoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6403] [Proposal] List.unwrap/1

2016-09-25 Thread Chris Keele
Simply put, if List.wrap ensures its arguments are wrapped in a list at 
least once, List.unwrap ensures its arguments are wrapped in a list only 
once.

-- 
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/526062e7-6a91-4a54-9e02-d70c7bcfe572%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6401] [Proposal] List.unwrap/1

2016-09-25 Thread Chris Keele
It respects the existence of lists as a general data structure––effectively
only flattening wrapper lists.

nested = [ [], :a, [:b], [[:c]] ]
List.flatten nested
#=> [:a, :b, :c]
List.unwrap nested
#=> [ [], :a, [:b], [:c] ]

-- 
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/CAOtzO5J6LzRXLAM_G0-uSf68W_kc4nQr%2BPkdi6n3R7UF0qwRiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:6400] [Proposal] List.unwrap/1

2016-09-25 Thread Louis Pilfold
What's the difference between this and List.flatten ?

Cheers,
Louis

On 25 Sep 2016 23:00, "Chris Keele"  wrote:

> List.unwrap/1
> 
> is a simple compliment to List.wrap/1––it walks a nested list and unwraps
> any extraneous wrappers it finds, eg: [[:a]] -> [:a].
>
> I mostly find it useful for cleaning up after nested list transforms, but
> always manage to implement it wrong the first few times, so I thought I'd
> throw it out there as a general list utility.
>
> --
> 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/3da5323f-585f-4068-8ef0-
> 1865d3a75fd0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAM-pwt6kAJHnemaTihDLBLuXTFzc%3D%3D_W_9%3DLY4b3KEUSNaOJmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[elixir-core:6400] [Proposal] List.unwrap/1

2016-09-25 Thread Chris Keele
List.unwrap/1 

 
is a simple compliment to List.wrap/1––it walks a nested list and unwraps 
any extraneous wrappers it finds, eg: [[:a]] -> [:a].

I mostly find it useful for cleaning up after nested list transforms, but 
always manage to implement it wrong the first few times, so I thought I'd 
throw it out there as a general list utility.

-- 
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/3da5323f-585f-4068-8ef0-1865d3a75fd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.