Linux怎么运行lisp,Lisp - Ubuntu 中的编程语言_Linux编程_Linux公社-Linux系统门户网站...

Lisp

Lisp 语言在2010年6月编程语言排行榜中排名第十六位。下面就是 GregorianTest.lisp 程序:

3fe02617f8a069386e04d6a9a743b2a9.png

安装 GNU Common Lisp 软件包,gcl 可以作为交互窗口,也可编译源程序(使用 –compile 参数),还可以解释执行(使用 –f 参数):

ben@ben-1520:~/work$ sudo apt-get install gcl

ben@ben-1520:~/work$ gcl

GCL (GNU Common Lisp)  2.6.7 CLtL1    Feb 15 2010 17:57:54

Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)

Binary License:  GPL due to GPL'ed components: (XGCL READLINE BFD UNEXEC)

Modifications of this banner must retain notice of a compatible license

Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.

Temporary directory for compiler files set to /tmp/

>(bye)

ben@ben-1520:~/work$ gcl -f GregorianTest.lisp

Mon 1583-01--88  seconds since 1900-01-01: -10011254400

Tue 1583-01--87  seconds since 1900-01-01: -10011168000

ben@ben-1520:~/work$

运行结果基本和 C 语言一样,但是有一个 bug,认为 1582-10-04 是1583年1月的第 –88 天。这是一个很奇怪的 bug,其它大部分日期是正常的,如下所示:

ben@ben-1520:~/work$ gcl -f GregorianTest2.lisp

Sun 2010-06-20  seconds since 1900-01-01: 3485980800

Mon 2010-06-21  seconds since 1900-01-01: 3486067200

ben@ben-1520:~/work$ gcl -f GregorianTest3.lisp

Tue 1582-05-04  seconds since 1900-01-01: -10024473600

Wed 1582-05-05  seconds since 1900-01-01: -10024387200

ben@ben-1520:~/work$

此外,还可以选择安装 GNU CLISP 软件包,clisp 是符合 ANSI Common Lisp 标准的编译器、解释器和调试器:

ben@ben-1520:~/work$ sudo apt-get install clisp

ben@ben-1520:~/work$ clisp

i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo

I I I I I I I      8     8   8           8     8     o  8    8

I  \ `+' /  I      8         8           8     8        8    8

\  `-+-'  /       8         8           8      ooooo   8oooo

`-__|__-'        8         8           8           8  8

|            8     o   8           8     o     8  8

------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

Welcome to GNU CLISP 2.44.1 (2008-02-23)

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993

Copyright (c) Bruno Haible, Marcus Daniels 1994-1997

Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998

Copyright (c) Bruno Haible, Sam Steingold 1999-2000

Copyright (c) Sam Steingold, Bruno Haible 2001-2008

Type :h and hit Enter for context help.

[1]> (bye)

Bye.

ben@ben-1520:~/work$ clisp GregorianTest2.lisp

Sun 2010-06-20  seconds since 1900-01-01: 3485952000

Mon 2010-06-21  seconds since 1900-01-01: 3486038400

ben@ben-1520:~/work$ clisp GregorianTest.lisp

*** - incorrect date: 1582-10-4 0:0:0, time zone NIL

ben@ben-1520:~/work$

可以看出,GNU CLISP 不支持 1900-01-01 以前的日期。0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值