# レンジ

まあRubyとかにもあるよね…

Main> [1..20]
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

Main> ['a'..'z']
"abcdefghijklmnopqrstuvwxyz"

Main> ['K'..'Z']

"KLMNOPQRSTUVWXYZ"
Main> ['K'..'z']
"KLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz"
2の倍数
Main> [2,4..20]
[2,4,6,8,10,12,14,16,18,20]
3の倍数
Main> [3,6..30]
[3,6,9,12,15,18,21,24,27,30]
2の2乗(無理)
Main> [1,2,4,8,16..100]
:60:12: parse error on input `..'
20からの減算
Main> [20,19..1]
[20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]

Main> [20..1]
[]
13の倍数
Main> [13,26..100]
[13,26,39,52,65,78,91]
13の倍数 24回
Main> [13,26..24*13]
[13,26,39,52,65,78,91,104,117,130,143,156,169,182,195,208,221,234,247,260,273,286,299,312]
takeを使って13の倍数 24回 (ただし、リスト自体は無限ループ)
Main> take 24 [13,26..]
[13,26,39,52,65,78,91,104,117,130,143,156,169,182,195,208,221,234,247,260,273,286,299,312]
[1,2,3]をcycleで繰り返し、take 10で10回止めにする
Main> take 10 (cycle [1,2,3])
[1,2,3,1,2,3,1,2,3,1]
Main> take 12 (cycle [ "LOL "])

Main> take 12 (cycle "LOL ")
"LOL LOL LOL "
Main> take 10 (repeat 5)
[5,5,5,5,5,5,5,5,5,5]
10を3回繰り返したリストを作成
Main> replicate 3 10
[10,10,10]

Main> [0.1, 0.3 .. 1]
[0.1,0.3,0.5,0.7,0.8999999999999999,1.0999999999999999]