Upgrade to Pro — share decks privately, control downloads, hide ads and more …

近況報告とかLiveScript(オマケ)とか

Ayumu Sato
November 03, 2012

 近況報告とかLiveScript(オマケ)とか

大なごやJS Vol.4 発表資料(ぶん投げた内容で申し訳ない次第)

Ayumu Sato

November 03, 2012
Tweet

More Decks by Ayumu Sato

Other Decks in Programming

Transcript

  1. ର࿩ܕ % lsc --interactive --prelude livescript> [1 2 3] |>

    map (* 2) |> sum 10 Saturday, November 3, 12
  2. ఆ਺ > const SHOULD = 'BE' 'BE' > SHOULD =

    'NOT' SyntaxError: redeclaration of constant "SHOULD" on line 1 Saturday, November 3, 12
  3. ෦෼ద༻ͱϝϯόΞΫηε > people = [{name: 'hoge'}, {name: 'fuga'}, {name: 'piyo'}]

    > people |> map (.name) |> filter (in ['hoge', 'fuga']) [ 'hoge', 'fuga' ] Saturday, November 3, 12
  4. είʔϓ > a = 123 123 > do -> a

    = 456 456 > a 123 Saturday, November 3, 12
  5. ԋࢉࢠ > unique [1, 1, 0] .length 2 > array

    = [1, 1, 0] > unique array or not empty array # in coffee # (unique array) or not (empty array) Saturday, November 3, 12
  6. ಺แදه &4 1UZIPO )BTLFMMϥΠΫ livescript> [a * b for a

    in [1, 2, 3] for b in [10, 20, 40]] [ 10, 20, 40, 20, 40, 80, 30, 60, 120 ] coffee> (a * b for a in [1, 2, 3] for b in [10, 20, 40]) [ [ 10, 20, 30 ], [ 20, 40, 60 ], [ 40, 80, 120 ] ] Saturday, November 3, 12
  7. ύλʔϯϚον # func(n, list) Ͱ list ͷઌ಄͔Β n ݸฦ͢ #

    list͕ۭͩͬͨΓn͕0ҎԼͰ͋Ε͹ [] Λฦ͢ take (n,[x,...xs]:list) -> | n <= 0 => [] | empty list => [] | otherwise => [x] +++ take n - 1,xs Saturday, November 3, 12
  8. ΧϦʔ > times = (x,y) --> x*y [Function] function (){

    var params = args ? args.concat() : []; return params.push.apply(params, arguments) < f.length && arguments.length ? curry$.call(this, f, params) : f.apply(this, params); } > times 2,3 6 > double = times 2 > double 5 10 Saturday, November 3, 12
  9. ฏ͍ͨBTZOD data <-! $.get 'ajaxtest' $ \.result .html data processed

    <-! $.get 'ajaxprocess', data $ \.result .append processed $.get('ajaxtest', function(data){ $('.result').html(data); $.get('ajaxprocess', data, function(processed){ $('.result').append(processed); }); }); Saturday, November 3, 12