Added string operation 'last' and 'reverse'

This commit is contained in:
Jaidyn Lev 2018-12-09 21:52:25 -06:00
parent 357e85cfb9
commit 3e74cb14c8
4 changed files with 18 additions and 2 deletions

View File

@ -60,6 +60,7 @@
:word-cdddar :word-cdar :word-cdaaar :word-cddddr :word-cdddr
:word-cdaadr :word-cdadar :word-cddadr :word-cdaddr :word-cdadr
:word-cddar :word-cddr :word-cddaar :word-cdaar
:word-last :word-reverse
;; STRING/LINE
@ -84,6 +85,7 @@
:line-cdddar :line-cdar :line-cdaaar :line-cddddr :line-cdddr
:line-cdaadr :line-cdadar :line-cddadr :line-cdaddr :line-cdadr
:line-cddar :line-cddr :line-cddaar :line-cdaar
:line-last :line-reverse
;; STRING/CHAR
@ -106,6 +108,7 @@
:char-cdddar :char-cdar :char-cdaaar :char-cddddr :char-cdddr
:char-cdaadr :char-cdadar :char-cddadr :char-cdaddr :char-cdadr
:char-cddar :char-cddr :char-cddaar :char-cdaar
:char-last :char-reverse
;; LIST

View File

@ -21,8 +21,12 @@
"Convert a list of chars into a string"
(cond
((eq (length char-list) 1)
(string (car char-list)))
((eq 'STANDARD-CHAR (type-of char-list))
(format nil "~A" char-list))
((eq 1 (length char-list))
(format nil "~A" (car char-list)))
('T
(reduce
(lambda (char-a char-b)
@ -121,3 +125,6 @@
(create-string-manip char-cddr #'nih:char-list #'nih:char-string #'cddr)
(create-string-manip char-cddaar #'nih:char-list #'nih:char-string #'cddaar)
(create-string-manip char-cdaar #'nih:char-list #'nih:char-string #'cdaar)
(create-string-manip char-last #'nih:char-list #'nih:char-string #'last)
(create-string-manip char-reverse #'nih:char-list #'nih:char-string #'reverse)

View File

@ -117,3 +117,6 @@
(create-string-manip line-cddr #'nih:line-list #'nih:line-string #'cddr)
(create-string-manip line-cddaar #'nih:line-list #'nih:line-string #'cddaar)
(create-string-manip line-cdaar #'nih:line-list #'nih:line-string #'cdaar)
(create-string-manip line-reverse #'nih:line-list #'nih:line-string #'reverse)
(create-string-manip line-last #'nih:line-list #'nih:line-string #'last)

View File

@ -116,3 +116,6 @@
(create-string-manip word-cddr #'nih:word-list #'nih:word-string #'cddr)
(create-string-manip word-cddaar #'nih:word-list #'nih:word-string #'cddaar)
(create-string-manip word-cdaar #'nih:word-list #'nih:word-string #'cdaar)
(create-string-manip word-reverse #'nih:word-list #'nih:word-string #'reverse)
(create-string-manip word-last #'nih:word-list #'nih:word-string #'last)