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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Niyarin
July 29, 2021
Technology
780
0
Share
bel lispの紹介
Niyarin
July 29, 2021
More Decks by Niyarin
See All by Niyarin
Scheme用nREPLの開発(エラー出力の改善)
niyarin
0
180
nanopass-compiler-frameworkを使ってみました
niyarin
0
480
Gorgos-parser-combinator-written-in-scheme
niyarin
0
410
outputting-beautiful-s-expression
niyarin
0
410
Serialisp
niyarin
1
720
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
390
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
red-paren-scheme-rev-macro.pdf
niyarin
0
450
Other Decks in Technology
See All in Technology
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
0
290
Reasoning Models in Practice: From Inference- Time to Training-Time Scaling on Verifiable Tasks
nptdat
0
110
M5Stack CoreS3とZephyr(RTOS)で Edge AIっぽいことしてみた
iotengineer22
0
430
CyberAgent YJC Connect
shimaf4979
1
160
自動テストだけで リリース判断できるチームへ - 鍵はテストの量ではなくリリース判断基準の再設計にあった / Redesigning Release Criteria for Lightweight Releases
ewa
7
3.4k
大学職員のための生成AI最前線 :最前線を、AIガバナンスとして読み直すためのTips
gmoriki
2
3.6k
AgentCore Managed Harness を使ってみよう
yakumo
2
320
Vision Banana: Image Generators are Generalist Vision Learners
kzykmyzw
0
200
Modernizing Your HCL Connections Experience: Visual Report to chain, Profile Enhancements, and AI Integration
wannesrams
0
280
Percolatorを廃止し、マルチ検索サービスへ刷新した話 / Search Engineering Tech Talk 2026 Spring
visional_engineering_and_design
0
320
バイブコーディングで3倍早く⚪⚪を作ってみた
samakada
0
220
ServiceによるKubernetes通信制御ーClusterIPを例に
miku01
1
140
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Context Engineering - Making Every Token Count
addyosmani
9
860
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
KATA
mclloyd
PRO
35
15k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Navigating Team Friction
lara
192
16k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
110
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Bash Introduction
62gerente
615
210k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
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はコンパクトで自己記述がおもしろい言語 継続とかあって実装は楽しい 公式の実装はないけど、実装はたくさんある