Changeset 5081:86b312aa1068


Ignore:
Timestamp:
06/20/07 22:37:05 (6 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

massively improve the robustness of the lisp interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/interfaces/lisp.py

    r5080 r5081  
    2323    '8' 
    2424 
     25One can define functions and the interface supports object-oriented 
     26notation for calling them: 
     27    sage: lisp.eval('(defun factorial (n) (if (= n 1) 1 (* n (factorial (- n 1)))))') 
     28    'FACTORIAL' 
     29    sage: lisp('(factorial 10)') 
     30    3628800 
     31    sage: lisp(10).factorial() 
     32    3628800 
     33    sage: a = lisp(17) 
     34    sage: a.factorial() 
     35    355687428096000 
     36 
    2537AUTHORS: 
    26     -- William Stein (template) 
     38    -- William Stein (first version) 
     39    -- William Stein (2007-06-20): significant improvements. 
    2740""" 
    2841 
     
    91104        code = str(code) 
    92105        code = code.strip() 
     106        code = code.replace('\n',' ') 
    93107        x = [] 
    94108        for L in code.split('\n'): 
Note: See TracChangeset for help on using the changeset viewer.