Published: 09 May 2018 › Updated: 09 May 2018
ANSWER: LISP recursion using car/cdr
- Question: https://stackoverflow.com/questions/50243523
- Snapshot:
- See detailed step by step solution: https://github.com/sundawning/literate-programming/blob/master/english-to-nato-and-vice-verse.org
- Why answer this homework?
Why not. - Answer(There is actually no final answer, many places in the code can be improved.)
(defun natos-englishs () (list '(Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey Xray Zulu) '(A B C D E F G H I J K L M N O P Q R S T U V W X Z))) (defun convert-nato-english (item) (destructuring-bind (natos englishs) (natos-englishs) (cond ((member item natos) (nth (position item natos) englishs)) ((member item englishs) (nth (position item englishs) natos)) (t (error "Unvalid"))))) (defun -mapcar (function list) (if (null list) nil (cons (funcall function (car list)) (-mapcar function (cdr list))))) (defun format-lists (function lists) (format nil "~{~{~A~}~^ ~}" (-mapcar (lambda (list) (-mapcar function list)) lists))) (defun conve (english-lists) (format-lists (lambda (english) (string-capitalize (write-to-string (convert-nato-english english)))) english-lists)) (defun convn (nato-lists) (format-lists (lambda (nato) (write-to-string (convert-nato-english nato) :case :downcase)) nato-lists))(list (conve '((P R O) (L A N))) (convn '((Papa Romeo Oscar) (Lima Alfa November))))("PapaRomeoOscar LimaAlfaNovember" "pro lan")
Leave ANSWER: LISP recursion using car/cdr to:
Read more #common-lisp posts
Best Posts From SunDawning
We have not curated any of sundawning's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From SunDawning
- javascript - Draw a circle (not shaded) with Three.js - Stack Overflow
- GitHub 上这几个沙雕项目,够我玩几天 - 推酷
- 我们真的需要 144Hz 甚至 240Hz 屏幕的手机吗? - 推酷
- 安卓单机游戏_游戏狗
- GitHub Actions 教程:定时发送天气邮件 - 推酷
- 视频网站VIP超前点播服务被批,角度不同,差异很大 - 推酷
- 腾讯硬核干货!如何在页面极速渲染3D模型? - 推酷
- 代写服务5元起步 毕业生包装简历后面跟着多少坑? - 推酷
- 南昌近期屡现网络兼职陷阱 -网络,兼职-大江网
- 离精简版Win7远点 - Windows7之家,Win7之家