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

Gotanda.pm #1

Gotanda.pm #1

Python使いから見たPerl @ Gotanda.pm #1

Mihyaeru

June 11, 2014
Tweet

More Decks by Mihyaeru

Other Decks in Programming

Transcript

  1. ࠷ॳʹࢥͬͨෆຬ w มͳه߸ଟͯ͘ҙຯෆ໌ w ίϯςΩετʁʁʁ w ຖճNZͬͯॻ͘ͷ໘౗͍͘͞ w ਅِ஋Σʜʜ w

    ϦϑΝϨϯεपΓ͕Θ͔Γʹ͍͘ w Ҿ਺Ϧετ͸Ͳ͜ʂʁ ʜଞʹ΋͔͋ͬͨ΋͚ͩͲ๨Εͨ͆
  2. ͜Μ͖ͯ͢ͱʁʁʁ @a = (0, 1, 2) Ϧετ
 ίϯςΩετ 0, 1,

    2 εΧϥʔ
 ίϯςΩετ 3 ཁૉ਺͕஌Γ͔ͨͬͨΒlen()ͱ͔໌ࣔతʹॻ͖͍ͨ ৔ॴʹΑͬͯҙຯ͢Δͱ͜Ζ͕ҧ͏ʜʜͩͱʜʜ
  3. ͪͳΈʹ w σϑΥϧτ஋Λ࢖ͬͨݺͼग़͠ w ී௨ͷݺͼग़͠ w Ωʔϫʔυݺͼग़͠ def hello(name =

    'mihyaeru'): print 'Hello, %s' % name ! hello() hello('dareka') hello(name = 'anata')
  4. ࠷ॳʹࢥͬͨෆຬࠓ͸ w มͳه߸ଟͯ͘ҙຯෆ໌ w ίϯςΩετʁʁʁ w ຖճNZͬͯॻ͘ͷ໘౗͍͘͞ w ਅِ஋Σʜʜ w

    ϦϑΝϨϯεपΓ͕Θ͔Γʹ͍͘ w Ҿ਺Ϧετ͸Ͳ͜ʂʁ ׳ΕΕ͹ා͘ͳ͍ʂ ׳ΕΕ͹ʢ͈́ ॻ͍ͨํ͕҆৺ײ͋Δ ਅِ஋Σʜʜ Ҿ਺ʹ໊લ͸ͳ͘୯ͳΔϦετ ະͩʹͬ͘͠Γ͜ͳ͍
  5. 1ZUIPOͩͱ [x * x for x in nums if x

    % 2 == 1] NBQʹ૬౰ HSFQʹ૬౰
  6. Ϧετ಺แදه [x * x for x in X if x

    % 2 == 1] {x2 | x ∈ X, x % 2 = 1} ਺ֶͷू߹ʹ͓͚Δ಺แతදه͕ݩʹͳ͍ͬͯΔ