Skip to main content
added 165 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

05AB1E, 10 99 7 bytes

-1 byte inspired by Jonathan Allans Jelly answer.
-2 bytes thanks to Kevin Cruijssen!

Input is a list of characters.

€aγOʒĀ}aγO0K.M 

Try it online!Try it online!

Commented:

€a0¡OʒĀ}aγO0K.M implicit input "ab["a","b"," cd","c","d"," e.","e","."] €a a map is_alpha  (vectorizes)[1, 1, 0, 0, 1, 1, 0, 1, 0]   γ split into chunks of equal elements   [[1, 1], [0, 0], [1, 1], [0], [1], [0]]   O sum the lists [2, 0, 2, 0, 1, 0]  ʒ }  filter on ... 0K [2, 2,remove 1]0's  Ā  ... Python-style truthy (0 is false) M mode .M mode 2  2  implicit output implicit ouput2 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

05AB1E, 10 9 bytes

-1 byte inspired by Jonathan Allans Jelly answer.

€aγOʒĀ}.M 

Try it online!

Commented:

€a0¡OʒĀ} implicit input "ab, cd e." €a  map is_alpha  [1, 1, 0, 0, 1, 1, 0, 1, 0]   γ split into chunks of equal elements [[1, 1], [0, 0], [1, 1], [0], [1], [0]]   O sum the lists [2, 0, 2, 0, 1, 0]  ʒ }  filter on ... [2, 2, 1]  Ā  ... Python-style truthy (0 is false)  .M mode 2  implicit ouput 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

05AB1E, 10 9 7 bytes

-1 byte inspired by Jonathan Allans Jelly answer.
-2 bytes thanks to Kevin Cruijssen!

Input is a list of characters.

aγO0K.M 

Try it online!

Commented:

aγO0K.M implicit input ["a","b"," ","c","d"," ","e","."] a is_alpha (vectorizes)[1, 1, 0, 0, 1, 1, 0, 1, 0] γ split into chunks of equal elements   [[1, 1], [0, 0], [1, 1], [0], [1], [0]] O sum the lists [2, 0, 2, 0, 1, 0] 0K remove 0's .M mode 2  implicit output 2 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

added 663 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

05AB1E, 1010 9 bytes

-1 byte inspired by Jonathan Allans Jelly answer.

€a0¡OʒĀ€aγOʒĀ}.M 

Try it online!Try it online!

Commented:

€a0¡OʒĀ} implicit input "ab, cd e." €a map is_alpha [1, 1, 0, 0, 1, 1, 0, 1, 0] γ  split oninto 0chunks of equal elements  [[1, 1], [][0, 0], [1, 1], [1]] [0], [1], [0]]  O  sum the lists [2, 0, 2, 1] 0, 1, 0]  ʒ }  filter on ... [2, 2, 1]   Ā  ... Python-style truthy (0 is false)   .M  mode 2 implicit outputouput 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

05AB1E, 10 bytes

€a0¡OʒĀ}.M 

Try it online!

Commented:

€a0¡OʒĀ} implicit input "ab, cd e." €a map is_alpha [1, 1, 0, 0, 1, 1, 0, 1, 0]  split on 0 [[1, 1], [], [1, 1], [1]]  O sum the lists [2, 0, 2, 1]  ʒ } filter on ... [2, 2, 1]   Ā ... Python-style truthy (0 is false)   .M mode 2 implicit output 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

05AB1E, 10 9 bytes

-1 byte inspired by Jonathan Allans Jelly answer.

€aγOʒĀ}.M 

Try it online!

Commented:

€a0¡OʒĀ} implicit input "ab, cd e." €a map is_alpha [1, 1, 0, 0, 1, 1, 0, 1, 0] γ  split into chunks of equal elements  [[1, 1], [0, 0], [1, 1], [0], [1], [0]]  O  sum the lists [2, 0, 2, 0, 1, 0]  ʒ }  filter on ... [2, 2, 1] Ā  ... Python-style truthy (0 is false) .M  mode 2 implicit ouput 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

added 663 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

05AB1E, 10 bytes

€a0¡OʒĀ}.M 

Try it online!

Commented:

€a0¡OʒĀ} implicit input "ab, cd e." €a map is_alpha [1, 1, 0, 0, 1, 1, 0, 1, 0] 0¡ split on 0 [[1, 1], [], [1, 1], [1]] O sum the lists [2, 0, 2, 1] ʒ } filter on ... [2, 2, 1] Ā ... Python-style truthy (0 is false) .M mode 2 implicit output 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

05AB1E, 10 bytes

€a0¡OʒĀ}.M 

Try it online!

05AB1E, 10 bytes

€a0¡OʒĀ}.M 

Try it online!

Commented:

€a0¡OʒĀ} implicit input "ab, cd e." €a map is_alpha [1, 1, 0, 0, 1, 1, 0, 1, 0] 0¡ split on 0 [[1, 1], [], [1, 1], [1]] O sum the lists [2, 0, 2, 1] ʒ } filter on ... [2, 2, 1] Ā ... Python-style truthy (0 is false) .M mode 2 implicit output 

a is implemented as Regex.match?(~r/^[a-zA-Z]+$/, to_string(x)), which should be equivalent to the challenge specification.

I feel like there has to be a shorter way to remove 0s from a list than ʒĀ}.

Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading