Slide 1

Slide 1 text

Ruby 2.7ΫΠζ @hiromichinomata

Slide 2

Slide 2 text

ύλʔϯϚον case {a: 0, b: 1, c: 2} in {a: 0, i: 1} puts 1 in {a: 0, b: tmp} puts 2 in {a: 0, b: 1, c: tmp} puts 3 in {a: 0, b: 1, c: 2} puts 4 end ग़ྗ͞ΕΔจࣈ͸?

Slide 3

Slide 3 text

ύλʔϯϚον case {a: 0, b: 1, c: 2} in {a: 0, i: 1} puts 1 in {a: 0, b: tmp} puts 2 in {a: 0, b: 1, c: tmp} puts 3 in {a: 0, b: 1, c: 2} puts 4 end ౴͑: 2

Slide 4

Slide 4 text

irbʹ௥Ճ͞Εͨͷ͸? 1. ෳ਺ߦฤू 2. readline͕ෆཁʹ 3. ΫϥεɺϞδϡʔϧɺϝιουͷϦϑΝϨϯεΛͦͷ৔ Ͱ֬ೝͰ͖ΔΑ͏ʹ 4. inspect݁Ռʹ৭͕ͭ͘Α͏ʹ

Slide 5

Slide 5 text

irbʹ௥Ճ͞Εͨͷ͸? 1. ෳ਺ߦฤू 2. readline͕ෆཁʹ 3. ΫϥεɺϞδϡʔϧɺϝιουͷϦϑΝϨϯεΛͦͷ৔ Ͱ֬ೝͰ͖ΔΑ͏ʹ 4. inspect݁Ռʹ৭͕ͭ͘Α͏ʹ ౴͑: શ෦

Slide 6

Slide 6 text

ΩʔϫʔυҾ਺ͱͯ͠ڐ༰͞Ε Δͷ͸? 1. def foo(h, **kw); end; foo(key: 42) 2. def foo(h, key: 42); end; foo(key: 42) 3. def foo(**kw); end; foo({key: 42}) 4. def foo(h, key: 42); end; foo({key: 42})

Slide 7

Slide 7 text

ΩʔϫʔυҾ਺ͱͯ͠ڐ༰͞Ε Δͷ͸? 1. def foo(h, **kw); end; foo(key: 42) 2. def foo(h, key: 42); end; foo(key: 42) 3. def foo(**kw); end; foo({key: 42}) 4. def foo(h, key: 42); end; foo({key: 42}) =>

Slide 8

Slide 8 text

Ruby 2.7ΛίϯύΠϧ͢Δͷʹඞ ཁͳͷ͸? 1. C90 2. C99 3. C11 4. C17

Slide 9

Slide 9 text

Ruby 2.7ΛίϯύΠϧ͢Δͷʹඞ ཁͳͷ͸? 1. C90 2. C99 3. C11 4. C17

Slide 10

Slide 10 text

ิ଍: C99৽ػೳྫ * ม਺એݴ͕ϒϩοΫͷઌ಄͚ͩͰͳ͘࢖͍͍ͨ ͱ͖ʹએݴՄೳʹ * forจͷΧ΢ϯλม਺Λࣄલʹએݴෆཁʹ

Slide 11

Slide 11 text

ूܭϝιου ["a", "b", "c", "b"].xxx #=> {"a"=>1, "b"=>2, "c"=>1} 1. count_map 2. sum_map 3. pally 4. tally

Slide 12

Slide 12 text

ूܭϝιου ["a", "b", "c", "b"].xxx #=> {"a"=>1, "b"=>2, "c"=>1} 1. count_map 2. sum_map 3. pally 4. tally

Slide 13

Slide 13 text

ิ଍ • ӳޠͰtally͸צఆɺूܭ͢Δͱ͍͏ҙຯ

Slide 14

Slide 14 text

൪߸ࢦఆύϥϝλʔ [1,4,3].map{puts xxx} # => 1 4 3 1. _0 2. _1 3. $0 4. $1

Slide 15

Slide 15 text

൪߸ࢦఆύϥϝλʔ 1. _0 2. _1 3. $0 4. $1 [1,4,3].map{puts xxx} # => 1 4 3

Slide 16

Slide 16 text

ࢀߟ • https://www.ruby-lang.org/ja/news/ 2019/12/25/ruby-2-7-0-released/