Language detail: Fortress
Coverage: 3.05%
|
number of '+' ratings |
contribution for coverage |
Unsolved challenges
- 文字列で+を表示する (Nested Flatten)
- 年賀はがきの当せん番号 (Nested Flatten)
- 箱詰めパズルの判定 (Nested Flatten)
- 関数やメソッドのソースの平均行数 (Nested Flatten)
- コレクションの実装 (Nested Flatten)
codes
リストを逆順に表示
(Nested
Flatten)
1 2 3 4 5 6 7 8 9 10 11 12 | component doukaku239
import List.{...}
export Executable
run(args: String...): () = do
l = <|1, 2, 3, 4, 5|>
println l.reverse()
end
end
|
行列式の計算
(Nested
Flatten)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | component doukaku218
export Executable
det[\nat n\](M: Matrix[\RR64, n, n\]): RR64 = do
if n = 1 then
M[0, 0]
else
d: RR64 := 0
for j <- 0#n do
d += (-1)^j M[0, j] det(matrix[\RR64, n-1, n-1\]().fill(fn (k, l) =>
if l < j then M[k+1, l] else M[k+1, l+1] end))
end
d
end
end
run(args: String...): () = do
A: Matrix[\RR64, 2, 2\] = [1 2
3 4]
println det(A)
end
end
|
疑似並行処理
(Nested
Flatten)
疑似ではなくちゃんと並列になってる……はず.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | component doukaku215
import List.{...}
export Executable
run(args: String...): () = do
do
for i <- 0#10 do
t = spawn print i ", "
t.wait()
end
also do
for c <- <|"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"|> do
t = spawn print c ", "
t.wait()
end
end
print "\n"
end
end
|
ダブル完全数
(Nested
Flatten)
1 2 3 4 5 6 7 8 9 10 11 12 13 | component doukaku25
export Executable
run(args: String...): () = do
for n <- 2:10000 do
if (SUM[i <- 1:floor(n/2), (n MOD i) = 0] i) = 2 n then
println n
end
end
end
end
|
Hello, world!
(Nested
Flatten)
だいぶ前からFortressあるのに誰も使ってなかったので。
1 2 | export Executable
run(args) = print "Hello, world!\n"
|



陽炎 #8774() [ Fortress ] Rating0/0=0.00
component doukaku245 export Executable object NewException extends Exception toString(): String = "Exception occured!" end run(args: String...): () = do try throw NewException catch e NewException => fail(e.toString()) finally println("End of Exception test.") end end endRating0/0=0.00-0+
[ reply ]