summaryrefslogtreecommitdiff
path: root/2015/day10.exs
diff options
context:
space:
mode:
Diffstat (limited to '2015/day10.exs')
-rw-r--r--2015/day10.exs4
1 files changed, 3 insertions, 1 deletions
diff --git a/2015/day10.exs b/2015/day10.exs
index 384a15f..99673a5 100644
--- a/2015/day10.exs
+++ b/2015/day10.exs
@@ -1,8 +1,10 @@
start = File.read!("inputs/day10.txt")
+digitRegex = ~r/(\d)\1*/
+
lookAndSayStream =
Stream.iterate(start, fn current ->
- Regex.scan(~r/(\d)\1*/, current)
+ Regex.scan(digitRegex, current)
|> Enum.map(fn [seq, _] ->
length = String.length(seq)
type = String.at(seq, 0)