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

1644fba8a219c89987390ef4f23d06bf?s=47 Ayumu Sato
November 03, 2012

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

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

1644fba8a219c89987390ef4f23d06bf?s=128

Ayumu Sato

November 03, 2012
Tweet

Transcript

  1. 27.

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

    map (* 2) |> sum 10 Saturday, November 3, 12
  2. 30.

    ఆ਺ > const SHOULD = 'BE' 'BE' > SHOULD =

    'NOT' SyntaxError: redeclaration of constant "SHOULD" on line 1 Saturday, November 3, 12
  3. 31.

    ෦෼ద༻ͱϝϯόΞΫηε > people = [{name: 'hoge'}, {name: 'fuga'}, {name: 'piyo'}]

    > people |> map (.name) |> filter (in ['hoge', 'fuga']) [ 'hoge', 'fuga' ] Saturday, November 3, 12
  4. 32.

    είʔϓ > a = 123 123 > do -> a

    = 456 456 > a 123 Saturday, November 3, 12
  5. 33.

    ԋࢉࢠ > 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. 34.

    ಺แදه &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. 35.

    ύλʔϯϚον # 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. 36.

    ΧϦʔ > 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. 37.

    ฏ͍ͨ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