Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,3 +1,6 @@
|
|||
for(i=1; i <= length(strs); i++) {
|
||||
print strs[i]
|
||||
BEGIN {
|
||||
n = split("Mary had a little lamb", strs, " ")
|
||||
for(i=1; i <= n; i++) {
|
||||
print strs[i]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
std::copy(container.begin(), container.end(),
|
||||
std::output_iterator<container_type::value_type>(std::cout, "\n"));
|
||||
std::ostream_iterator<container_type::value_type>(std::cout, "\n"));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <iterator_concepts>
|
||||
|
||||
for (auto element: container)
|
||||
{
|
||||
std::cout << element << "\n";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <iterator_concepts>
|
||||
|
||||
for (auto const& element: container)
|
||||
{
|
||||
std::cout << element << "\n";
|
||||
|
|
|
|||
4
Task/Loops-Foreach/C++/loops-foreach-6.cpp
Normal file
4
Task/Loops-Foreach/C++/loops-foreach-6.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for (auto&& element: container) //use a 'universal reference'
|
||||
{
|
||||
element += 42;
|
||||
}
|
||||
3
Task/Loops-Foreach/ColdFusion/loops-foreach.cfm
Normal file
3
Task/Loops-Foreach/ColdFusion/loops-foreach.cfm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<Cfloop list="Fee, Fi, Foe, Fum" index="i">
|
||||
<Cfoutput>#i#!</Cfoutput>
|
||||
</Cfloop>
|
||||
2
Task/Loops-Foreach/Emacs-Lisp/loops-foreach-1.l
Normal file
2
Task/Loops-Foreach/Emacs-Lisp/loops-foreach-1.l
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(dolist (x '(1 2 3 4))
|
||||
(message "x=%d" x))
|
||||
3
Task/Loops-Foreach/Emacs-Lisp/loops-foreach-2.l
Normal file
3
Task/Loops-Foreach/Emacs-Lisp/loops-foreach-2.l
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(mapc (lambda (x)
|
||||
(message "x=%d" x))
|
||||
'(1 2 3 4))
|
||||
24
Task/Loops-Foreach/Euphoria/loops-foreach.euphoria
Normal file
24
Task/Loops-Foreach/Euphoria/loops-foreach.euphoria
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
include std/console.e
|
||||
|
||||
sequence s = {-2,-1,0,1,2} --print elements of a numerical list
|
||||
for i = 1 to length(s) do
|
||||
? s[i]
|
||||
end for
|
||||
|
||||
puts(1,'\n')
|
||||
|
||||
s = {"Name","Date","Field1","Field2"} -- print elements of a list of 'strings'
|
||||
for i = 1 to length(s) do
|
||||
printf(1,"%s\n",{s[i]})
|
||||
end for
|
||||
|
||||
puts(1,'\n')
|
||||
|
||||
for i = 1 to length(s) do -- print subelements of elements of a list of 'strings'
|
||||
for j = 1 to length(s[i]) do
|
||||
printf(1,"%s\n",s[i][j])
|
||||
end for
|
||||
puts(1,'\n')
|
||||
end for
|
||||
|
||||
if getc(0) then end if
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
for i in collect do
|
||||
(
|
||||
print i
|
||||
)
|
||||
arr = for i in 1 to 50 collect ("Number: " + (random 10 99) as string)
|
||||
makeuniquearray arr
|
||||
sort arr
|
||||
|
||||
for i in arr do print i as string
|
||||
|
|
|
|||
1
Task/Loops-Foreach/NewLISP/loops-foreach.newlisp
Normal file
1
Task/Loops-Foreach/NewLISP/loops-foreach.newlisp
Normal file
|
|
@ -0,0 +1 @@
|
|||
(map println '(Apple Banana Coconut))
|
||||
7
Task/Loops-Foreach/Prolog/loops-foreach.pro
Normal file
7
Task/Loops-Foreach/Prolog/loops-foreach.pro
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
?- foreach(member(X, [red,green,blue,black,white]), writeln(X)).
|
||||
red
|
||||
green
|
||||
blue
|
||||
black
|
||||
white
|
||||
true.
|
||||
|
|
@ -5,6 +5,6 @@ for eachline in f:
|
|||
for eachword in eachline.split():
|
||||
words += 1
|
||||
for eachchar in eachword:
|
||||
chracters += 1
|
||||
characters += 1
|
||||
|
||||
print lines, words, characters
|
||||
|
|
|
|||
7
Task/Loops-Foreach/Python/loops-foreach-3.py
Normal file
7
Task/Loops-Foreach/Python/loops-foreach-3.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
d = {3: "Earth", 1: "Mercury", 4: "Mars", 2: "Venus"}
|
||||
for k in sorted(d):
|
||||
print("%i: %s" % (k, d[k]))
|
||||
|
||||
d = {"London": "United Kingdom", "Berlin": "Germany", "Rome": "Italy", "Paris": "France"}
|
||||
for k in sorted(d):
|
||||
print("%s: %s" % (k, d[k]))
|
||||
3
Task/Loops-Foreach/Python/loops-foreach-4.py
Normal file
3
Task/Loops-Foreach/Python/loops-foreach-4.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
d = {"fortytwo": 42, 3.14159: "pi", 23: "twentythree", "zero": 0, 13: "thirteen"}
|
||||
for k in sorted(d):
|
||||
print("%s: %s" % (k, d[k]))
|
||||
|
|
@ -2,4 +2,5 @@ days = 'zuntik montik dinstik mitvokh donershtik fraytik shabes'
|
|||
|
||||
do j=1 for words(days) /*loop through days of the week. */
|
||||
say word(days,j) /*display the weekday to screen. */
|
||||
end /*j*//*stick a fork in it, we're done.*/
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
3
Task/Loops-Foreach/Vim-Script/loops-foreach.vim
Normal file
3
Task/Loops-Foreach/Vim-Script/loops-foreach.vim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for i in ["alpha", "beta", 42, 5.54]
|
||||
echo i
|
||||
endfor
|
||||
Loading…
Add table
Add a link
Reference in a new issue