Untitled notebook
import IEx.Helpers
CRC
defmodule Counter do
def construct(str) do
String.to_integer(str)
end
def reduce(acc, item) do
acc + item
end
def convert(acc) do
"The ants-ARRRR is #{acc}"
end
end
input = "7"
input
|> Counter.construct()
|> Counter.reduce(1)
|> Counter.reduce(1)
|> Counter.reduce(-1)
|> Counter.convert()
treasure_map = [1, 1, -1]
treasure_map
|> Enum.reduce(Counter.construct(input), &Counter.reduce/2 )
|> Counter.convert()
h Enum.reduce/3
self()
|> Process.info()
Prompt for liveview counter
preconditions: we had a working live component alternative using a counter because it was a simple, understandable business problem with an idea we wanted to communicate: live components considered harmful; use a skill instead. We built a skill like this:
ok… i don’t want this project to use live components ever. Build a skill that has a generalized version of this pattern. Add potential text triggers to that skill. Live component, statefull component, and anything else you think should trigger this skill.