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
LiveScript
Search
Pine Mizune
February 10, 2016
Programming
1
650
LiveScript
Meguro.es #2 で発表した資料です。
http://meguroes.connpass.com/event/25018/
Pine Mizune
February 10, 2016
Tweet
Share
More Decks by Pine Mizune
See All by Pine Mizune
多言語対応と絵文字ジェネレーター / i18n of Emoji Generator
pine
0
630
C++ 製グラフィックライブラリ Skia の紹介 / Introduction to the graphics library Skia written by C++
pine
0
1.3k
asyncio + aiohttp で作るウェブサービス / How to develop a web service with asyncio and aiohttp
pine
0
580
Lerna による明示的疎結合アーキテクチャ
pine
1
580
CircleCI 2.0 x JavaScript
pine
3
500
Perl 卒業式
pine
0
290
Android Studio の気になる warnings を抑制する方法まとめ
pine
0
450
Emoji Generator meets Browser Extensions
pine
1
2.9k
近年の OSS 開発における CI 選択のベストプラクティス
pine
3
4.5k
Other Decks in Programming
See All in Programming
Git Lint
bkuhlmann
4
750
Elm Form Validation
bkuhlmann
0
510
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
130
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
370
Ruby Pattern Matching
bkuhlmann
0
930
2 週間で Twitter Bot を作ってみた
contour_gara
0
340
Rubyでたのしむクリエイティブコーディング/Enjoy Creative coding with Ruby
chobishiba
1
180
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
180
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
750
Code Reviews
bkuhlmann
4
890
スキーマ駆動開発による品質とスピードの両立 - 私達は何故、スキーマを書くのか
kentaroutakeda
0
170
ONE WEDGE_company_guide
1wedge_one
0
470
Featured
See All Featured
How GitHub (no longer) Works
holman
304
140k
Agile that works and the tools we love
rasmusluckow
325
20k
Navigating Team Friction
lara
178
13k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Why Our Code Smells
bkeepers
PRO
331
56k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Gamification - CAS2011
davidbonilla
76
4.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
116
18k
For a Future-Friendly Web
brad_frost
172
9k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Transcript
Live Script 10 Feb, 2016 / Meguro.es #2 Pine Mizune
⾃⼰紹介 o ID / HN: @pine613 o 好きな言語: JavaScript /
Crystal o 仕事で書いてる: Perl / Swift / Kotlin o Mobile Factory, Inc o 最寄り: 五反田駅 o 本日は @mizuki_r 氏の代打です ⽬⿊のとなり
⽬次 1. LiveScript とは何か 2. 別に Babel でよくない ? 3.
LiveScript の特筆すべき⽂法 – 関数型記法・ほか 4. まとめ
LiveScript とは何か ? • CoffeeScript から派生した AltJS • 関数型言語として進化 •
利用人口が少ない
別に Babel で良くない ? • ⾃分もそう思います! • 本筋の開発で使うことは意図してません • このプレゼンで意図した使い⽅
– ⼩さなモジュール – gulpfile / webpack.config
インストール⽅法 repl があるのでぜひ弄ってみてください! $ npm i -g livescript ※ repl:
対話型インタプリタ
LiveScript の⽂法 1. 基本⽂法 2. パイピング 3. 関数 4. カリー化・関数合成
基本⽂法 (1/2) if 2 + 2 == 4 'somethingʼ else
ʻsomething elseʼ 基本は CoffeeScript と同じ if (2 + 2 == 4) { 'somethingʼ; } else { ʻsomething elseʼ; } LiveScript JavaScript
基本⽂法 (2/2) require! { lodash: _ gulp } require が圧倒的に楽
const _ = require(ʻlodashʼ) const gulp = require(ʻgulpʼ) LiveScript JavaScript
パイピング x = [1 2 3] |> reverse |> head
メソッドのネスト呼び出しの糖衣構文 let x = head(reverse([1, 2, 3])) LiveScript JavaScript
関数 (1/2) f = (x) -> x * x f(10)
#=> 100 CoffeeScript と同様に定義可能 const f = (x) => x * x f(10) #=> 100 LiveScript JavaScript
関数 (2/2) fold (+) [ 1 to 10 ] #=>
55 演算子は関数として扱える fold( (a, b) => a + b, [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ) LiveScript JavaScript
カリー化 f = (* 2) f(8) # => 16 f
= (a, b) --> a + b g = f(2) g(8) #=> 16 部分的に引数を固定した関数を得る LiveScript
関数合成 f = (x) => x + 2 g =
(x) => x * 10 (f >> g) 3 #=> 50 LiveScript 2つの関数を合成して関数を生成 let f = (x) => x + 2 let g = (x) => x * 10 g(f(3)) #=> 50 JavaScript
まとめ • LiveScript は CoffeeScript 派生言語 • 関数型方面へ進化 • ES2015
に飽きた時の暇つぶしにどうぞ
【宣伝】Gotanda.js #3 開催します n Gotanda.js #3 in freee ü 日時:
2016 年 3 月 11 日 (金) ü 会場: freee 株式会社 ü 内容: LT x 8 (5min LT x 8) ü 申し込みは Connpass から! http://gotandajs.connpass.com/event/26027/
fin.