Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -1,3 +1,3 @@
|
|||
printAll(4, 3, 5, 6, 4, 3)
|
||||
printAll(4, 3, 5)
|
||||
printAll("Rosetta", "Code", "Is", "Awseome!")
|
||||
printAll("Rosetta", "Code", "Is", "Awesome!")
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
args := ["Rosetta", "Code", "Is", "Awseome!"]
|
||||
args := ["Rosetta", "Code", "Is", "Awesome!"]
|
||||
printAll(args*)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void showSum2(int[4] items...) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
printAll(4, 5.6, "Rosetta", "Code", "is", "awseome");
|
||||
printAll(4, 5.6, "Rosetta", "Code", "is", "awesome");
|
||||
writeln();
|
||||
showSum1(1, 3, 50);
|
||||
showSum2(1, 3, 50, 10);
|
||||
|
|
|
|||
6
Task/Variadic-function/Deja-Vu/variadic-function.djv
Normal file
6
Task/Variadic-function/Deja-Vu/variadic-function.djv
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
show-all(:
|
||||
while /= ) dup:
|
||||
!.
|
||||
drop
|
||||
|
||||
show-all( :foo "Hello" 42 [ true ] )
|
||||
|
|
@ -14,4 +14,4 @@ printAll = process []
|
|||
main :: IO ()
|
||||
main = do printAll 5 "Mary" "had" "a" "little" "lamb"
|
||||
printAll 4 3 5
|
||||
printAll "Rosetta" "Code" "Is" "Awseome!"
|
||||
printAll "Rosetta" "Code" "Is" "Awesome!"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
printAll(4, 3, 5, 6, 4, 3);
|
||||
printAll(4, 3, 5);
|
||||
printAll("Rosetta", "Code", "Is", "Awseome!");
|
||||
printAll("Rosetta", "Code", "Is", "Awesome!");
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
Object[] args = {"Rosetta", "Code", "Is", "Awseome!"};
|
||||
Object[] args = {"Rosetta", "Code", "Is", "Awesome!"};
|
||||
printAll(args);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
Object[] args = {"Rosetta", "Code", "Is", "Awseome,"};
|
||||
Object[] args = {"Rosetta", "Code", "Is", "Awesome,"};
|
||||
printAll(args, "Dude!");//does not print "Rosetta Code Is Awesome, Dude!"
|
||||
//instead prints the type and hashcode for args followed by "Dude!"
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ function printAll() {
|
|||
}
|
||||
printAll(4, 3, 5, 6, 4, 3);
|
||||
printAll(4, 3, 5);
|
||||
printAll("Rosetta", "Code", "Is", "Awseome!");
|
||||
printAll("Rosetta", "Code", "Is", "Awesome!");
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
args = ["Rosetta", "Code", "Is", "Awseome!"]
|
||||
args = ["Rosetta", "Code", "Is", "Awesome!"]
|
||||
printAll.apply(null, args)
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
bar(a,b,x...) = (a,b,x)
|
||||
julia> print_each(X...) = for x in X; println(x); end
|
||||
|
||||
julia> print_each(1, "hello", 23.4)
|
||||
1
|
||||
hello
|
||||
23.4
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
julia> bar(1,2)
|
||||
(1,2,())
|
||||
julia> args = [ "first", (1,2,17), "last" ]
|
||||
3-element Array{Any,1}:
|
||||
"first"
|
||||
(1,2,17)
|
||||
"last
|
||||
|
||||
julia> bar(1,2,3)
|
||||
(1,2,(3,))
|
||||
|
||||
julia> bar(1,2,3,4)
|
||||
(1,2,(3,4))
|
||||
|
||||
julia> bar(1,2,3,4,5,6)
|
||||
(1,2,(3,4,5,6))
|
||||
julia> print_each(args...)
|
||||
first
|
||||
(1,2,17)
|
||||
last
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ void logObjects(id firstObject, ...) // <-- there is always at least one arg, "n
|
|||
}
|
||||
|
||||
// This function can be called with any number or type of objects, as long as you terminate it with "nil":
|
||||
logObjects(@"Rosetta", @"Code", @"Is", @"Awseome!", nil);
|
||||
logObjects(@"Rosetta", @"Code", @"Is", @"Awesome!", nil);
|
||||
logObjects([NSNumber numberWithInt:4],
|
||||
[NSNumber numberWithInt:3],
|
||||
@"foo", nil);
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ function printAll() {
|
|||
}
|
||||
printAll(4, 3, 5, 6, 4, 3);
|
||||
printAll(4, 3, 5);
|
||||
printAll("Rosetta", "Code", "Is", "Awseome!");
|
||||
printAll("Rosetta", "Code", "Is", "Awesome!");
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
$args = array("Rosetta", "Code", "Is", "Awseome!");
|
||||
$args = array("Rosetta", "Code", "Is", "Awesome!");
|
||||
call_user_func_array('printAll', $args);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
print_all(4, 3, 5, 6, 4, 3);
|
||||
print_all(4, 3, 5);
|
||||
print_all("Rosetta", "Code", "Is", "Awseome!");
|
||||
print_all("Rosetta", "Code", "Is", "Awesome!");
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
@args = ("Rosetta", "Code", "Is", "Awseome!");
|
||||
@args = ("Rosetta", "Code", "Is", "Awesome!");
|
||||
print_all(@args);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
print_all(4, 3, 5, 6, 4, 3)
|
||||
print_all(4, 3, 5)
|
||||
print_all("Rosetta", "Code", "Is", "Awseome!")
|
||||
print_all("Rosetta", "Code", "Is", "Awesome!")
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
args = ["Rosetta", "Code", "Is", "Awseome!"]
|
||||
args = ["Rosetta", "Code", "Is", "Awesome!"]
|
||||
print_all(*args)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
print_all: procedure
|
||||
print_all: procedure /* [↓] is the # of args passed.*/
|
||||
do j=1 for arg()
|
||||
say arg(j)
|
||||
say arg(j)
|
||||
end /*j*/
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
print_all: procedure
|
||||
print_all: procedure /* [↓] is the # of args passed.*/
|
||||
do j=1 for arg()
|
||||
say '[argument' j"]: " arg(j)
|
||||
say '[argument' j"]: " arg(j)
|
||||
end /*j*/
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
call print_all .1,5,2,4,-3, 4.7e1, 013.000 ,, 8**2 -3, sign(-66), abs(-71.00), 1 || 1, 'seven numbers are prime, 8th is null'
|
||||
|
||||
call print_all "Hello", "World", "Bang", "Slash-N"
|
||||
call print_all .1,5,2,4,-3, 4.7e1, 013.000 ,, 8**2 -3, sign(-66), abs(-71.00), 8 || 6, 'seven numbers are prime, 8th is null'
|
||||
|
||||
call print_all "One ringy-dingy,",
|
||||
"two ringy-dingy,",
|
||||
"three ringy-dingy...",
|
||||
"Hello? This is Ma Bell.",
|
||||
"Have you been misusing your instrument?",
|
||||
"(Lily Tomlin routine)" /*example showing multi-line arguments.*/
|
||||
"(Lily Tomlin routine)"
|
||||
|
||||
/* [↑] example showing multi-line arguments.*/
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ END SUBI
|
|||
|
||||
printAll 4, 3, 5, 6, 4, 3
|
||||
printAll 4, 3, 5
|
||||
printAll "Rosetta", "Code", "Is", "Awseome!"
|
||||
printAll "Rosetta", "Code", "Is", "Awesome!"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
print_all(4, 3, 5, 6, 4, 3)
|
||||
print_all(4, 3, 5)
|
||||
print_all("Rosetta", "Code", "Is", "Awseome!")
|
||||
print_all("Rosetta", "Code", "Is", "Awesome!")
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
args = ["Rosetta", "Code", "Is", "Awseome!"]
|
||||
args = ["Rosetta", "Code", "Is", "Awesome!"]
|
||||
print_all(*args)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
(print-all 4 3 5 6 4 3)
|
||||
(print-all 4 3 5)
|
||||
(print-all "Rosetta" "Code" "Is" "Awseome!")
|
||||
(print-all "Rosetta" "Code" "Is" "Awesome!")
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
(define args '("Rosetta" "Code" "Is" "Awseome!"))
|
||||
(define args '("Rosetta" "Code" "Is" "Awesome!"))
|
||||
(apply print-all args)
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ function printAll(separator,argv..) {
|
|||
}
|
||||
printAll(" ", 4, 3, 5, 6, 4, 3);
|
||||
printAll(",", 4, 3, 5);
|
||||
printAll("! ","Rosetta", "Code", "Is", "Awseome");
|
||||
printAll("! ","Rosetta", "Code", "Is", "Awesome");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue