common lisp 笔记1 hello world

1,运行环境

  我在freebsd下,使用sbcl作为交互式运行环境,emacs作为编辑器。

2,自求值表达式

  5 ; output: 5

  "hello world"; output: "hello world"

3,数学计算

  (+ 2 3); output: 5

4,hello world程序

  (format t "hello world"); first way

  (write-line "hello world"); second way

  (print "hello world"); third way

5,定义函数和调用函数

  (defun hello-world()

    (format t "hello world")

  ); defined function

  (hello-world); call function

6,加载lisp源文件和编译lisp源文件

  (load "hello.lisp"); load source file

  (compile-file "hello.lisp"); compile source file

  (load "hello.fasl"); load compiled source file

 

代码主要来自《实用Common Lisp编程》一书的第二章

posted @ 2012-12-24 00:58  呆头鱼  阅读(1590)  评论(0编辑  收藏  举报