Created
September 25, 2022 19:49
-
-
Save vKxni/db3efa40e9f6b7bf108a70aa49921254 to your computer and use it in GitHub Desktop.
Hearten with the Kernel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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