CS 351 Programming Languages
SP 18 Due Wednesday May 9 by 3 PM Lisp Programming Assignment Specifications
Write a program using Common Lisp that converts a phrase in English to NATO code, and
converts a phrase in NATO code to English. The NATO phonetic alphabet is useful to pre-
vent spelling mistakes or miscommunication, especially when people from different countries
with different accents and pronunciations work together. The NATO alphabet became effec-
tive in 1956 and, a few years later, turned into the established universal phonetic alphabet
for all military, civilian and amateur radio communications. It assigns a word to each letter so
that a letter’s name begins with the letter itself. (https://www.nato.int/cps/en/natohq/news 150391.htm). The table below shows the NATO code for each of the 26 letters in the English alphabet.
- A Alfa
- B Bravo
- C Charlie
- D Delta
- E Echo
- F Foxtrot
- G Golf
- H Hotel
- I India
- J Juliet
- K Kilo
- L Lima
- M Mike
- N November
- O Oscar
- P Papa
- Q Quebec
- R Romeo
- S Sierra
- T Tango
- U Uniform
- V Victor
- W Whiskey
- X Xray
Z Zulu
1
Your program must include two functions called: 1) conve, which takes as input a phrase as a list in English and displays its NATO code as a string not a list. 2) convn, which takes as input a phrase as a list in NATO code and displays plain text in English as a string.
- Your program must run with the function conve and the function convn.
- Your input must be read and processed recursively as a list.
- Each word in the phrase must be a sublist of the list. For example to convert from English to NATO code the phrase programming languages, the input must be the list
((P R O G R A M M I N G) (L A N G U A G E S))
The output should be
PapaRomeoOscarGolfRomeoAlfaMikeMikeIndiaNovemberGolf LimaAlfaNovem- berGolfUniformAlfaGolfEchoSierra
To convert NATO code to English the input must be the list
((Papa Romeo Oscar Golf Romeo Alfa Mike Mike India November Golf) (Lima Alfa November Golf Uniform Alfa Golf Echo Sierra))
The output should be programming languages.
- Your program must be able to process any phrase.
- Your program must use only recursion.
- Do not use “assignment” statements.
- No variables, arrays, loops, progn allowed.
- The output must be a string not a list.
- You must write your own functions whenever possible, instead of using built-in func-
tions.
- Code copied from the Internet will be considered an instance of plagiarism and it will be treated as such following University policy.
2
Deliverables
- Add a comment in your program with your full name.
- Called your lisp file using your last name. For example, guillen.lsp
- Upload your file to Cougar Courses by Wednesday May 9 before 3 PM. Otherwise, Cougar Courses will close submissions and I will not accept emailed assignments.
- Follow instructions to receive full credit.
3