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 n mazeList))
  60. (setq engList (cons 'F engList))
  61. );end first condition
  62. ((eq 'B (nth n 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 "")
  83. (dotimes (i (length engList) engString)
  84. (setq n 1)
  85. (cond
  86. ((eq (nth n engList) "F")
  87. (setq engString (concatenate 'string engString "F"))
  88. )
  89. ((eq (nth n engList) "L")
  90. (setq engString (concatenate 'string engString "L"))
  91. )
  92. (t
  93. (setq engString (concatenate 'string engString "R"))
  94. );end t
  95. );end cond
  96. (incf n);increment variable
  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
Runtime error #stdin #stdout 0.04s 10840KB
stdin
Standard input is empty
stdout
Standard output is empty