Convert a phrase to its acronym.
Techies love their TLA (Three Letter Acronyms)!
Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG).
Julien Vanier https://github.com/monkbroc
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
module Test.Main where import Prelude import Test.Unit.Assert as Assert import Acronym (abbreviate) import Control.Monad.Eff (Eff) import Control.Monad.Eff.AVar (AVAR) import Control.Monad.Eff.Console (CONSOLE) import Test.Unit (TestSuite, suite, test) import Test.Unit.Console (TESTOUTPUT) import Test.Unit.Main (runTest) main :: forall eff . Eff ( avar :: AVAR , console :: CONSOLE , testOutput :: TESTOUTPUT | eff ) Unit main = runTest suites suites :: forall e. TestSuite e suites = do suite "Acronym.abbreviate" do test "acronyms from title case" $ Assert.equal "PNG" $ abbreviate "Portable Networks Graphic" test "acronyms from lower case" $ Assert.equal "ROR" $ abbreviate "Ruby on Rails" test "acronyms from inconsistent case" $ Assert.equal "HTML" $ abbreviate "HyperText Markup Language" test "punctuation is ignored" $ Assert.equal "FIFO" $ abbreviate "First in, First out" test "acronyms ignoring punctuation and casing" $ Assert.equal "CMOS" $ abbreviate "Complementary Metal-Oxide semiconductor"
module Acronym ( abbreviate ) where import Prelude import Data.Array as A import Data.Char as C import Data.Char.Unicode as U import Data.Maybe ( Maybe(..) ) import Data.String as String import Data.Tuple ( Tuple(..) ) abbreviate string = let (Tuple abbr _) = A.foldl step (Tuple  ) $ String.toCharArray string in String.toUpper $ String.fromCharArray abbr step (Tuple abbr last) c | U.isLetter c && last ==  = Tuple (A.snoc abbr c) [c] | U.isLower c = Tuple abbr [c] | U.isSpace c = Tuple abbr  | U.isUpper c && last /=  = Tuple (A.snoc abbr c) [c] | otherwise = Tuple abbr 
A huge amount can be learned from reading other people’s code. This is why we wanted to give exercism users the option of making their solutions public.
Here are some questions to help you reflect on this solution and learn the most from it.