mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
Cut (Prolog) hinzugefügt; weitere Scala-Beispiele hinzugefügt
This commit is contained in:
parent
6829f6cf97
commit
20994f6cc3
7 changed files with 101 additions and 1 deletions
|
@ -0,0 +1,13 @@
|
|||
object ThreeDice {
|
||||
def main(arg: Array[String]) {
|
||||
val dice_results = List(1, 2, 3, 4, 5, 6);
|
||||
var outcomes = for(a <- dice_results;
|
||||
b <- dice_results;
|
||||
c <- dice_results)
|
||||
yield a*b*c;
|
||||
println("%d / %d".
|
||||
format(
|
||||
outcomes.filter(x => x % 2 == 1).length,
|
||||
outcomes.length));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue