Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
12
Task/Input-loop/Elixir/input-loop.elixir
Normal file
12
Task/Input-loop/Elixir/input-loop.elixir
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
defmodule RC do
|
||||
def input_loop(stream) do
|
||||
case IO.read(stream, :line) do
|
||||
:eof -> :ok
|
||||
data -> IO.write data
|
||||
input_loop(stream)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
path = hd(System.argv)
|
||||
File.open!(path, [:read], fn stream -> RC.input_loop(stream) end)
|
||||
2
Task/Input-loop/Frink/input-loop.frink
Normal file
2
Task/Input-loop/Frink/input-loop.frink
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
while (line = readStdin[]) != undef
|
||||
println[line]
|
||||
3
Task/Input-loop/Perl-6/input-loop-1.pl6
Normal file
3
Task/Input-loop/Perl-6/input-loop-1.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for "filename.txt".IO.lines -> $line {
|
||||
...
|
||||
}
|
||||
3
Task/Input-loop/Perl-6/input-loop-2.pl6
Normal file
3
Task/Input-loop/Perl-6/input-loop-2.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for $*IN.lines -> $line {
|
||||
...
|
||||
}
|
||||
3
Task/Input-loop/Perl-6/input-loop-3.pl6
Normal file
3
Task/Input-loop/Perl-6/input-loop-3.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for pipe("find -iname '*.txt'").lines -> $filename {
|
||||
...
|
||||
}
|
||||
3
Task/Input-loop/Perl-6/input-loop-4.pl6
Normal file
3
Task/Input-loop/Perl-6/input-loop-4.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for pipe("find -iname '*.txt' -print0", :nl«\0»).lines -> $filename {
|
||||
...
|
||||
}
|
||||
3
Task/Input-loop/Perl-6/input-loop-5.pl6
Normal file
3
Task/Input-loop/Perl-6/input-loop-5.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for "filename.txt".IO.words -> $word {
|
||||
...
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
my $handle = open "filename.txt"; # $handle could be $*IN to read from standard input
|
||||
|
||||
for $handle.lines -> $line { # iterates the lines of the $handle
|
||||
|
||||
# line endings are automatically stripped
|
||||
|
||||
for $line.words -> $word { # iterates the words of the line
|
||||
# are considered words groups of non-whitespace characters
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue