Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ 15:15 〜 第2回 ひどいコード選手権 #19

Open
takezoux2 opened this issue Mar 19, 2022 · 11 comments
Open

✅ 15:15 〜 第2回 ひどいコード選手権 #19

takezoux2 opened this issue Mar 19, 2022 · 11 comments
Labels
discussion Session idea to discuss a certain topic. / 議論したい場合のラベル

Comments

@takezoux2
Copy link

takezoux2 commented Mar 19, 2022

第2回 ひどいScalaコード選手権

これはひどい!となるコードを書きましょう

前回: scalamatsuri/2020.unconference#16

@kzmake
Copy link

kzmake commented Mar 19, 2022

第一回: https://youtu.be/GwONLLoKZTo

@taketora26 taketora26 added the discussion Session idea to discuss a certain topic. / 議論したい場合のラベル label Mar 19, 2022
@taketora26
Copy link
Collaborator

DIscordでやりたい人を募集して、午後にひどいコードの投票と表彰式を行う。

@omiend omiend changed the title 第2回 ひどいコード選手権 ✅ 15:15 〜 第2回 ひどいコード選手権 Mar 20, 2022
@omiend
Copy link
Member

omiend commented Mar 20, 2022

ひどいコードができたら、Discord の「#第2回-ひどいコード選手権」まで!

https://discord.com/channels/934288800560054292/954919131860320306

@takezoux2
Copy link
Author

takezoux2 commented Mar 20, 2022

omiendさん
無駄なパターンマッチ
https://scastie.scala-lang.org/uTTeeLWnTmmisEEZ4iFZyg

@takezoux2
Copy link
Author

takezoux2 commented Mar 20, 2022

takezoux2
仕様不明
https://gist.github.com/takezoux2/9a7dcef0e51294c7462e37275200bae7#file-cant_decide_spec-scala

@takezoux2
Copy link
Author

takezoux2
例外握りつぶし
https://gist.github.com/takezoux2/9a7dcef0e51294c7462e37275200bae7#file-destroy_exception-scala

@takezoux2
Copy link
Author

takezoux2 commented Mar 20, 2022

aoinoさん
ひどいWordle resolver
https://github.com/aoiroaoino/scalamatsuri2022-hidoi-wordle-solver

@takezoux2
Copy link
Author

takezoux2 commented Mar 20, 2022

omiendさん
yieldの中でmap
https://scastie.scala-lang.org/JBA02QeDTgCXlekXudJoLw

@takezoux2
Copy link
Author

takezoux2 commented Mar 20, 2022

taketoraさん
よく書くretry
https://scastie.scala-lang.org/GUWSenaKQs2dWk3lwmXFWA

@takezoux2
Copy link
Author

takezoux2 commented Mar 20, 2022

Alyさん
https://scastie.scala-lang.org/RnJMJ0ZsSo2XicsoS6PsSw

@takezoux2
Copy link
Author

優勝はAlyさん
正規表現で素因数分解
保全のため、コピペ

val composites = "^(#{2,}?)\\1+$".r

def factors(i: Int): List[Int] = {
  "#".repeat(i) match {
    case composites(factor) =>
      factor.length :: factors(i / factor.length)
    case _ =>
      i :: Nil
  }
}

(2 to 100).foreach { n =>
  println(s"$n = ${factors(n).mkString(" × ")}")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Session idea to discuss a certain topic. / 議論したい場合のラベル
Projects
None yet
Development

No branches or pull requests

4 participants