Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -0,0 +1,7 @@
Local n := 0
DO WHILE .T.
? ++n
IF n % 6 == 0
EXIT
ENDIF
ENDDO

View file

@ -0,0 +1,5 @@
n := 0;
repeat
n := n + 1;
Print(n, "\n");
until RemInt(n, 6) = 0;

View file

@ -0,0 +1,8 @@
{
var (x, l) = (0, List[Int]())
do {
x += 1
l :+= x // A new copy of this list with List(x) appended.
} while (x % 6 != 0)
l
}.foreach(println(_))

View file

@ -0,0 +1,6 @@
def loop(iter: Int, cond: (Int) => Boolean, accu: List[Int]): List[Int] = {
val succ = iter + 1
val temp = accu :+ succ
if (cond(succ)) loop(succ, cond, temp) else temp
}
println(loop(0, (_ % 6 != 0), Nil))

View file

@ -0,0 +1,5 @@
def loop(i: Int, cond: (Int) => Boolean): Stream[Int] = {
val succ = i + 1;
succ #:: (if (cond(succ)) loop(succ, cond) else Stream.empty)
}
loop(0, (_ % 6 != 0)).foreach(println(_))

View file

@ -1,5 +0,0 @@
var x=0
do {
println(x)
x+=1
} while(x%6!=0)