A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Capitalize in Lisp page! Here, you'll find the source code for this program as well as a description of how the program works.
;;Taken from the Common Lisp Cookbook Project (strings page)
(defun split-string (string)
(loop for i = 0 then (1+ j)
as j = (position #\Space string :start i)
collect (subseq string i j)
while j))
(defun join-string (lst)
(when lst
(concatenate 'string (car lst) " " (join-string (cdr lst)))))
(defun capitalize (str)
(concatenate 'string
(string-upcase (subseq str 0 1)) (subseq str 1)))
(defparameter input (split-string (cadr *posix-argv*)))
(cond
((= (length (car input)) 0) (write-line "Usage: please provide a string"))
(t (write-line (join-string (cons (capitalize (car input)) (cdr input))))))
Capitalize in Lisp was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.