Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View 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)

View file

@ -0,0 +1,2 @@
while (line = readStdin[]) != undef
println[line]

View file

@ -0,0 +1,3 @@
for "filename.txt".IO.lines -> $line {
...
}

View file

@ -0,0 +1,3 @@
for $*IN.lines -> $line {
...
}

View file

@ -0,0 +1,3 @@
for pipe("find -iname '*.txt'").lines -> $filename {
...
}

View file

@ -0,0 +1,3 @@
for pipe("find -iname '*.txt' -print0", :nl«\0»).lines -> $filename {
...
}

View file

@ -0,0 +1,3 @@
for "filename.txt".IO.words -> $word {
...
}

View file

@ -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
}
}