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. (cond
  59. ((eq 'A (nth 2 mazeList))
  60. (setq engList (cons 'F engList))
  61. );end first condition
  62. ((eq 'B (nth 2 mazeList))
  63. (setq engList (cons 'L engList))
  64. );end sedond condition
  65. ( t
  66. (setq engList (cons 'R engList))
  67. );end t condition
  68. );end cond
  69. );end dotimes
  70. );end reverse
  71. ) ; end ML2EL
  72.  
  73.  
  74. ;--------------------------------------------------------------------------
  75. ; Function: (EL2ES list)
  76. ; Author: YOUR NAME HERE
  77. ;
  78. ; Description:
  79. ;
  80. ;--------------------------------------------------------------------------
  81. (defun EL2ES (engList)
  82. (setq engString "") (setq n 0)
  83. (dotimes (i (length engList) engString)
  84. (cond
  85. ((eq (nth n engList) "F")
  86. (setq engString (concatenate 'string engString "F"))
  87. )
  88. ((eq (nth n engList) "L")
  89. (setq engString (concatenate 'string engString "L"))
  90. )
  91. (t
  92. (setq engString (concatenate 'string engString "R"))
  93. );end t
  94. );end cond
  95. (incf n);increment variable
  96. );end dotimes
  97. ) ; end EL2ES
  98.  
  99.  
  100. ;--------------------------------------------------------------------------
  101. ; Function: main driver
  102. ; Author: Paul D. Wiedemeier, Ph.D.
  103. ;
  104. ; Description: This function is called without arguments and
  105. ; ultimately returns a string that represents the
  106. ; the English translation of a Mazelandian string.
  107. ;
  108. ;--------------------------------------------------------------------------
  109. (print
  110. ;(EL2ES
  111. (ML2EL
  112. (MS2ML
  113. "ABCABC"
  114. )
  115. )
  116. ;)
  117. ) ; end main driver
Success #stdin #stdout 0.02s 10592KB
stdin
Standard input is empty
stdout
(R R R R R R)