passagemath-ecl 10.6.32__cp312-cp312-musllinux_1_2_aarch64.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.
- ecl/kenzo.fas +0 -0
- ecl/maxima.fas +0 -0
- passagemath_ecl-10.6.32.dist-info/METADATA +137 -0
- passagemath_ecl-10.6.32.dist-info/METADATA.bak +138 -0
- passagemath_ecl-10.6.32.dist-info/RECORD +221 -0
- passagemath_ecl-10.6.32.dist-info/WHEEL +5 -0
- passagemath_ecl-10.6.32.dist-info/top_level.txt +2 -0
- passagemath_ecl.libs/libecl-393a3b39.so.24.5.10 +0 -0
- passagemath_ecl.libs/libffi-2cda18aa.so.8.1.4 +0 -0
- passagemath_ecl.libs/libgc-a95afae3.so.1.5.4 +0 -0
- passagemath_ecl.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- sage/all__sagemath_ecl.py +4 -0
- sage/interfaces/all__sagemath_ecl.py +1 -0
- sage/interfaces/lisp.py +576 -0
- sage/libs/all__sagemath_ecl.py +1 -0
- sage/libs/ecl.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/ecl.pxd +170 -0
- sage/libs/ecl.pyx +1360 -0
- sage/libs/eclsig.h +110 -0
- sage_wheels/bin/ecl +0 -0
- sage_wheels/lib/ecl-24.5.10/COPYING +502 -0
- sage_wheels/lib/ecl-24.5.10/LICENSE +41 -0
- sage_wheels/lib/ecl-24.5.10/TAGS +0 -0
- sage_wheels/lib/ecl-24.5.10/asdf.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/build-stamp +7 -0
- sage_wheels/lib/ecl-24.5.10/cmp.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/cmp.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/deflate.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/deflate.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/defsystem.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/defsystem.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/dpp +0 -0
- sage_wheels/lib/ecl-24.5.10/ecl-cdb.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/ecl-cdb.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/ecl-curl.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/ecl-curl.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/ecl-help.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/ecl-help.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/ecl-quicklisp.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/ecl-quicklisp.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/ecl_min +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/arabic +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ascii +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/asmo-708 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/atarist.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp-856.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp819 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp850 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp862 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp866 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp932 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp936 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp949 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cp950 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/cyrillic +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp437.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp737.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp775.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp850.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp852.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp855.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp857.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp860.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp861.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp862.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp863.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp864.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp865.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp866.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp869.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/dos-cp874.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ecma-114 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ecma-118 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/greek +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/greek8 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/hebrew +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm437 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm819 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm850 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm852 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm855 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm857 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm860 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm861 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm862 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm863 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm864 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm865 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm866 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ibm869 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-2022-jp +55 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-2022-jp-1 +57 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-1.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-10.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-11.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-13.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-14.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-15.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-16.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-2.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-3.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-4.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-5.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-6.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-7.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-8.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso-8859-9.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-1 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-10 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-13 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-14 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-15 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-2 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-3 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-4 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-5 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-6 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-7 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-8 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/iso8859-9 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/jisx0201.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/jisx0208.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/jisx0212.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/koi8-r.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/koi8-u.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/koi8r +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-1 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-2 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-3 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-4 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-5 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-6 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-7 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-8 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin-9 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin2 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin3 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin4 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin5 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin6 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin7 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin8 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/latin9 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-ansi +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-arab +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-cyrl +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-ee +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-greek +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-hebr +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ms-turk +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/shift-jis.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/tools.lisp +202 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ucs2 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ucs2be +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ucs2le +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ucs4 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ucs4be +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/ucs4le +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/unicode +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf-16 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf-16be +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf-16le +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf-32 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf-32be +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf-32le +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf16 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf32 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/utf8 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/winbaltrim +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1250 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1251 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1252 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1253 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1254 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1255 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1256 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1257 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-1258 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-932 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-936 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-949 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-950 +1 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1250.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1251.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1252.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1253.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1254.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1255.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1256.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1257.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp1258.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp932.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp936.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp949.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/encodings/windows-cp950.bin +0 -0
- sage_wheels/lib/ecl-24.5.10/help.doc +0 -0
- sage_wheels/lib/ecl-24.5.10/libasdf.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libcmp.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libdeflate.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libdefsystem.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libecl-cdb.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libecl-curl.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libecl-help.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libecl-quicklisp.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libpackage-locks.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libql-minitar.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libsb-bsd-sockets.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libserve-event.a +0 -0
- sage_wheels/lib/ecl-24.5.10/libsockets.a +0 -0
- sage_wheels/lib/ecl-24.5.10/package-locks.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/package-locks.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/prebuilt-asdf.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/ql-minitar.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/ql-minitar.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/sb-bsd-sockets.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/sb-bsd-sockets.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/serve-event.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/serve-event.fas +0 -0
- sage_wheels/lib/ecl-24.5.10/sockets.asd +5 -0
- sage_wheels/lib/ecl-24.5.10/sockets.fas +0 -0
- sage_wheels/lib/maxima/5.47.0/binary-ecl/maxima +0 -0
sage/interfaces/lisp.py
ADDED
|
@@ -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
|