LoginSignup
4
4

More than 5 years have passed since last update.

Mac ターミナルで始めるLisp

Last updated at Posted at 2016-02-08

SBCL(Steel Bank Common Lisp)インストール

まずはMacにSBCLを入れる
$ brew install sbcl

あとはコードを書いていく。
手始めに。

$ sbcl
This is SBCL 1.3.1, an implementation of ANSI Common Lisp.
More information about SBCL is available at http://www.sbcl.org/.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

Lisp 四則演算サンプル
スクリーンショット 2016-02-08 20.37.39.png

サンプル

(1+ 10)

11

(+ 1 2 3)

6

(+(* 2 2)(- 5 2))

7

(1- 10)

9

空のリスト
()

NIL

LispでHello, World

(format t "Hello, World\n")

NILHello, Worldn

関数サンプル

(flet ((f (n)
  (+ n 5)))
 (f 5))
10

スクリーンショット 2016-02-08 21.00.27.png

(flet ((関数名 (引数)
      定義)
  (関数名 (引数)
      定義))
  処理)

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4