;--------------------------------------------------------------------------
; Program: driver.lsp
; Authors: Paul D. Wiedemeier, Ph.D. and YOUR NAME HERE
; Organization: The University of Louisiana at Monroe
; Class: CSCI 3010, Spring 2012
; Assignment: Assignment 3
; Due Date: Thursday, April 19th, 2012
;
; Description: This program computes ...
;
; Honor Statement: My signature below attests to the fact that I have
; neither given nor received aid on this project.
;
; X _____________________________________________________________________
;
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
; Function: (MS2ML string)
; Author: Paul D. Wiedemeier, Ph.D.
;
; Description: This function is called with a single string argument.
; It converst the string into a list. It returns a list.
;
;--------------------------------------------------------------------------
(defun MS2ML (mazeString)
(setq mazeList ())
(reverse
(dotimes (i (length mazeString) mazeList)
(cond
( (eq #\A (aref mazeString i))
(setq mazeList (cons 'A mazeList))
)
( (eq #\B (aref mazeString i))
(setq mazeList (cons 'B mazeList))
)
( t
(setq mazeList (cons 'C mazeList)) ; (eq #\C (aref mazeString i))
)
)
)
)
) ; end MS2ML
;--------------------------------------------------------------------------
; Function: (ML2EL list)
; Author: YOUR NAME HERE
;
; Description:
;
;--------------------------------------------------------------------------
(defun ML2EL (mazeList)
(setq engList ())
(reverse
(dotimes (i (length mazeList) engList)
(cond
((eq 'A (nth 2 mazeList))
(setq engList (cons 'F engList))
);end first condition
((eq 'B (nth 2 mazeList))
(setq engList (cons 'L engList))
);end sedond condition
( t
(setq engList (cons 'R engList))
);end t condition
);end cond
);end dotimes
);end reverse
) ; end ML2EL
;--------------------------------------------------------------------------
; Function: (EL2ES list)
; Author: YOUR NAME HERE
;
; Description:
;
;--------------------------------------------------------------------------
(defun EL2ES (engList)
(setq engString "") (setq n 0)
(dotimes (i (length engList) engString)
(cond
((eq (nth n engList) "F")
(setq engString (concatenate 'string engString "F"))
)
((eq (nth n engList) "L")
(setq engString (concatenate 'string engString "L"))
)
(t
(setq engString (concatenate 'string engString "R"))
);end t
);end cond
(incf n);increment variable
);end dotimes
) ; end EL2ES
;--------------------------------------------------------------------------
; Function: main driver
; Author: Paul D. Wiedemeier, Ph.D.
;
; Description: This function is called without arguments and
; ultimately returns a string that represents the
; the English translation of a Mazelandian string.
;
;--------------------------------------------------------------------------
(print
(EL2ES
(ML2EL
(MS2ML
"ABCABC"
)
)
)
) ; end main driver