Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -1,5 +1,3 @@
|
|||
<cfset i = 1024 />
|
||||
<cfloop condition="i GT 0">
|
||||
#i#< br />
|
||||
<cfset i = 1024 /><cfloop condition="i GT 0"> #i#< br />
|
||||
<cfset i /= 2 />
|
||||
</cfloop>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<cfscript>
|
||||
i = 1024;
|
||||
<cfscript> i = 1024;
|
||||
while( i > 0 )
|
||||
{
|
||||
writeOutput( i + "< br/ >" );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
%% Implemented by Arjun Sunel
|
||||
-module(while).
|
||||
-export([loop/0]).
|
||||
|
||||
|
|
|
|||
5
Task/Loops-While/GAP/loops-while.gap
Normal file
5
Task/Loops-While/GAP/loops-while.gap
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
n := 1024;
|
||||
while n > 0 do
|
||||
Print(n, "\n");
|
||||
n := QuoInt(n, 2);
|
||||
od;
|
||||
|
|
@ -1,22 +1,12 @@
|
|||
> n := 1024: while n > 0 do print(n); n := iquo(n,2) end:
|
||||
1024
|
||||
|
||||
512
|
||||
|
||||
256
|
||||
|
||||
128
|
||||
|
||||
64
|
||||
|
||||
32
|
||||
|
||||
16
|
||||
|
||||
8
|
||||
|
||||
4
|
||||
|
||||
2
|
||||
|
||||
1
|
||||
|
|
|
|||
6
Task/Loops-While/Neko/loops-while.neko
Normal file
6
Task/Loops-While/Neko/loops-while.neko
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var a = 5;
|
||||
var i = 0;
|
||||
|
||||
while(i < a) {
|
||||
i = i + 1;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
/*REXX program to show a DO WHILE construct. */
|
||||
j=1024
|
||||
do while j>0
|
||||
say j
|
||||
j=j%2 /*in REXX, % is integer division. */
|
||||
end
|
||||
/*REXX program demonstrates a DO WHILE with index reduction construct.*/
|
||||
j=1024 /*define the initial value of J.*/
|
||||
do while j>0 /*test if made at the top of DO.*/
|
||||
say j
|
||||
j=j%2 /*in REXX, % is integer division.*/
|
||||
end
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/*REXX program to show a DO WHILE construct. */
|
||||
x=1024
|
||||
do while x>0
|
||||
say right(x,10) /*pretty up the output by aligning.*/
|
||||
x=x%2 /*in REXX, % is integer division. */
|
||||
end
|
||||
/*REXX program demonstrates a DO WHILE with index reduction construct.*/
|
||||
x=1024 /*define the initial value of X.*/
|
||||
do while x>0 /*test if made at the top of DO.*/
|
||||
say right(x,10) /*pretty output by aligning right*/
|
||||
x=x%2 /*in REXX, % is integer division.*/
|
||||
end
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/*REXX program to show a DO WHILE construct. */
|
||||
x=1024
|
||||
do while x>>0 /*this is an exact comparison. */
|
||||
say right(x,10) /*pretty up the output by aligning.*/
|
||||
x=x%2 /*in REXX, % is integer division. */
|
||||
end
|
||||
/*REXX program demonstrates a DO WHILE with index reduction construct.*/
|
||||
x=1024 /*define the initial value of X.*/
|
||||
do while x>>0 /*this is an exact comparison. */
|
||||
say right(x,10) /*pretty output by aligning right*/
|
||||
x=x%2 /*in REXX, % is integer division.*/
|
||||
end
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
7
Task/Loops-While/REXX/loops-while-4.rexx
Normal file
7
Task/Loops-While/REXX/loops-while-4.rexx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/*REXX program demonstrates a DO WHILE with index reduction construct.*/
|
||||
/* [↓] note: BY defaults to 1*/
|
||||
do j=1024 by 0 while j>>0 /*this is an exact comparison. */
|
||||
say right(j,10) /*pretty output by aligning right*/
|
||||
j=j%2 /*in REXX, % is integer division.*/
|
||||
end
|
||||
/*stick a fork in it, we're done.*/
|
||||
11
Task/Loops-While/Racket/loops-while-2.rkt
Normal file
11
Task/Loops-While/Racket/loops-while-2.rkt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#lang racket
|
||||
(define-syntax-rule (while condition body ...)
|
||||
(let loop ()
|
||||
(when condition
|
||||
body ...
|
||||
(loop))))
|
||||
|
||||
(define n 0)
|
||||
(while (< n 10)
|
||||
(displayln n)
|
||||
(set! n (add1 n)))
|
||||
8
Task/Loops-While/Scala/loops-while-2.scala
Normal file
8
Task/Loops-While/Scala/loops-while-2.scala
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
@tailrec
|
||||
def loop(iter: Int) {
|
||||
if ((iter > 0)) {
|
||||
println(iter)
|
||||
loop(iter / 2)
|
||||
}
|
||||
}
|
||||
loop(1024)
|
||||
6
Task/Loops-While/Scala/loops-while-3.scala
Normal file
6
Task/Loops-While/Scala/loops-while-3.scala
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def loop = new Iterator[Int] {
|
||||
var i = 1024
|
||||
def hasNext = i > 0
|
||||
def next(): Int = { val tmp = i; i = i / 2; tmp }
|
||||
}
|
||||
loop.foreach(println(_))
|
||||
2
Task/Loops-While/Scala/loops-while-4.scala
Normal file
2
Task/Loops-While/Scala/loops-while-4.scala
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def loop(i: Int): Stream[Int] = i #:: (if (i > 0) loop(i / 2) else Stream.empty)
|
||||
loop(1024).takeWhile(_ > 0).foreach(println(_))
|
||||
6
Task/Loops-While/Suneido/loops-while.suneido
Normal file
6
Task/Loops-While/Suneido/loops-while.suneido
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
i = 1024
|
||||
while (i > 0)
|
||||
{
|
||||
Print(i)
|
||||
i = (i / 2).Floor()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue