Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
14
Task/Input-loop/FreeBASIC/input-loop.freebasic
Normal file
14
Task/Input-loop/FreeBASIC/input-loop.freebasic
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Dim line_ As String ' line is a keyword
|
||||
Open "input.txt" For Input As #1
|
||||
|
||||
While Not Eof(1)
|
||||
Input #1, line_
|
||||
Print line_ ' echo to the console
|
||||
Wend
|
||||
|
||||
Close #1
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
27
Task/Input-loop/FutureBasic/input-loop.futurebasic
Normal file
27
Task/Input-loop/FutureBasic/input-loop.futurebasic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
include "ConsoleWindow"
|
||||
|
||||
local fn ReadTextFile
|
||||
dim as CFURLRef fileRef
|
||||
dim as Handle h
|
||||
dim as CFStringRef cfStr : cfStr = NULL
|
||||
dim as long fileLen
|
||||
|
||||
if ( files$( _CFURLRefOpen, "TEXT", "Select text file...", @fileRef ) )
|
||||
open "i", 2, fileRef
|
||||
fileLen = lof( 2, 1 )
|
||||
h = fn NewHandleClear( fileLen )
|
||||
if ( h )
|
||||
read file 2, [h], fileLen
|
||||
close #2
|
||||
cfStr = fn CFStringCreateWithBytes( _kCFAllocatorDefault, #[h], fn GetHandleSize(h), _kCFStringEncodingMacRoman, _false )
|
||||
fn DisposeH( h )
|
||||
end if
|
||||
else
|
||||
// User canceled
|
||||
end if
|
||||
|
||||
fn HIViewSetText( sConsoleHITextView, cfStr )
|
||||
CFRelease( cfStr )
|
||||
end fn
|
||||
|
||||
fn ReadTextFile
|
||||
10
Task/Input-loop/Lasso/input-loop.lasso
Normal file
10
Task/Input-loop/Lasso/input-loop.lasso
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
local(
|
||||
myfile = file('//path/to/file.txt'),
|
||||
textresult = array
|
||||
)
|
||||
|
||||
#myfile -> foreachline => {
|
||||
#textresult -> insert(#1)
|
||||
}
|
||||
|
||||
#textresult -> join('<br />')
|
||||
4
Task/Input-loop/Nim/input-loop.nim
Normal file
4
Task/Input-loop/Nim/input-loop.nim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
var i = open("input.txt")
|
||||
for line in i.lines:
|
||||
discard # process line
|
||||
i.close()
|
||||
1
Task/Input-loop/Oforth/input-loop.oforth
Normal file
1
Task/Input-loop/Oforth/input-loop.oforth
Normal file
|
|
@ -0,0 +1 @@
|
|||
: readFile(filename) File new(filename) apply(#println) ;
|
||||
9
Task/Input-loop/Ring/input-loop.ring
Normal file
9
Task/Input-loop/Ring/input-loop.ring
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fp = fopen("C:\Ring\ReadMe.txt","r")
|
||||
|
||||
r = fgetc(fp)
|
||||
while isstring(r)
|
||||
r = fgetc(fp)
|
||||
if r = char(10) see nl
|
||||
else see r ok
|
||||
end
|
||||
fclose(fp)
|
||||
8
Task/Input-loop/Sidef/input-loop.sidef
Normal file
8
Task/Input-loop/Sidef/input-loop.sidef
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
var file = File(__FILE__)
|
||||
file.open_r(\var fh, \var err) || die "#{file}: #{err}"
|
||||
|
||||
fh.each { |line| # iterates the lines of the fh
|
||||
line.each_word { |word| # iterates the words of the line
|
||||
say word
|
||||
}
|
||||
}
|
||||
4
Task/Input-loop/Sparkling/input-loop.sparkling
Normal file
4
Task/Input-loop/Sparkling/input-loop.sparkling
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
var line;
|
||||
while (line = getline()) != nil {
|
||||
print(line);
|
||||
}
|
||||
5
Task/Input-loop/Ursa/input-loop.ursa
Normal file
5
Task/Input-loop/Ursa/input-loop.ursa
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
decl file f
|
||||
f.open "filename.txt"
|
||||
while (f.hasnext)
|
||||
out (in string f) endl console
|
||||
end while
|
||||
1
Task/Input-loop/jq/input-loop-1.jq
Normal file
1
Task/Input-loop/jq/input-loop-1.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
jq -r -R . FILENAME
|
||||
1
Task/Input-loop/jq/input-loop-2.jq
Normal file
1
Task/Input-loop/jq/input-loop-2.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
jq . FILENAME
|
||||
Loading…
Add table
Add a link
Reference in a new issue