Skip to main content
added 50 characters in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 5454 49 bytes

import Data.List g x|let f=zipWithx=zipWith(\\)x$scanl(++)""f=f""$g x 

Try it online!Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment), this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\) 

Edit: -5 bytes thanks to @Sriotchilism O'Zaic.

Haskell, 54 bytes

import Data.List g x|let f=zipWith(\\)x$scanl(++)""f=f 

Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment), this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\) 

Haskell, 54 49 bytes

import Data.List g x=zipWith(\\)x$scanl(++)""$g x 

Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment), this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\) 

Edit: -5 bytes thanks to @Sriotchilism O'Zaic.

added 1 character in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 54 bytes

import Data.List g x|let f=zipWith(\\)x$scanl(++)""f=f 

Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment), this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\) 

Haskell, 54 bytes

import Data.List g x|let f=zipWith(\\)x$scanl(++)""f=f 

Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment, this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\) 

Haskell, 54 bytes

import Data.List g x|let f=zipWith(\\)x$scanl(++)""f=f 

Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment), this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\) 
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 54 bytes

import Data.List g x|let f=zipWith(\\)x$scanl(++)""f=f 

Try it online!

We build the output list by calculating pairwise the list difference (\\) of the input list and the cumulative append of the output list (starting with "").

input list: ONE TWO THREE SEVENTEEN cumulative append: "" +-> ONE +-> ONETW +-> ONETWHRE list difference (output): ONE -+ TW -+ HRE -+ SVEEN 

With both Data.List and Data.Function in scope (e.g. by using the lambdabot environment, this can be shortened to 30 bytes:

fix.(.scanl(++)"").zipWith(\\)