LoginSignup
0
0

More than 5 years have passed since last update.

Advent of Code day4をPerl 6で

Posted at

こんにちは、7日目の投稿になります。
例によって投稿者がいなかったので、Advent of Code day4の私の回答を貼っておきます。

use v6;                                                                                                                                                

say +$*IN.lines>>.split(" ", :skip-empty)\                                                                                                             
.grep(-> @a { +Set(@a) == +@a  }); # (#1)
  • ポイント
    • -> @aでいったん@sigilの変数に代入を行い、2回目の呼び出し(+@aに相当する処理)の時にすでに消費されてしまっていて使えなくなるのを防ぎます (#1)

以上、7日目の投稿でした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0