fork download
  1. ;--------------------------------------------------------------------------
  2. ; Program: driver.lsp
  3. ; Authors: Paul D. Wiedemeier, Ph.D. and YOUR NAME HERE
  4. ; Organization: The University of Louisiana at Monroe
  5. ; Class: CSCI 3010, Spring 2012
  6. ; Assignment: Assignment 3
  7. ; Due Date: Thursday, April 19th, 2012
  8. ;
  9. ; Description: This program computes ...
  10. ;
  11. ; Honor Statement: My signature below attests to the fact that I have
  12. ; neither given nor received aid on this project.
  13. ;
  14. ; X _____________________________________________________________________
  15. ;
  16. ;--------------------------------------------------------------------------
  17.  
  18.  
  19. ;--------------------------------------------------------------------------
  20. ; Function: (MS2ML string)
  21. ; Author: Paul D. Wiedemeier, Ph.D.
  22. ;
  23. ; Description: This function is called with a single string argument.
  24. ; It converst the string into a list. It returns a list.
  25. ;
  26. ;--------------------------------------------------------------------------
  27. (defun MS2ML (mazeString)
  28. (setq mazeList ())
  29. (reverse
  30. (dotimes (i (length mazeString) mazeList)
  31. (cond
  32. ( (eq #\A (aref mazeString i))
  33. (setq mazeList (cons 'A mazeList))
  34. )
  35. ( (eq #\B (aref mazeString i))
  36. (setq mazeList (cons 'B mazeList))
  37. )
  38. ( t
  39. (setq mazeList (cons 'C mazeList)) ; (eq #\C (aref mazeString i))
  40. )
  41. )
  42. )
  43. )
  44. ) ; end MS2ML
  45.  
  46.  
  47. ;--------------------------------------------------------------------------
  48. ; Function: (ML2EL list)
  49. ; Author: YOUR NAME HERE
  50. ;
  51. ; Description:
  52. ;
  53. ;--------------------------------------------------------------------------
  54. (defun ML2EL (mazeList)
  55. (setq engList ())
  56. (reverse
  57. (dotimes (i (length mazeList) engList)
  58. (setq n 0)
  59. (cond
  60. ((eq 'A (nth n mazeList))
  61. (setq engList (cons 'F engList))
  62. );end first condition
  63. ((eq 'B (nth n mazeList))
  64. (setq engList (cons 'L engList))
  65. );end sedond condition
  66. ( t
  67. (setq engList (cons 'R engList))
  68. );end t condition
  69. );end cond
  70. (incf n);increment variable
  71. );end dotimes
  72. );end reverse
  73. ) ; end ML2EL
  74.  
  75.  
  76. ;--------------------------------------------------------------------------
  77. ; Function: (EL2ES list)
  78. ; Author: YOUR NAME HERE
  79. ;
  80. ; Description:
  81. ;
  82. ;--------------------------------------------------------------------------
  83. (defun EL2ES (engList)
  84. (setq engString "")
  85. (dotimes (i (length engList) engString)
  86. (cond
  87. ((eq (nth i engList) "F")
  88. (setq engString (concatenate 'string engString "F"))
  89. )
  90. ((eq (nth i engList) "L")
  91. (setq engString (concatenate 'string engString "L"))
  92. )
  93. (t
  94. (setq engString (concatenate 'string engString "R"))
  95. );end t
  96. );end cond
  97. );end dotimes
  98. ) ; end EL2ES
  99.  
  100.  
  101. ;--------------------------------------------------------------------------
  102. ; Function: main driver
  103. ; Author: Paul D. Wiedemeier, Ph.D.
  104. ;
  105. ; Description: This function is called without arguments and
  106. ; ultimately returns a string that represents the
  107. ; the English translation of a Mazelandian string.
  108. ;
  109. ;--------------------------------------------------------------------------
  110. (print
  111. (EL2ES
  112. (ML2EL
  113. (MS2ML
  114. "ABCABC"
  115. )
  116. )
  117. )
  118. ) ; end main driver
Success #stdin #stdout 0.03s 10592KB
stdin
Standard input is empty
stdout
"RRRRRR"