Skip to content

Instantly share code, notes, and snippets.

@vKxni
Created September 25, 2022 19:49
Show Gist options
  • Save vKxni/db3efa40e9f6b7bf108a70aa49921254 to your computer and use it in GitHub Desktop.
Save vKxni/db3efa40e9f6b7bf108a70aa49921254 to your computer and use it in GitHub Desktop.
Hearten with the Kernel
defmodule Heart do
def first_letter(name) do
name
|> String.trim()
|> String.first()
end
def initial(name) do
name
|> first_letter()
|> String.upcase()
|> Kernel.<>(".")
end
def initials(full_name) do
[fst, snd] = String.split(full_name)
initial(fst) <> " " <> initial(snd)
end
def pair(full_name1, full_name2) do
fs = initials(full_name1)
sn = initials(full_name2)
"""
****** ******
** ** ** **
** ** ** **
** * **
** **
** #{fs} + #{sn} **
** **
** **
** **
** **
** **
** **
***
*
"""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment