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
bel lispの紹介
Search
Niyarin
July 29, 2021
Technology
800
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
bel lispの紹介
Niyarin
July 29, 2021
More Decks by Niyarin
See All by Niyarin
Scheme用nREPLの開発(エラー出力の改善)
niyarin
0
190
nanopass-compiler-frameworkを使ってみました
niyarin
0
500
Gorgos-parser-combinator-written-in-scheme
niyarin
0
430
outputting-beautiful-s-expression
niyarin
0
430
Serialisp
niyarin
1
740
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
400
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
red-paren-scheme-rev-macro.pdf
niyarin
0
460
Other Decks in Technology
See All in Technology
品質と信頼性を地続きにする
grimoh
2
850
Railsのように考える: See through the Master
snoozer05
PRO
4
1.2k
人間はどの意思決定を手放せるのか
kawasima
15
7.7k
CLIライブラリ開発を支える技術
htnabe
0
140
SREへの勘違いに気づいた後の話
tomodakengo
0
120
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
25
17k
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
370
山手線を徒歩で一周してわかった、 位置情報アプリは「足」が最強のデバッガー
hinakko
0
170
え、こんなに早く改修できるの?──新人エンジニアとスクラムマスターの2人が語る、AI×アジャイル開発の現場
ysasago
2
600
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
3
570
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
33
30k
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
180
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
540
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Product Roadmaps are Hard
iamctodd
55
13k
30 Presentation Tips
portentint
PRO
1
400
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
460
4 Signs Your Business is Dying
shpigford
187
23k
We Have a Design System, Now What?
morganepeng
55
8.3k
Unsuck your backbone
ammeep
672
58k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
Balancing Empowerment & Direction
lara
6
1.3k
Transcript
(いまさら) Belについて 簡単な紹介と処理系 Niyarin
Belとは Paul Graham氏のLisp系言語 データの種類が少ない ・Symbol, Pair, Char ,Stream ・他のありがちなデータもこれらで表現 コンパクトだが、継続やマクロがちゃんとある
・実装はたのしめると思う レキシカルスコープ、lisp-1 公式は処理系を出していない ・ただし、コアの部分さえ実装すれば動かせる ・残りの部分はbel.belとして提供されている
せっかくなのでArcについても (Wikipedia程度の情報) Paul Graham氏のLisp系言語 Belの前に開発されていた 実用的に使われた実績がある Hacker Newsのweb formとフィード (今はどうなのか不明)
Arcのフォーラム Racketで実装 コアが小さい (bel同様)
Belを読む (http://www.paulgraham.com/bel.html) bellanguage.txt belのコア言語の”カジュアル”な定義 bel.bel 拡張関数、マクロや数値の定義 belexamples.txt ちょっとの例
Belと既存のLispの慣習 ・ 空リストはnil。偽でもある。ただし、nilはシンボル ・非真性list有り ・ car, cdrはそのまま。 ペアの変更は、xar, xdr ・condがない
代わりに、 (if a1 a2 a3 a4 … an) ・ lisp1、レキシカルスコープ ・伝統的macro (風)
Belのデータ表現1 / 3 関数もリスト こんな表現 (lit clo ローカル環境 引数 本体)
・ closureを作る構文は、quasiquoteで書かれている ・ 例 ((lit clo nil (x) (+ x 1)) 100) → 101 ⚠ lit構文は、自身をそのまま返す
Belのデータ表現2 / 3 マクロもリスト 表現 (lit mac クロージャ) よくある、クロージャに式を渡して展開する やつ
(クロージャ 式) eval→ 展開結果 eval→ 実行結果
Belのデータ表現3 / 3 その他 数値もリスト 0,1,2,3,4 ... → nil, (t), (t
t), (t t t), (t t t t) … 文字列もリスト “abc” → (\a \b \c) 空リストと”真”はシンボル nil t
継続もある ・ ccc”構文”で作れる ・もちろん継続もリスト 表現の形式は実装者依存 niyarinは、 (lit cont コールスタック ローカル環境)
⚠ インタプリタのコールスタックを陽で持っておく ・dynamic-wind風の構文、afterもある 継続で外への脱出を検出し、その前に指定した処理を実行させ る
Belで実用的なコードを書けるのか? がんばればいける ・ (coin) 関数 ランダムで t , nil を出す
・ (sys <string>) 関数 <string>の内容をOSに実行させる ・ (thead x) 構文 xを評価する新しいスレッドを作る ・ IO streamデータがある。ただし、バイナリしか読めない
Belは処理系実装の題材としては良い 評価器はコンパクト 4種のデータと16個の関数と9個のsyntax quasiquote bel.belを実行するためのいくつかのsyntax-sugar 処理系実装が楽しめる要素 マクロ、継続、継続の捕捉、動的束縛、quasiquote 題材は良いが、テキストの抜けを自力で埋める必要がある
実装 ・ bel-sml (github.com/niyarin/bel-sml) niyarinの”未完成”の実装 Standard MLで書かれた素朴なインタプリタ 気合をいれればすぐできそうだが、さぼってました ・他の人の実装 ほとんどインタプリタ
(ぱっと見、それ以外は発見できず) luksamuk/believe (C), masak/bel (Perl), ajlopez/beljs (JS) cookrn/babybel(Ruby) ,
その他実装 IGJoshua/skitter (Clojure) bel-likeと謳っているが何が違うのだろう BranislavLazic/bell lが一個多かった。別言語だったよ (Lispだったけど)
おしまい まとめ Belはコンパクトで自己記述がおもしろい言語 継続とかあって実装は楽しい 公式の実装はないけど、実装はたくさんある