;; use mapcar to apply lambda function to each element in the list 'lst'
(defun times-3-list (lst)
  (mapcar #'(lambda (x) (* 3 x)) lst)) 
;; a recursive solution
;; CONS the first elment of the list with a recusive call to the rest of the list
(defun times-3-list2 (lst)
  (cond ((null lst) nil)
	(t (cons (* 3 (car lst)) (times-3-list2 (cdr lst))))))
;; a recursive solution
;; just CONS the CONS of the CONS of the first item with the result on the 
;; rest of the list
(defun 3-times-list (lst)
  (cond ((null lst) nil)
	(t (cons  (first lst) (cons (first lst) (cons (first lst) (3-times-list (rest lst))))))))
;; an iterative solution
(defun 3-times-list2 (lst)
  (let ((nLst nil) triplet)
    (dolist (elm lst nLst)
	    (setq triplet (list elm elm elm))
	    (setq nLst (append nLst triplet)))))
;; "iterative" solution using mapcar 
(defun parenthesize-each (lst)
  (mapcar #'(lambda (x) (cons x nil)) lst))
;; recursive solution
(defun parenthesize-each2 (lst)
  (cond((null lst) NIL)
       (t(cons(cons (first lst) nil) (parenthesize-each(cdr lst))) )) )  
;; recursive colution using IF
(defun nest-deeply (lst) 
     (if (null (rest lst)) lst 
     (cons (first lst) (cons (nest-deeply (rest lst)) NIL)) ) ) 

;; an interative solution to this problem is messy, so
;; here is another recursive solution
(defun nest-deeply2 (lst) 
 (cond ((null lst) nil) 
       ((null (cdr lst)) (cons (car lst) (nest-deeply2 (cdr lst) ))) 
       ((cons (car lst) (cons (nest-deeply2 (cdr lst)) nil ))) ))