Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
bel lispの紹介
Search
Niyarin
July 29, 2021
Technology
0
730
bel lispの紹介
Niyarin
July 29, 2021
Tweet
Share
More Decks by Niyarin
See All by Niyarin
Scheme用nREPLの開発(エラー出力の改善)
niyarin
0
150
nanopass-compiler-frameworkを使ってみました
niyarin
0
420
Gorgos-parser-combinator-written-in-scheme
niyarin
0
390
outputting-beautiful-s-expression
niyarin
0
380
Serialisp
niyarin
1
660
Mongo DBとS式検索
niyarin
0
310
goodbye-python-repl
niyarin
0
360
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1k
red-paren-scheme-rev-macro.pdf
niyarin
0
400
Other Decks in Technology
See All in Technology
BigQuery Remote FunctionでLooker Studioをインタラクティブ化
cuebic9bic
3
280
SalesforceArchitectGroupOsaka#20_CNX'25_Report
atomica7sei
0
170
Snowflake Summit 2025全体振り返り / Snowflake Summit 2025 Overall Review
mtpooh
2
400
登壇ネタの見つけ方 / How to find talk topics
pinkumohikan
5
440
PHP開発者のためのSOLID原則再入門 #phpcon / PHP Conference Japan 2025
shogogg
4
730
Oracle Audit Vault and Database Firewall 20 概要
oracle4engineer
PRO
3
1.7k
AIの最新技術&テーマをつまんで紹介&フリートークするシリーズ #1 量子機械学習の入門
tkhresk
0
140
標準技術と独自システムで作る「つらくない」SaaS アカウント管理 / Effortless SaaS Account Management with Standard Technologies & Custom Systems
yuyatakeyama
3
1.2k
プロダクトエンジニアリング組織への歩み、その現在地 / Our journey to becoming a product engineering organization
hiro_torii
0
130
生成AI活用の組織格差を解消する 〜ビジネス職のCursor導入が開発効率に与えた好循環〜 / Closing the Organizational Gap in AI Adoption
upamune
2
1.1k
PHPでWebブラウザのレンダリングエンジンを実装する
dip_tech
PRO
0
200
mrubyと micro-ROSが繋ぐロボットの世界
kishima
2
260
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
790
Docker and Python
trallard
44
3.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
A Tale of Four Properties
chriscoyier
160
23k
The Language of Interfaces
destraynor
158
25k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
Optimizing for Happiness
mojombo
379
70k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
A Modern Web Designer's Workflow
chriscoyier
694
190k
How STYLIGHT went responsive
nonsquared
100
5.6k
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はコンパクトで自己記述がおもしろい言語 継続とかあって実装は楽しい 公式の実装はないけど、実装はたくさんある