moduleMainexposing(main)importHtmlexposing(Html,p,text,div)likes:ListString->Stringlikesnames=casenamesof[]->"no one likes this"name::[]->name++" likes this"first::second::[]->first++" and "++second++" like this"first::second::third::[]->first++", "++second++" and "++third++" like this"first::second::rest->first++", "++second++" and "++(String.fromInt<|List.lengthrest)++" others like this"main:Htmlactionsmain=div[][p[][text<|likes[]]-- no one likes this,p[][text<|likes["Peter"]]-- Peter likes this,p[][text<|likes["Jacob","Alex"]]-- Jacob and Alex like this,p[][text<|likes["Max","John","Mark"]]-- Max, John and Mark like this,p[][text<|likes["Alex","Jacob","Mark","Max"]]-- Alex, Jacob and 2 others like this]
My take at the challenge written in Elm.
Source-code
Try it online
On Ellie App.