Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Lispの紹介 〜 令和最新版
Search
t-sin
January 25, 2024
Programming
860
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Lispの紹介 〜 令和最新版
Shibuya.lisp lispmeetup #113
で発表したときのスライドです。
t-sin
January 25, 2024
More Decks by t-sin
See All by t-sin
Carp言語さわってみた 〜鯉を取り戻せ編〜
tsin45
0
1.4k
Common Lisp製のゲームエンジンTrialについてすこし
tsin45
0
1.5k
Common Lispでのゲームボーイエミュレータ実装進捗報告 vol.1
tsin45
0
950
Other Decks in Programming
See All in Programming
Foundry Localでエージェント開発
seosoft
0
170
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
330
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
160
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
230
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
150
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
240
業務時間外もAIに働いてもらう話
colorful12
3
10k
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
390
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
230
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
150
Featured
See All Featured
From π to Pie charts
rasagy
0
360
[SF Ruby Conf 2025] Rails X
palkan
2
1.4k
Faster Mobile Websites
deanohume
310
32k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Google's AI Overviews - The New Search
badams
0
1.6k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Testing 201, or: Great Expectations
jmmastey
46
8.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
600
Transcript
Lispの紹介 〜 令和最新版 @t-sin 2024-01-25 Shibuya.lisp lispmeetup #113
背景 • lispmeetupのオフライン開催が4年ぶり • Lispあまりよく知らない方もいそう • なのでLispを紹介します
Lispってどんな言語? • JSやPythonやRubyに近い手ざわり • Lispっていっぱいある – Lispは言語族の名前 • 自己拡張性が高い –
とても動的な処理系であることがおおい
LispとJSやRubyの似てる点 • 高階関数やラムダ式 • 静的型システムはない (たいていは) • RPELがある
Lispと似てる点: 高階関数 • JavaScriptによる例 (RosettaCodeより) • https://rosettacode.org/wiki/Function_composition#ES6 var compose =
(f, g) => x => f(g(x)); var id = compose(Math.sin, Math.asin); console.log(id(0.5)); // 0.5
Lispと似てる点: 高階関数 • Common Lispによる例 (RosettaCodeより) https://rosettacode.org/wiki/Function_composition#Com mon_Lisp > (defun
compose (f g) (lambda (x) (funcall f (funcall g x)))) COMPOSE > (let ((sin-asin (compose #'sin #'asin))) (funcall sin-asin 0.5)) 0.5
LispとJSやRubyの似てない点 • S式と呼ばれる構文 • Lispのマクロ – 構文木を構文木へ変換する – テキスト置換ではない –
でも静的型はない • (一部のLispは) REPLの機能がつよい
Lispはいっぱいある • たくさんの処理系がある – Scheme, Common Lisp, Emacs Lisp, Arc,
Clojure, Carp, … • その理由はおそらく… – Schemeが言語機能の実験場だった時期がある – 比較的単純なのでアイデアをすぐに実現できる – LisperがLisp大好きすぎる (?)
Lispの自己拡張性 • 関数を定義すると語彙が増える – 関数呼び出し構文はビルトインでもユーザ定義でも同じ – →言語を拡張している • ほかにも –
Lispのマクロ – 拡張可能なパーサ (Common Lisp) – 実行時情報をREPLで変更 (Common Lisp, Clojure) – 実行時にクラス定義の変更 (Common Lisp)
Lispの自己拡張性 • LISP 1.5のころから自己拡張性高かった – 基本的な要素がら複雑な機能を立ち上げていく • 川合史朗さんの『LISP 1.5の風景』に記載あり –
ラムダノート社『n月刊ラムダノート Vol.1, No.2 (2019)』所収
Lispのよくある誤解集 • 関数型言語である • マクロを書きまくる • インタプリタだから遅い
Lispの誤解集: 関数型言語である • 手続き型言語です • 高階関数とかあるけど再代入とか破壊的変更よくや る – オブジェクト指向だとなおさらやる •
Clojureは関数型言語っぽさを推しているけど、一 部破壊的変更ができるので全体としては関数型では ない
Lispの誤解集: マクロを書きまくる • そんなに書かないです • 複雑なバグを生みうるやつ – マクロのマクロのマクロの... – メタプログラミングあるある
• 関数ですむなら関数を書く • DSLを作るときには大活躍
Lispの誤解集: インタプリタで遅い • コンパイラを持ってること多し – 最近はコンパイラとインタプリタの境は曖昧 • インタプリタだけどVM方式だったりJITもってたり • Rubyに最近JITが入りましたよね?
• ネイティブコードコンパイラのある処理系は速い – SBCL (Common Lisp)、Chez Scheme (Scheme, R5RS) – ClojureはJVM言語なのでJVMに律速される
で、Lispって何ができるの? • わりと何でもできる – Webサービス、ゲーム、OS、ツール、... • 古い言語なのでいろんなソフトウェアがある • もしかしたら身近なところに潜んでいるかも …?
Lispの事例集: スクリプト言語 1 • GNU Emacs (Emacs Lisp) – エディタの設定とスクリプティング
• AutoCAD (AutoLisp) – CADのスクリプティング – CADってコマンド操作が基本っぽい
Lispの事例集: スクリプト言語 2 • Audacity (Nyquist) – Audacityは音声波形編集ソフト – Nyquistは音声信号生成もできる
• ALSA (alisp) – ALSAはLinuxのオーディオ抽象化レイヤー – 設定言語が実はLisp • `find / | grep alisp`してみると…?
Lispの事例集: Webサービス • ハチペイのバックエンド (Common Lisp) – 渋谷区の決済アプリ – https://www.hachi-pay.tokyo/
– 株式会社ポケットチェンジ • 広告媒体アカウント管理システム (Clojure) – https://tech-magazine.opt.ne.jp/entry/2021/01/13/124551 – 株式会社オプト • Practical Scheme (Gauche Scheme) – https://practical-scheme.net/ – 川合史朗さん
Lispの事例集: ゲーム • クラッシュ・バンディクー (1と2) – GOAL (Game Oriented Assembly
Lisp) というLisp • Kandria (Common Lisp) – メトロイドヴァニア系アクション – https://store.steampowered.com/app/1261430/Kandria/ • Steamで買って遊べます!!!
Lispの事例集: ツール (1) • pgloader (Common Lisp) – PostgreSQLのdump/loadツール –
https://pgloader.io • Maxima (Common Lisp) – 数式処理システム (Mathematicaみたいなやつ) – https://maxima.sourceforge.io/
Lispの事例集: ツール (2) • Lem (Common Lisp) – テキストエディタ •
Roswell (Common Lisp + C) – Common Lispの処理系マネージャ • Senn (Common Lisp) – 日本語入力メソッド (IME) – https://github.com/mhkoji/Senn
Lispの事例集: 作曲環境 • Opusmodus (Common Lisp) – https://www.opusmodus.com/ • Overtone
(Clojure) – https://overtone.github.io • Extempore (Scheme) – https://github.com/digego/extempore
Lispの事例集: そのほか 1 • Nyxt (Common Lisp) – キーボード指向のウェブブラウザ –
https://nyxt.atlas.engineer/ • Mezzano (Common Lisp) – オペレーティングシステム – https://github.com/froggey/Mezzano
まとめ • Lispはけっこういろいろできる • Lispはカッコいい • みんなもLispやろうぜ!!!