Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1 @@
"path/to/file" f:open ( . cr ) f:eachline f:close

View file

@ -0,0 +1,21 @@
PROGRAM LETTURA
EXCEPTION
FERROR%=TRUE ! si e' verificata l'eccezione !
PRINT("Il file richiesto non esiste .....")
END EXCEPTION
BEGIN
FERROR%=FALSE
PRINT("Nome del file";)
INPUT(FILE$) ! chiede il nome del file
OPEN("I",1,FILE$) ! apre un file sequenziale in lettura
IF NOT FERROR% THEN
REPEAT
INPUT(LINE,#1,CH$) ! legge una riga ....
PRINT(CH$) ! ... la stampa ...
UNTIL EOF(1) ! ... fine a fine file
END IF
PRINT
CLOSE(1) ! chiude il file
END PROGRAM

View file

@ -0,0 +1,12 @@
' FB 1.05.0 Win64
Open "input.txt" For Input As #1
Dim line_ As String
While Not Eof(1)
Line Input #1, line_ '' read each line
Print line_ '' echo it to the console
Wend
Close #1
Print
Print "Press any key to quit"
Sleep

View file

@ -0,0 +1,6 @@
local(f) = file('foo.txt')
handle => {#f->close}
#f->forEachLine => {^
#1
'<br>' // note this simply inserts an HTML line break between each line.
^}

View file

@ -0,0 +1,11 @@
fp = xtra("fileIO").new()
fp.openFile(_movie.path & "input.txt", 1)
fileSize = fp.getLength()
repeat while TRUE
str = fp.readLine()
if str.char[1] = numtochar(10) then delete char 1 of str
if the last char of str = numtochar(13) then delete the last char of str
put str
if fp.getPosition()>=fileSize then exit repeat
end repeat
fp.closeFile()

View file

@ -0,0 +1,13 @@
command readFileLineByLine
local tFile, tLines, startRead
put "/usr/share/dict/words" into tFile
open file tFile for text read
put true into startRead
repeat until it is empty and startRead is false
put false into startRead
read from file tFile for 1 line
add 1 to tLines
end repeat
close file tFile
put tLines
end readFileLineByLine

View file

@ -0,0 +1,2 @@
for line in lines "input.txt":
echo line

View file

@ -0,0 +1,2 @@
: readFile(fileName)
| line | File new(fileName) forEach: line [ line println ] ;

View file

@ -0,0 +1,11 @@
constant fn = open(command_line()[2],"r")
integer lno = 1
object line
while 1 do
line = gets(fn)
if atom(line) then exit end if
printf(1,"%2d: %s",{lno,line})
lno += 1
end while
close(fn)
{} = wait_key()

View file

@ -0,0 +1,8 @@
fp = fopen("C:\Ring\ReadMe.txt","r")
r = ""
while isstring(r)
r = fgetc(fp)
if r = char(10) see nl
else see r ok
end
fclose(fp)

View file

@ -0,0 +1,3 @@
File(__FILE__).open_r.each { |line|
print line
}

View file

@ -0,0 +1,4 @@
var fh = File(__FILE__).open_r
while (fh.readline(\var line)) {
print line
}

View file

@ -0,0 +1,9 @@
let f = fopen("foo.txt", "r");
if f != nil {
var line;
while (line = fgetline(f)) != nil {
print(line);
}
fclose(f);
}

View file

@ -0,0 +1,5 @@
decl file f
f.open "filename.txt"
while (f.hasline)
out (in string f) endl console
end while

View file

@ -0,0 +1,2 @@
with infile "x"
drain (read_line)

View file

@ -0,0 +1,7 @@
$ seq 0 5 | jq -R 'tonumber|sin'
0
0.8414709848078965
0.9092974268256817
0.1411200080598672
-0.7568024953079282
-0.9589242746631385

View file

@ -0,0 +1,2 @@
$ seq 0 5 | jq -R 'tonumber|sin' | jq -s max
0.9092974268256817