8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ズンドコキヨシ.jl

Last updated at Posted at 2016-03-14

乗り遅れたズンドコキヨシを科学計算が得意な言語Juliaで書いてみます。

ベタなの。

function zundoko()
  zd = z, d, = ["ズン", "ドコ"]
  w1, w2, w3, w4, w5 = ("","","","","")
  while [w1, w2, w3, w4, w5] != [z, z, z, z, d]
    cw = rand(zd); print(cw); w1, w2, w3, w4, w5 = w2, w3, w4, w5, cw
  end
  print("キ・ヨ・シ!")
end

Array内包表記使ったやつ

function 🚶🏃👯()
  🚶, 🏃 = 🚶🏃 = ["ズン", "ドコ"]
  👯 = ""
  while 👯 != join([🚶,🚶,🚶,🚶,🏃])
    👯 = join([rand(🚶🏃) for i in 1:5])
    print(👯)
  end
  print("キ・ヨ・シ!")
end

syntax highlight壊れてるけど、関数名は🚶🏃👯()です。

本当はLazy.jlとmapreduce使えばもっとすっきり書けるのかもしれないけれど、Juliaの伝道師が降臨するに違いない

8
7
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
8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?