passagemath-ecl 10.6.33__cp312-cp312-macosx_13_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-ecl might be problematic. Click here for more details.

Files changed (221) hide show
  1. ecl/kenzo.fas +0 -0
  2. ecl/maxima.fas +0 -0
  3. passagemath_ecl-10.6.33.dist-info/METADATA +137 -0
  4. passagemath_ecl-10.6.33.dist-info/METADATA.bak +138 -0
  5. passagemath_ecl-10.6.33.dist-info/RECORD +221 -0
  6. passagemath_ecl-10.6.33.dist-info/WHEEL +6 -0
  7. passagemath_ecl-10.6.33.dist-info/top_level.txt +2 -0
  8. passagemath_ecl.dylibs/libecl.24.5.10.dylib +0 -0
  9. passagemath_ecl.dylibs/libffi.8.dylib +0 -0
  10. passagemath_ecl.dylibs/libgc.1.dylib +0 -0
  11. passagemath_ecl.dylibs/libgmp.10.dylib +0 -0
  12. sage/all__sagemath_ecl.py +4 -0
  13. sage/interfaces/all__sagemath_ecl.py +1 -0
  14. sage/interfaces/lisp.py +576 -0
  15. sage/libs/all__sagemath_ecl.py +1 -0
  16. sage/libs/ecl.cpython-312-darwin.so +0 -0
  17. sage/libs/ecl.pxd +170 -0
  18. sage/libs/ecl.pyx +1360 -0
  19. sage/libs/eclsig.h +110 -0
  20. sage_wheels/bin/ecl +0 -0
  21. sage_wheels/lib/ecl-24.5.10/COPYING +502 -0
  22. sage_wheels/lib/ecl-24.5.10/LICENSE +41 -0
  23. sage_wheels/lib/ecl-24.5.10/TAGS +0 -0
  24. sage_wheels/lib/ecl-24.5.10/asdf.fas +0 -0
  25. sage_wheels/lib/ecl-24.5.10/build-stamp +7 -0
  26. sage_wheels/lib/ecl-24.5.10/cmp.asd +5 -0
  27. sage_wheels/lib/ecl-24.5.10/cmp.fas +0 -0
  28. sage_wheels/lib/ecl-24.5.10/deflate.asd +5 -0
  29. sage_wheels/lib/ecl-24.5.10/deflate.fas +0 -0
  30. sage_wheels/lib/ecl-24.5.10/defsystem.asd +5 -0
  31. sage_wheels/lib/ecl-24.5.10/defsystem.fas +0 -0
  32. sage_wheels/lib/ecl-24.5.10/dpp +0 -0
  33. sage_wheels/lib/ecl-24.5.10/ecl-cdb.asd +5 -0
  34. sage_wheels/lib/ecl-24.5.10/ecl-cdb.fas +0 -0
  35. sage_wheels/lib/ecl-24.5.10/ecl-curl.asd +5 -0
  36. sage_wheels/lib/ecl-24.5.10/ecl-curl.fas +0 -0
  37. sage_wheels/lib/ecl-24.5.10/ecl-help.asd +5 -0
  38. sage_wheels/lib/ecl-24.5.10/ecl-help.fas +0 -0
  39. sage_wheels/lib/ecl-24.5.10/ecl-quicklisp.asd +5 -0
  40. sage_wheels/lib/ecl-24.5.10/ecl-quicklisp.fas +0 -0
  41. sage_wheels/lib/ecl-24.5.10/ecl_min +0 -0
  42. sage_wheels/lib/ecl-24.5.10/encodings/arabic +1 -0
  43. sage_wheels/lib/ecl-24.5.10/encodings/ascii +1 -0
  44. sage_wheels/lib/ecl-24.5.10/encodings/asmo-708 +1 -0
  45. sage_wheels/lib/ecl-24.5.10/encodings/atarist.bin +0 -0
  46. sage_wheels/lib/ecl-24.5.10/encodings/cp-856.bin +0 -0
  47. sage_wheels/lib/ecl-24.5.10/encodings/cp819 +1 -0
  48. sage_wheels/lib/ecl-24.5.10/encodings/cp850 +1 -0
  49. sage_wheels/lib/ecl-24.5.10/encodings/cp862 +1 -0
  50. sage_wheels/lib/ecl-24.5.10/encodings/cp866 +1 -0
  51. sage_wheels/lib/ecl-24.5.10/encodings/cp932 +1 -0
  52. sage_wheels/lib/ecl-24.5.10/encodings/cp936 +1 -0
  53. sage_wheels/lib/ecl-24.5.10/encodings/cp949 +1 -0
  54. sage_wheels/lib/ecl-24.5.10/encodings/cp950 +1 -0
  55. sage_wheels/lib/ecl-24.5.10/encodings/cyrillic +1 -0
  56. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp437.bin +0 -0
  57. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp737.bin +0 -0
  58. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp775.bin +0 -0
  59. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp850.bin +0 -0
  60. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp852.bin +0 -0
  61. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp855.bin +0 -0
  62. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp857.bin +0 -0
  63. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp860.bin +0 -0
  64. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp861.bin +0 -0
  65. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp862.bin +0 -0
  66. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp863.bin +0 -0
  67. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp864.bin +0 -0
  68. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp865.bin +0 -0
  69. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp866.bin +0 -0
  70. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp869.bin +0 -0
  71. sage_wheels/lib/ecl-24.5.10/encodings/dos-cp874.bin +0 -0
  72. sage_wheels/lib/ecl-24.5.10/encodings/ecma-114 +1 -0
  73. sage_wheels/lib/ecl-24.5.10/encodings/ecma-118 +1 -0
  74. sage_wheels/lib/ecl-24.5.10/encodings/greek +1 -0
  75. sage_wheels/lib/ecl-24.5.10/encodings/greek8 +1 -0
  76. sage_wheels/lib/ecl-24.5.10/encodings/hebrew +1 -0
  77. sage_wheels/lib/ecl-24.5.10/encodings/ibm437 +1 -0
  78. sage_wheels/lib/ecl-24.5.10/encodings/ibm819 +1 -0
  79. sage_wheels/lib/ecl-24.5.10/encodings/ibm850 +1 -0
  80. sage_wheels/lib/ecl-24.5.10/encodings/ibm852 +1 -0
  81. sage_wheels/lib/ecl-24.5.10/encodings/ibm855 +1 -0
  82. sage_wheels/lib/ecl-24.5.10/encodings/ibm857 +1 -0
  83. sage_wheels/lib/ecl-24.5.10/encodings/ibm860 +1 -0
  84. sage_wheels/lib/ecl-24.5.10/encodings/ibm861 +1 -0
  85. sage_wheels/lib/ecl-24.5.10/encodings/ibm862 +1 -0
  86. sage_wheels/lib/ecl-24.5.10/encodings/ibm863 +1 -0
  87. sage_wheels/lib/ecl-24.5.10/encodings/ibm864 +1 -0
  88. sage_wheels/lib/ecl-24.5.10/encodings/ibm865 +1 -0
  89. sage_wheels/lib/ecl-24.5.10/encodings/ibm866 +1 -0
  90. sage_wheels/lib/ecl-24.5.10/encodings/ibm869 +1 -0
  91. sage_wheels/lib/ecl-24.5.10/encodings/iso-2022-jp +55 -0
  92. sage_wheels/lib/ecl-24.5.10/encodings/iso-2022-jp-1 +57 -0
  93. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-1.bin +0 -0
  94. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-10.bin +0 -0
  95. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-11.bin +0 -0
  96. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-13.bin +0 -0
  97. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-14.bin +0 -0
  98. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-15.bin +0 -0
  99. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-16.bin +0 -0
  100. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-2.bin +0 -0
  101. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-3.bin +0 -0
  102. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-4.bin +0 -0
  103. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-5.bin +0 -0
  104. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-6.bin +0 -0
  105. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-7.bin +0 -0
  106. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-8.bin +0 -0
  107. sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-9.bin +0 -0
  108. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-1 +1 -0
  109. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-10 +1 -0
  110. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-13 +1 -0
  111. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-14 +1 -0
  112. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-15 +1 -0
  113. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-2 +1 -0
  114. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-3 +1 -0
  115. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-4 +1 -0
  116. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-5 +1 -0
  117. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-6 +1 -0
  118. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-7 +1 -0
  119. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-8 +1 -0
  120. sage_wheels/lib/ecl-24.5.10/encodings/iso8859-9 +1 -0
  121. sage_wheels/lib/ecl-24.5.10/encodings/jisx0201.bin +0 -0
  122. sage_wheels/lib/ecl-24.5.10/encodings/jisx0208.bin +0 -0
  123. sage_wheels/lib/ecl-24.5.10/encodings/jisx0212.bin +0 -0
  124. sage_wheels/lib/ecl-24.5.10/encodings/koi8-r.bin +0 -0
  125. sage_wheels/lib/ecl-24.5.10/encodings/koi8-u.bin +0 -0
  126. sage_wheels/lib/ecl-24.5.10/encodings/koi8r +1 -0
  127. sage_wheels/lib/ecl-24.5.10/encodings/latin-1 +1 -0
  128. sage_wheels/lib/ecl-24.5.10/encodings/latin-2 +1 -0
  129. sage_wheels/lib/ecl-24.5.10/encodings/latin-3 +1 -0
  130. sage_wheels/lib/ecl-24.5.10/encodings/latin-4 +1 -0
  131. sage_wheels/lib/ecl-24.5.10/encodings/latin-5 +1 -0
  132. sage_wheels/lib/ecl-24.5.10/encodings/latin-6 +1 -0
  133. sage_wheels/lib/ecl-24.5.10/encodings/latin-7 +1 -0
  134. sage_wheels/lib/ecl-24.5.10/encodings/latin-8 +1 -0
  135. sage_wheels/lib/ecl-24.5.10/encodings/latin-9 +1 -0
  136. sage_wheels/lib/ecl-24.5.10/encodings/latin2 +1 -0
  137. sage_wheels/lib/ecl-24.5.10/encodings/latin3 +1 -0
  138. sage_wheels/lib/ecl-24.5.10/encodings/latin4 +1 -0
  139. sage_wheels/lib/ecl-24.5.10/encodings/latin5 +1 -0
  140. sage_wheels/lib/ecl-24.5.10/encodings/latin6 +1 -0
  141. sage_wheels/lib/ecl-24.5.10/encodings/latin7 +1 -0
  142. sage_wheels/lib/ecl-24.5.10/encodings/latin8 +1 -0
  143. sage_wheels/lib/ecl-24.5.10/encodings/latin9 +1 -0
  144. sage_wheels/lib/ecl-24.5.10/encodings/ms-ansi +1 -0
  145. sage_wheels/lib/ecl-24.5.10/encodings/ms-arab +1 -0
  146. sage_wheels/lib/ecl-24.5.10/encodings/ms-cyrl +1 -0
  147. sage_wheels/lib/ecl-24.5.10/encodings/ms-ee +1 -0
  148. sage_wheels/lib/ecl-24.5.10/encodings/ms-greek +1 -0
  149. sage_wheels/lib/ecl-24.5.10/encodings/ms-hebr +1 -0
  150. sage_wheels/lib/ecl-24.5.10/encodings/ms-turk +1 -0
  151. sage_wheels/lib/ecl-24.5.10/encodings/shift-jis.bin +0 -0
  152. sage_wheels/lib/ecl-24.5.10/encodings/tools.lisp +202 -0
  153. sage_wheels/lib/ecl-24.5.10/encodings/ucs2 +1 -0
  154. sage_wheels/lib/ecl-24.5.10/encodings/ucs2be +1 -0
  155. sage_wheels/lib/ecl-24.5.10/encodings/ucs2le +1 -0
  156. sage_wheels/lib/ecl-24.5.10/encodings/ucs4 +1 -0
  157. sage_wheels/lib/ecl-24.5.10/encodings/ucs4be +1 -0
  158. sage_wheels/lib/ecl-24.5.10/encodings/ucs4le +1 -0
  159. sage_wheels/lib/ecl-24.5.10/encodings/unicode +1 -0
  160. sage_wheels/lib/ecl-24.5.10/encodings/utf-16 +1 -0
  161. sage_wheels/lib/ecl-24.5.10/encodings/utf-16be +1 -0
  162. sage_wheels/lib/ecl-24.5.10/encodings/utf-16le +1 -0
  163. sage_wheels/lib/ecl-24.5.10/encodings/utf-32 +1 -0
  164. sage_wheels/lib/ecl-24.5.10/encodings/utf-32be +1 -0
  165. sage_wheels/lib/ecl-24.5.10/encodings/utf-32le +1 -0
  166. sage_wheels/lib/ecl-24.5.10/encodings/utf16 +1 -0
  167. sage_wheels/lib/ecl-24.5.10/encodings/utf32 +1 -0
  168. sage_wheels/lib/ecl-24.5.10/encodings/utf8 +1 -0
  169. sage_wheels/lib/ecl-24.5.10/encodings/winbaltrim +1 -0
  170. sage_wheels/lib/ecl-24.5.10/encodings/windows-1250 +1 -0
  171. sage_wheels/lib/ecl-24.5.10/encodings/windows-1251 +1 -0
  172. sage_wheels/lib/ecl-24.5.10/encodings/windows-1252 +1 -0
  173. sage_wheels/lib/ecl-24.5.10/encodings/windows-1253 +1 -0
  174. sage_wheels/lib/ecl-24.5.10/encodings/windows-1254 +1 -0
  175. sage_wheels/lib/ecl-24.5.10/encodings/windows-1255 +1 -0
  176. sage_wheels/lib/ecl-24.5.10/encodings/windows-1256 +1 -0
  177. sage_wheels/lib/ecl-24.5.10/encodings/windows-1257 +1 -0
  178. sage_wheels/lib/ecl-24.5.10/encodings/windows-1258 +1 -0
  179. sage_wheels/lib/ecl-24.5.10/encodings/windows-932 +1 -0
  180. sage_wheels/lib/ecl-24.5.10/encodings/windows-936 +1 -0
  181. sage_wheels/lib/ecl-24.5.10/encodings/windows-949 +1 -0
  182. sage_wheels/lib/ecl-24.5.10/encodings/windows-950 +1 -0
  183. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1250.bin +0 -0
  184. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1251.bin +0 -0
  185. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1252.bin +0 -0
  186. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1253.bin +0 -0
  187. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1254.bin +0 -0
  188. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1255.bin +0 -0
  189. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1256.bin +0 -0
  190. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1257.bin +0 -0
  191. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1258.bin +0 -0
  192. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp932.bin +0 -0
  193. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp936.bin +0 -0
  194. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp949.bin +0 -0
  195. sage_wheels/lib/ecl-24.5.10/encodings/windows-cp950.bin +0 -0
  196. sage_wheels/lib/ecl-24.5.10/help.doc +0 -0
  197. sage_wheels/lib/ecl-24.5.10/libasdf.a +0 -0
  198. sage_wheels/lib/ecl-24.5.10/libcmp.a +0 -0
  199. sage_wheels/lib/ecl-24.5.10/libdeflate.a +0 -0
  200. sage_wheels/lib/ecl-24.5.10/libdefsystem.a +0 -0
  201. sage_wheels/lib/ecl-24.5.10/libecl-cdb.a +0 -0
  202. sage_wheels/lib/ecl-24.5.10/libecl-curl.a +0 -0
  203. sage_wheels/lib/ecl-24.5.10/libecl-help.a +0 -0
  204. sage_wheels/lib/ecl-24.5.10/libecl-quicklisp.a +0 -0
  205. sage_wheels/lib/ecl-24.5.10/libpackage-locks.a +0 -0
  206. sage_wheels/lib/ecl-24.5.10/libql-minitar.a +0 -0
  207. sage_wheels/lib/ecl-24.5.10/libsb-bsd-sockets.a +0 -0
  208. sage_wheels/lib/ecl-24.5.10/libserve-event.a +0 -0
  209. sage_wheels/lib/ecl-24.5.10/libsockets.a +0 -0
  210. sage_wheels/lib/ecl-24.5.10/package-locks.asd +5 -0
  211. sage_wheels/lib/ecl-24.5.10/package-locks.fas +0 -0
  212. sage_wheels/lib/ecl-24.5.10/prebuilt-asdf.asd +5 -0
  213. sage_wheels/lib/ecl-24.5.10/ql-minitar.asd +5 -0
  214. sage_wheels/lib/ecl-24.5.10/ql-minitar.fas +0 -0
  215. sage_wheels/lib/ecl-24.5.10/sb-bsd-sockets.asd +5 -0
  216. sage_wheels/lib/ecl-24.5.10/sb-bsd-sockets.fas +0 -0
  217. sage_wheels/lib/ecl-24.5.10/serve-event.asd +5 -0
  218. sage_wheels/lib/ecl-24.5.10/serve-event.fas +0 -0
  219. sage_wheels/lib/ecl-24.5.10/sockets.asd +5 -0
  220. sage_wheels/lib/ecl-24.5.10/sockets.fas +0 -0
  221. sage_wheels/lib/maxima/5.47.0/binary-ecl/maxima +0 -0
@@ -0,0 +1,576 @@
1
+ # sage_setup: distribution = sagemath-ecl
2
+ r"""
3
+ Lisp Interface
4
+
5
+ EXAMPLES::
6
+
7
+ sage: lisp.eval('(* 4 5)')
8
+ '20'
9
+ sage: a = lisp(3); b = lisp(5)
10
+ sage: a + b
11
+ 8
12
+ sage: a * b
13
+ 15
14
+ sage: a / b
15
+ 3/5
16
+ sage: a - b
17
+ -2
18
+ sage: a.sin()
19
+ 0.14112
20
+ sage: b.cos()
21
+ 0.2836622
22
+ sage: a.exp()
23
+ 20.085537
24
+ sage: lisp.eval('(+ %s %s)'%(a.name(), b.name()))
25
+ '8'
26
+
27
+ One can define functions and the interface supports object-oriented
28
+ notation for calling them::
29
+
30
+ sage: lisp.eval('(defun factorial (n) (if (= n 1) 1 (* n (factorial (- n 1)))))')
31
+ 'FACTORIAL'
32
+ sage: lisp('(factorial 10)')
33
+ 3628800
34
+ sage: lisp(10).factorial()
35
+ 3628800
36
+ sage: a = lisp(17)
37
+ sage: a.factorial()
38
+ 355687428096000
39
+
40
+ AUTHORS:
41
+ -- William Stein (first version)
42
+ -- William Stein (2007-06-20): significant improvements.
43
+ """
44
+
45
+ ##########################################################################
46
+ #
47
+ # Copyright (C) 2006 William Stein <wstein@gmail.com>
48
+ #
49
+ # Distributed under the terms of the GNU General Public License (GPL)
50
+ #
51
+ # https://www.gnu.org/licenses/
52
+ #
53
+ ##########################################################################
54
+ import os
55
+ import random
56
+
57
+ from .expect import Expect, ExpectElement, ExpectFunction, FunctionElement, gc_disabled
58
+ from sage.structure.element import RingElement, parent
59
+ from sage.misc.instancedoc import instancedoc
60
+ from sage.structure.richcmp import rich_to_bool
61
+ from sage.features.ecl import Ecl
62
+
63
+
64
+ class Lisp(Expect):
65
+ def __init__(self,
66
+ maxread=None, script_subdirectory=None,
67
+ logfile=None,
68
+ server=None,
69
+ server_tmpdir=None):
70
+ """
71
+ EXAMPLES::
72
+
73
+ sage: lisp == loads(dumps(lisp))
74
+ True
75
+ """
76
+ Expect.__init__(self,
77
+
78
+ # The capitalized version of this is used for printing.
79
+ name='Lisp',
80
+
81
+ # This is regexp of the input prompt. If you can change
82
+ # it to be very obfuscated that would be better. Even
83
+ # better is to use sequence numbers.
84
+ prompt='> ',
85
+
86
+ # This is the command that starts up your program
87
+ command=Ecl().absolute_filename(),
88
+
89
+ server=server,
90
+ server_tmpdir=server_tmpdir,
91
+ script_subdirectory=script_subdirectory,
92
+
93
+ # If this is true, then whenever the user presses Control-C to
94
+ # interrupt a calculation, the whole interface is restarted.
95
+ restart_on_ctrlc=False,
96
+
97
+ # If true, print out a message when starting
98
+ # up the command when you first send a command
99
+ # to this interface.
100
+ verbose_start=False,
101
+
102
+ logfile=logfile,
103
+
104
+ # If an input is longer than this number of characters, then
105
+ # try to switch to outputting to a file.
106
+ eval_using_file_cutoff=1024)
107
+
108
+ self.__seq = 0
109
+ self.__in_seq = 1
110
+
111
+ def eval(self, code, strip=True, **kwds):
112
+ """
113
+ EXAMPLES::
114
+
115
+ sage: lisp.eval('(+ 2 2)')
116
+ '4'
117
+
118
+ TESTS:
119
+
120
+ Verify that it works when input == output::
121
+
122
+ sage: lisp.eval('2')
123
+ '2'
124
+ """
125
+ with gc_disabled():
126
+ self._synchronize()
127
+ code = str(code)
128
+ code = code.strip()
129
+ code = code.replace('\n', ' ')
130
+ x = []
131
+ for L in code.split('\n'):
132
+ if L:
133
+ try:
134
+ s = self.__in_seq + 1
135
+ M = self._eval_line(L, wait_for_prompt=self._prompt)
136
+ if M.startswith(L + "\n"):
137
+ M = M[len(L):] # skip L in case it was echoed
138
+ x.append(M.strip())
139
+ self.__in_seq = s
140
+ except TypeError as s:
141
+ return 'error evaluating "%s":\n%s' % (code, s)
142
+ return '\n'.join(x)
143
+
144
+ def _an_element_(self):
145
+ """
146
+ EXAMPLES::
147
+
148
+ sage: lisp._an_element_()
149
+ 0
150
+ """
151
+ return self(0)
152
+
153
+ def set(self, var, value):
154
+ """
155
+ Set the variable var to the given value.
156
+
157
+ EXAMPLES::
158
+
159
+ sage: lisp.set('x', '2')
160
+ sage: lisp.get('x')
161
+ '2'
162
+
163
+ TESTS:
164
+
165
+ It must also be possible to eval the variable by name::
166
+
167
+ sage: lisp.eval('x')
168
+ '2'
169
+ """
170
+ cmd = '(setq %s %s)' % (var, value)
171
+ out = self.eval(cmd)
172
+ if '***' in out:
173
+ raise TypeError("Error executing code in Sage\nCODE:\n\t%s\nSAGE ERROR:\n\t%s" % (cmd, out))
174
+
175
+ def get(self, var):
176
+ """
177
+ EXAMPLES::
178
+
179
+ sage: lisp.set('x', '2')
180
+ sage: lisp.get('x')
181
+ '2'
182
+ """
183
+ out = self.eval(var)
184
+ return out
185
+
186
+ def _start(self, *args, **kwds):
187
+ """
188
+ EXAMPLES::
189
+
190
+ sage: l = Lisp()
191
+ sage: l.is_running()
192
+ False
193
+ sage: l._start()
194
+ sage: l.is_running()
195
+ True
196
+ """
197
+ Expect._start(self, *args, **kwds)
198
+ self.__in_seq = 1
199
+
200
+ def _synchronize(self):
201
+ E = self._expect
202
+ if E is None:
203
+ self._start()
204
+ E = self._expect
205
+ r = random.randrange(2147483647)
206
+ s = str(r + 1)
207
+ cmd = "(+ 1 %s)" % r
208
+ E.sendline(cmd)
209
+ E.expect(s)
210
+ E.expect(self._prompt)
211
+
212
+ def _repr_(self):
213
+ """
214
+ EXAMPLES::
215
+
216
+ sage: lisp
217
+ Lisp Interpreter
218
+ """
219
+ return 'Lisp Interpreter'
220
+
221
+ def __reduce__(self):
222
+ """
223
+ EXAMPLES::
224
+
225
+ sage: Lisp().__reduce__()
226
+ (<function reduce_load_Lisp at 0x...>, ())
227
+ """
228
+ return reduce_load_Lisp, tuple([])
229
+
230
+ def _function_class(self):
231
+ """
232
+ EXAMPLES::
233
+
234
+ sage: lisp._function_class()
235
+ <class 'sage.interfaces.lisp.LispFunction'>
236
+ """
237
+ return LispFunction
238
+
239
+ def _quit_string(self):
240
+ """
241
+ EXAMPLES::
242
+
243
+ sage: lisp._quit_string()
244
+ '(quit);'
245
+
246
+ sage: l = Lisp()
247
+ sage: l._start()
248
+ sage: l.quit()
249
+ sage: l.is_running()
250
+ False
251
+ """
252
+ return '(quit);'
253
+
254
+ def _read_in_file_command(self, filename):
255
+ """
256
+ EXAMPLES::
257
+
258
+ sage: lisp._read_in_file_command(tmp_filename())
259
+ Traceback (most recent call last):
260
+ ...
261
+ NotImplementedError
262
+ """
263
+ raise NotImplementedError
264
+
265
+ def kill(self, var):
266
+ """
267
+ EXAMPLES::
268
+
269
+ sage: lisp.kill('x')
270
+ Traceback (most recent call last):
271
+ ...
272
+ NotImplementedError
273
+ """
274
+ raise NotImplementedError
275
+
276
+ def console(self):
277
+ """
278
+ Spawn a new Lisp command-line session.
279
+
280
+ EXAMPLES::
281
+
282
+ sage: lisp.console() #not tested
283
+ ECL (Embeddable Common-Lisp) ...
284
+ Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
285
+ Copyright (C) 1993 Giuseppe Attardi
286
+ Copyright (C) 2000 Juan J. Garcia-Ripoll
287
+ ECL is free software, and you are welcome to redistribute it
288
+ under certain conditions; see file 'Copyright' for details.
289
+ Type :h for Help. Top level.
290
+ ...
291
+ """
292
+ lisp_console()
293
+
294
+ def version(self):
295
+ """
296
+ Return the version of Lisp being used.
297
+
298
+ EXAMPLES::
299
+
300
+ sage: lisp.version()
301
+ 'Version information is given by lisp.console().'
302
+ """
303
+ # import subprocess
304
+ # p = subprocess.Popen('ecl --version', shell=True, stdin=subprocess.PIPE,
305
+ # stdout = subprocess.PIPE, stderr=subprocess.PIPE)
306
+ # return AsciiArtString(p.stdout.read())
307
+ return "Version information is given by lisp.console()."
308
+
309
+ def _object_class(self):
310
+ """
311
+ EXAMPLES::
312
+
313
+ sage: lisp._object_class()
314
+ <class 'sage.interfaces.lisp.LispElement'>
315
+ """
316
+ return LispElement
317
+
318
+ def _function_element_class(self):
319
+ """
320
+ EXAMPLES::
321
+
322
+ sage: lisp._function_element_class()
323
+ <class 'sage.interfaces.lisp.LispFunctionElement'>
324
+ """
325
+ return LispFunctionElement
326
+
327
+ def _true_symbol(self):
328
+ """
329
+ EXAMPLES::
330
+
331
+ sage: lisp._true_symbol()
332
+ 'T'
333
+ """
334
+ return 'T'
335
+
336
+ def _false_symbol(self):
337
+ """
338
+ EXAMPLES::
339
+
340
+ sage: lisp._false_symbol()
341
+ 'NIL'
342
+ """
343
+ return 'NIL'
344
+
345
+ def _equality_symbol(self):
346
+ """
347
+ We raise a :exc:`NotImplementedError` when ``_equality_symbol`` is
348
+ called since equality testing in Lisp does not use infix notation and
349
+ cannot be done the same way as in the other interfaces.
350
+
351
+ EXAMPLES::
352
+
353
+ sage: lisp._equality_symbol()
354
+ Traceback (most recent call last):
355
+ ...
356
+ NotImplementedError: ...
357
+ """
358
+ raise NotImplementedError("We should never reach here in the Lisp interface. " +
359
+ "Please report this as a bug.")
360
+
361
+ def help(self, command):
362
+ """
363
+ EXAMPLES::
364
+
365
+ sage: lisp.help('setq')
366
+ Traceback (most recent call last):
367
+ ...
368
+ NotImplementedError
369
+ """
370
+ raise NotImplementedError
371
+
372
+ def function_call(self, function, args=None, kwds=None):
373
+ """
374
+ Call the Lisp function with given ``args`` and ``kwds``.
375
+ For Lisp functions, the ``kwds`` are ignored.
376
+
377
+ EXAMPLES::
378
+
379
+ sage: lisp.function_call('sin', ['2'])
380
+ 0.9092974
381
+ sage: lisp.sin(2)
382
+ 0.9092974
383
+ """
384
+ args, kwds = self._convert_args_kwds(args, kwds)
385
+ self._check_valid_function_name(function)
386
+ return self.new("(%s %s)" % (function, ",".join(s.name() for s in args)))
387
+
388
+
389
+ # Inherit from RingElement to make __pow__ work
390
+ @instancedoc
391
+ class LispElement(RingElement, ExpectElement):
392
+ def _richcmp_(self, other, op):
393
+ """
394
+ EXAMPLES::
395
+
396
+ sage: one = lisp(1); two = lisp(2)
397
+ sage: one == one
398
+ True
399
+ sage: one != two
400
+ True
401
+ sage: one < two
402
+ True
403
+ sage: two > one
404
+ True
405
+ sage: one < 1
406
+ False
407
+ sage: two == 2
408
+ True
409
+ """
410
+ P = self._check_valid()
411
+ if parent(other) is not P:
412
+ other = P(other)
413
+
414
+ if P.eval('(= %s %s)' % (self.name(), other.name())) == P._true_symbol():
415
+ return rich_to_bool(op, 0)
416
+ elif P.eval('(< %s %s)' % (self.name(), other.name())) == P._true_symbol():
417
+ return rich_to_bool(op, -1)
418
+ else:
419
+ return rich_to_bool(op, 1)
420
+
421
+ def __bool__(self):
422
+ """
423
+ EXAMPLES::
424
+
425
+ sage: lisp(2).bool()
426
+ True
427
+ sage: lisp(0).bool()
428
+ False
429
+ sage: bool(lisp(2))
430
+ True
431
+ sage: bool(lisp('T'))
432
+ True
433
+ sage: bool(lisp('NIL'))
434
+ False
435
+ """
436
+ return self != 0 and repr(self) != 'NIL'
437
+
438
+ def _add_(self, right):
439
+ """
440
+ EXAMPLES::
441
+
442
+ sage: a = lisp(1); b = lisp(2)
443
+ sage: a + b
444
+ 3
445
+ """
446
+ P = self._check_valid()
447
+ return P.new('(+ %s %s)' % (self._name, right._name))
448
+
449
+ def _sub_(self, right):
450
+ """
451
+ EXAMPLES::
452
+
453
+ sage: a = lisp(1); b = lisp(2)
454
+ sage: a - b
455
+ -1
456
+ """
457
+ P = self._check_valid()
458
+ return P.new('(- %s %s)' % (self._name, right._name))
459
+
460
+ def _mul_(self, right):
461
+ """
462
+ EXAMPLES::
463
+
464
+ sage: a = lisp(1); b = lisp(2)
465
+ sage: a * b
466
+ 2
467
+ """
468
+ P = self._check_valid()
469
+ return P.new('(* %s %s)' % (self._name, right._name))
470
+
471
+ def _div_(self, right):
472
+ """
473
+ EXAMPLES::
474
+
475
+ sage: a = lisp(1); b = lisp(2)
476
+ sage: a / b
477
+ 1/2
478
+ """
479
+ P = self._check_valid()
480
+ return P.new('(/ %s %s)' % (self._name, right._name))
481
+
482
+ def __pow__(self, n):
483
+ """
484
+ EXAMPLES::
485
+
486
+ sage: a = lisp(3)
487
+ sage: a^3
488
+ 27
489
+ """
490
+ return RingElement.__pow__(self, n)
491
+
492
+
493
+ @instancedoc
494
+ class LispFunctionElement(FunctionElement):
495
+ def _instancedoc_(self):
496
+ """
497
+ EXAMPLES::
498
+
499
+ sage: two = lisp(2)
500
+ sage: two.sin.__doc__
501
+ Traceback (most recent call last):
502
+ ...
503
+ NotImplementedError
504
+ """
505
+ M = self._obj.parent()
506
+ return M.help(self._name)
507
+
508
+
509
+ @instancedoc
510
+ class LispFunction(ExpectFunction):
511
+ def _instancedoc_(self):
512
+ """
513
+ EXAMPLES::
514
+
515
+ sage: lisp.sin.__doc__
516
+ Traceback (most recent call last):
517
+ ...
518
+ NotImplementedError
519
+ """
520
+ M = self._parent
521
+ return M.help(self._name)
522
+
523
+
524
+ def is_LispElement(x):
525
+ """
526
+ EXAMPLES::
527
+
528
+ sage: from sage.interfaces.lisp import is_LispElement
529
+ sage: is_LispElement(2)
530
+ doctest:...: DeprecationWarning: the function is_LispElement is deprecated; use isinstance(x, sage.interfaces.abc.LispElement) instead
531
+ See https://github.com/sagemath/sage/issues/34804 for details.
532
+ False
533
+ sage: is_LispElement(lisp(2))
534
+ True
535
+ """
536
+ from sage.misc.superseded import deprecation
537
+ deprecation(34804, "the function is_LispElement is deprecated; use isinstance(x, sage.interfaces.abc.LispElement) instead")
538
+
539
+ return isinstance(x, LispElement)
540
+
541
+
542
+ # An instance
543
+ lisp = Lisp()
544
+
545
+
546
+ def reduce_load_Lisp():
547
+ """
548
+ EXAMPLES::
549
+
550
+ sage: from sage.interfaces.lisp import reduce_load_Lisp
551
+ sage: reduce_load_Lisp()
552
+ Lisp Interpreter
553
+ """
554
+ return lisp
555
+
556
+
557
+ def lisp_console():
558
+ """
559
+ Spawn a new Lisp command-line session.
560
+
561
+ EXAMPLES::
562
+
563
+ sage: lisp.console() #not tested
564
+ ECL (Embeddable Common-Lisp) ...
565
+ Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
566
+ Copyright (C) 1993 Giuseppe Attardi
567
+ Copyright (C) 2000 Juan J. Garcia-Ripoll
568
+ ECL is free software, and you are welcome to redistribute it
569
+ under certain conditions; see file 'Copyright' for details.
570
+ Type :h for Help. Top level.
571
+ ...
572
+ """
573
+ from sage.repl.rich_output.display_manager import get_display_manager
574
+ if not get_display_manager().is_in_terminal():
575
+ raise RuntimeError('Can use the console only in the terminal. Try %%lisp magics instead.')
576
+ os.system('ecl')
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-ecl
Binary file