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

zip

kunou
July 07, 2017
500

 zip

About zip function

kunou

July 07, 2017
Tweet

Transcript

  1. 覚えて置くと仕事で役立つ関数 n 選 よく使うもの map reduce filter distinct flatten zip

    cycle sort apply take assoc remove 今日はコレの話をします
 rest
  2. 覚えて置くと仕事で役立つ関数 n 選 よく使うもの map reduce filter distinct flatten zip

    cycle sort apply take assoc remove 今日はコレの話をします
 (時間の都合で) rest
  3. 覚えて置くと仕事で役立つ関数 n 選 zip var array1 = [1, 2, 3,

    4, 5]; var array2 = ['a', 'b', 'c', 'd', 'e']; 

  4. 覚えて置くと仕事で役立つ関数 n 選 zip var array1 = [1, 2, 3,

    4, 5]; var array2 = ['a', 'b', 'c', 'd', 'e']; __.zip(array1, array2);

  5. 覚えて置くと仕事で役立つ関数 n 選 zip var array1 = [1, 2, 3,

    4, 5]; var array2 = ['a', 'b', 'c', 'd', 'e']; __.zip(array1, array2);
 => [ [ 1, 'a' ], [ 2, 'b' ], [ 3, 'c' ], [ 4, 'd' ], [ 5, 'e' ] ]
  6. 覚えて置くと仕事で役立つ関数 n 選 zip ͜ΕɺԿʹ࢖͑Δͷʁʁʁ var array1 = [1, 2,

    3, 4, 5]; var array2 = ['a', 'b', 'c', 'd', 'e']; __.zip(array1, array2);
 => [ [ 1, 'a' ], [ 2, 'b' ], [ 3, 'c' ], [ 4, 'd' ], [ 5, 'e' ] ]
  7. 覚えて置くと仕事で役立つ関数 n 選 zip var days = [ 2017-07-01, 2017-07-02,

    2017-07-03, 2017-07-04, 2017-07-05, 2017-07-06, 2017-07-07, 2017-07-09, 2017-07-11] 

  8. 覚えて置くと仕事で役立つ関数 n 選 zip var days = [ 2017-07-01, 2017-07-02,

    2017-07-03, 2017-07-04, 2017-07-05, 2017-07-06, 2017-07-07, 2017-07-09, 2017-07-11] 
 ೔෇͕ॳΊͯෆ࿈ଓʹͳΔ ৔ॴΛͲ͏୳͠·͔͢ʁ
  9. var days = [ 2017-07-01, 2017-07-02, 2017-07-03, 2017-07-04, 2017-07-05, 2017-07-06,

    2017-07-07, 2017-07-09, 2017-07-11] 
 覚えて置くと仕事で役立つ関数 n 選 zip
  10. 覚えて置くと仕事で役立つ関数 n 選 zip var unmatchFirst = -1; for (var

    i = 0; i < days.length - 1; i++) { var current = days[i], next = days[i + 1]; if (next.getDate() - current.getDate() != 1) { unmatchFirst = i; break; } }
  11. 覚えて置くと仕事で役立つ関数 n 選 zip var unmatchFirst = -1; for (var

    i = 0; i < days.length - 1; i++) { var current = days[i], next = days[i + 1]; if (next.getDate() - current.getDate() != 1) { unmatchFirst = i; break; } } ͜Μͳײ͡ʁ
  12. 覚えて置くと仕事で役立つ関数 n 選 zip var unmatchFirst = -1; for (var

    i = 0; i < days.length - 1; i++) { var current = days[i], next = days[i + 1]; if (next.getDate() - current.getDate() != 1) { unmatchFirst = i; break; } } ͜Ε࢖͍·͠ΐ͏
  13. 覚えて置くと仕事で役立つ関数 n 選 zip __.zip(days, __.rest(days.concat([null]))) => [ [ 2017-07-01,

    2017-07-02 ], [ 2017-07-02, 2017-07-03 ], [ 2017-07-03, 2017-07-04 ], : [ 2017-07-11, null ] ]
  14. 覚えて置くと仕事で役立つ関数 n 選 zip __.zip(days, __.rest(days.concat([null]))) => [ [ 2017-07-01,

    2017-07-02 ], [ 2017-07-02, 2017-07-03 ], [ 2017-07-03, 2017-07-04 ], : [ 2017-07-11, null ] ] ͜͜·ͰདྷΕ͹উͪͰ͢Ͷ