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
Carp言語さわってみた 〜鯉を取り戻せ編〜
Search
t-sin
July 28, 2022
Programming
0
1.2k
Carp言語さわってみた 〜鯉を取り戻せ編〜
Shibuya.lisp lispmeetup #104
で発表したときの資料です。
t-sin
July 28, 2022
Tweet
Share
More Decks by t-sin
See All by t-sin
Lispの紹介 〜 令和最新版
tsin45
0
720
Common Lisp製のゲームエンジンTrialについてすこし
tsin45
0
1.2k
Common Lispでのゲームボーイエミュレータ実装進捗報告 vol.1
tsin45
0
860
Other Decks in Programming
See All in Programming
Patterns of Patterns
denyspoltorak
0
430
AtCoder Conference 2025
shindannin
0
920
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
440
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
520
CSC307 Lecture 01
javiergs
PRO
0
670
JETLS.jl ─ A New Language Server for Julia
abap34
2
470
ゲームの物理 剛体編
fadis
0
400
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
1.1k
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
620
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
530
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
190
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
180
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
32
Ethics towards AI in product and experience design
skipperchong
1
170
Building Applications with DynamoDB
mza
96
6.9k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
46
Abbi's Birthday
coloredviolet
0
4.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
140
Amusing Abliteration
ianozsvald
0
85
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Cult of Friendly URLs
andyhume
79
6.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Transcript
Carp言語さわってみた 〜鯉を取り戻せ編〜 @t-sin 2022-07-28 lispmeetup #104
Carp言語とは • Clojureふうの構文をもつLisp系言語 • GCレス、VMレス • 静的型付き言語 • 所有権追跡 •
簡単にCコードと統合できる • Lispのマクロ • REPL
Carpに興味を持った理由 • GC/VMがないLispである点 • 静的型システムおよび所有権追跡がある点 – 近ごろRustをさわってたので気になってた – Rust的な安全性がある? •
performance sensitiveなユースケースを想定してる点 – t-sinの興味: 音声信号処理、ゲーム • 重要: ドキュメントにあるREPLのプロンプトが「鯉」である点 – ”The 鲤 character on the last line is the REPL prompt”って書いてある – 以前「 」だったらしく「それ鯉 鲮 (carp) じゃないよ」ってissueが立ってた https://github.com/carp-lang/Carp/issues/578
Hello Carp! $ ./bin/carp Welcome to Carp 0.5.5 This is
free software with ABSOLUTELY NO WARRANTY. Evaluate (help) for more information. > (IO.println "Hello Carp!") Hello Carp!
鯉じゃない!!! $ ./bin/carp Welcome to Carp 0.5.5 This is free
software with ABSOLUTELY NO WARRANTY. Evaluate (help) for more information. > (IO.println "Hello Carp!") Hello Carp!
鯉の条件 • どうして鯉にならないのか • プロンプト文字列はProject.config内の値が使われる – マニュアル: https://github.com/carp-lang/Carp/blob/35465b9ffa8ce59a83af54a0637f8e93e49 59dc4/docs/Manual.md#configuring-a-project –
(Project.config "prompt" "鯉")とすると変えられるっぽい > (Project.config "prompt" "鯉") 鯉 (IO.println "鯉") 鯉
顧客が求めている鯉 • 「設定変えれば鯉にできる」 – →そうではない • なにもしなくても鯉になる条件を知りたい – REPLで鯉したい
鯉を取り戻せ • まず鯉プロンプトについて変更があったか調べる • もしかしたらなくなってるかも😭 – issue: なし – PR:
なし • つまり鯉REPLは消されていない
鯉を取り戻せ • 豆知識: CarpはHaskellで実装されている • あの>なる謎のプロンプトはどこから? – とりあえずsrc/ディレクトリを見てみる – Carpリポジトリのディレクトリ構造
→→ • Project.configの定義ここ https://github.com/carp-lang/Carp/blob/35465b9ffa8ce59a83af54a0637f8e93e4959dc 4/src/Project.hs – ただし値は入ってない ~/tmp/carp-lang/Carp$ tree -d -L 1 . ├── app ├── bench ├── core ├── docs ├── docs-html ├── examples ├── headerparse ├── resources ├── scripts ├── src └── test
ほんとうの鯉の条件 • Project.configの初期化はどこでやっているのか – src/には実行ファイルcarpのエントリポントない • app/Main.hs !! https://github.com/carp-lang/Carp/blob/35465b9ffa8ce59a83af54a0637f8e93e4959dc 4/app/Main.hs#L57
• macでのみプロンプトが鯉になる – 当環境はUbuntu – すべてが鯉にならない
鯉するCarp環境 • 起動したら自動で鯉にするには? • 設定ファイルを書きましょう – ~/.config/carp/profile.carp $ cat ~/.config/carp/profile.carp
(Project.config "prompt" "鯉")
鯉についての一考察 • macのみ鯉になるのはなぜか – Windowsは、コマンドプロンプトでUnicodeの文字「鯉」を 表示すると壊れそう – GNU/Linuxは、Unicodeのambiguous widthへの配慮? もしかしたらロケールがxx_YY.UTF-8じゃないケースへの配慮かも
• GNU/Linuxでも「鯉」にしようぜと言いたい… – issueを立てて訊いてみた https://github.com/carp-lang/Carp/issues/1423 – 「Unicodeをサポートしてない端末エミュレータもあるから」とのこと
きょうのまとめ • Carp言語の特徴を紹介した – REPLが鯉の言語です • GNU/LinuxでREPLが鯉にならない理由を調査した • 鯉ってサイコー!
きょうのまとめ • Carp言語の特徴を紹介した – REPLが鯉の言語です • GNU/LinuxでREPLが鯉にならない理由を調査した • 鯉ってサイコー! •
REPLに鯉がいないのが気になりすぎて大脱線しました • 次回はちゃんとCarpを紹介します – シンセ的なものをつくってみたりする予定