Coco 0.7.3

.co

https://github.com/satyr/coco/tree/0.7.3 0.6.2 0.7.3 -> ...; void !-> ... x = !x !=x [+a, +b] +[a, b] (exports ? this).x = x export x a = b = void var a, b _ = f!; _ = g _; _.m! f! => g _ => _.m! a a? {p: [q]:p} = o {[q]:p} = o p:~ -> @xp:…

Coco 0.6.2

.co

https://github.com/satyr/coco/tree/0.6.2 0.5.2 0.6.2 f(a).p f a .p f() f! o{} ^o {o.p, o.q} o{p, q} {p, q} = r if r? {p, q}? = r (r) -> {p, q} = r; ... ({p, q}: r) -> ... a.b a?b this import x import x "(#{id})" "(#id)" /\d/source /\d/$ [\…

?!

.co

0.6.0 から () の代わりに ! と書けるため意味を持つようになった。 !? は既に inexistence operator として有効なのでいよいよカオス。 Short Formal p?q p?.q p? q p?(q) p ?q p ? q p!q p().q p! q p()(q) p !q p(!q) p?!q p?().q p?! q p?()(q) p ?!q p …

機能のルーツ

ES.next Class, Destructuring, Splat Perl Conditional Assignment, Implicit Call, Implicit Return, String Interpolation, Post if/for/while, Range, unless/until Python Chained Comparison, Indented Block, Multiline String Ruby super, Variable …

WeakMap uniq

[http://wiki.ecmascript.org/doku.php?id=harmony:weak_maps:title=WeakMap] で uniq を書いて [https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf:title=indexOf] 版と比較してみた。 Primitive を受け付けない Error:…

paren-free CoffeeScript

括弧省略言語 CoffeeScript でなるべく負けた気にならないための書法集。 do Function(js)() # ↓ do Function js not in/of/instanceof not (a instanceof B) # ↓ a not instanceof B セミコロン [f(a), g(h(b), c), d] # ↓ [f a; g(h b; c); d] 関数呼び出…

Coco 0.5.2

.co

https://github.com/satyr/coco/tree/0.5.2 0.4.2 0.5.2 ///.../// //...// if !a? then a else b a !? b function f(a, b) -> ... function f a, b ... let (a = b) ~> ... let a = b ... new -> ... new ... switch case [a, b] then switch case a, b the…

IIFE

.js

http://benalman.com/news/2010/11/immediately-invoked-function-expression/ について。 訳 「即時実行関数式」は長いので「即行関数」としたい。 そのまま「IIFE」でもいいが検索性に難あり。 書き方 !function(){}() ~function(){}() + と - 、及び括弧…

wtfcs

https://github.com/satyr/coco/wiki/wtfcs *1そろそろ日本でも流行り始めた CoffeeScript 。未だ構文仕様が定まらず、バグも多く、人手不足で開発は停滞気味。言語開発に興味のある人は今がチャンス。英語にめげずコミットしてみてはいかが。 *1:http://wtf…

**

.co

window.twttr = (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], t = window.twttr || {}; if (d.getElementById(id)) return t; js = d.createElement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.paren…

Coco 0.4.2

.co

https://github.com/satyr/coco/tree/0.4.2 0.3.2 0.4.2 (x.y ||= {})z ||= [] x!y@z (-> ...)call x with x then ... Array(-~x)join s "#{s}" * x @constructor.static @..static `L:`; `break L;` :L break L a?.b a?b a ?= c.0; b ?= c.1 [a, b] ?= c [ …

kc2ks

keyconfig の設定を KeySnail に引き継ぐ。https://gist.github.com/858606 2011-03-24 Fx4 を期に乗り換えるつもりで書いたが、若干の変更のみであっさり動いたため結局 keyconfig を使い続けている。そもそも用途が完全に被るわけではないので両方入れてお…

ES3 8.6.2.3 step 5

.js

https://mail.mozilla.org/pipermail/es-discuss/2011-February/012839.html[[Prototype]] の ReadOnly*1が子孫に伝播する話。 Object.prototype = 0 Object.prototype + '' // [object Object] Object.prototype は書き込み禁止なので代入が無視される*2。 …

Coco 0.3.2

.co

https://github.com/satyr/coco/tree/0.3.2 0.2.0 0.3.2 f (a) -> ... a ... o['!'].m().p o'!'m()p {k: o.k} {o.k} a = o.a || b; c = o.c || d {a || b, c || d} = o s += s.0 s.+=0 {}.toString.call(x).slice(8, -1) typeof! x i for i from 0 til x i f…

ADI

.co

コンマの次はドット。 0.1.4 から @[0]['1']の代わりに @.0.'1' と書けるが、この並びならドットが無くても字句解析に支障が無い((例えば @a.0.1 だとドットを取ると意味が変わるので省略できない))。 THIS STRNUM STRNUM間にスペースがあれば括弧が補われて…

ACI

.co

[1, 2, 3]のコンマが無駄なので [1 2 3]と省略できるようになった。0.2.2 では文法をこねくりまわして実現したが、パーサの負担が大きいのでそれは諦め、より単純に字句解析時にトークンを補うことにした。例えば .. NUMBER NUMBER ..を見つけたら .. NUMBER…

backcall

.co

r = f (a, b) -> g (c) -> h -> i a, b, cの代わりに r = do (a, b) <- f c <- g <- h i a, b, cと書けるようにしてみた。矢印が逆向きなので仮に backcall と呼ぶ。 ✓ インデントが浅くなって嬉しい(はず) Haskell っぽく書ける(かのように見える) × インデ…

ckup

.co

https://github.com/satyr/ckup http://satyr.github.com/ckup https://github.com/mauricemach/coffeekup の劣化コピー。 これで JS に続き HTML も書かずに済む。次は CSS かな。

Coco 0.2.0

.co

https://github.com/satyr/coco/tree/0.2.0CoffeeScript 1.0.0 のリリースに合わせてこちらもバージョンを繰り上げた。 以下は 0.1 → 0.2 で可能になった書き方の一部。 0.1.1 0.2.0 a[0]['@'] a.0.\@ [arguments[1], arguments[2]] @@[1, 2] [o['+'], o['-'…

rest = a.slice(i, ?)

.js

配列 a の i 番目以降をコピーしたいとき、 a.slice(i) と通常は第二引数を省略するが、状況に応じて切り替えたい場合は a.slice(i, excludeLast ? -1 : x) のように何か値を渡すことになる。この x を何にすべきか((無論 a.length とはしたくない))。splice…

rest = a.splice(i, ?)

.js

配列 a の i 番目以降を抜き出したいとき、 a.splice(i, a.length) だと冗長なので単に省略して a.splice(i) と書いていたが、少し前に JScript で失敗することを知って a.splice(i, 1/0) ((1/0 === Infinity))と書くようになり、でつい今日、今度は JSC が…

Coco 0.1.3

.co

https://github.com/satyr/coco/tree/0.1.3#readme趣味的リファクタリングの結果オリジナルよりかなり小さく速くなった。 ver. LOC size speed Coco 0.1.3 1961 113 KB 1.4 sec Coffee 0.9.6 2312 170 KB 2.0 sec 行数・速度は添付の loc/bench タスク、サイ…

Coco 0.1

.co

http://satyr.github.com/coco/ https://github.com/satyr/coco/tree/0.1 紆余曲折の末無事に CoffeeScript 0.9.5 が出たので、Coco の方もこの機会にリリース宣言しておくことに。 ドキュメントが CoffeeScript からの変更点を羅列しただけの README しか無…

gpum

https://github.com/mooz/gpum惰性で使ってた Notifier が壊れたので乗り換え。快適至極。

CoffeeScript

少し前*1から本格的にちょっかいを出し始め、機能を増やしたり*2独自演算子((? ?. ?[] ?() ?= ||= &&=))の挙動をまともにしたり優先順位を直したり細かいバグを潰したり余分な括弧を外したり必要な括弧を付けたり高速化したりウェブコンソールを作ったりした…

Re: E4X

x.list.(function::hasOwnProperty("@id") && @id == "b"); http://teramako.github.com/doc/modest-20100904/index.html#(10) .(function::child("@id") == "b") で良さそう。 さらにゴルフするなら .(*.parent().@id == "b") とか。 xlist[i] = <span>hoge</span>; http…

typeof / /

.js

ECMAScript 4 discussion - Callable RegExp vs. typeof Bug 61911 - typeof(/regExp/) should return "object", not "function" (WebKit) Bug 28117 - Native JSON.stringify does not omit functions Bug 582717 - Make regular expressions not callable …

life

http://jsdo.it でごるふしてる人が居たので釣られた。 ついでに長らく放置していたテキストベースのやつも縮めて投稿。

464B tetris

AutoPager.ize()

AutoPager 自動更新先の Wedata ミラーが微妙に古い。 のでオリジナルから手動更新。 // Run in chrome://browser/content UpdateSites.updateSites.every(function(s){ if(!~s.url.indexOf('AutoPagerize')) return true; s.url = 'http://wedata.net/datab…