IO

print


Builtin (print values) Print value(s) in the terminal

Note: No separator is put between the values. Adds a \n at the end

Parameter

  • values: the values to print

Author

@SuperFola

Example

(print "hello")

puts


Builtin (puts values) Print value(s) in the terminal

Note: No separator is put between the values, no \n at the end

Parameter

  • values: the values to print

Author

@SuperFola

Example

(puts "hello")

input


Builtin (input prompt) Request a value from the user

Note: Return the value as a string

Parameter

  • prompt: (optional) printed before asking for the user input

Author

@SuperFola

Example

(input "put a number> ")

writeFile


(let writeFile (fun (_name _content) (...))) Write content to a file. Return nil

Parameters

  • filename: path to the file to write to (will be overwritten if it exists)
  • content: can be any valid ArkScript value

Author

@SuperFola

Example

(io:writeFile "hello.json" "{\"key\": 12}")

appendToFile


(let appendToFile (fun (_name _content) (...))) Append content to a file. Return nil

Parameters

  • filename: path to the file to append to
  • content: can be any valid ArkScript value

Author

@SuperFola

Example

(io:writeFile "hello.json" "{\"key\": 12}")

readFile


(let readFile (fun (_name) (...))) Read the content from a file as a String

Parameter

  • filename: the path of the file to read

Author

@SuperFola

Example

(io:readFile "hello.json")

fileExists?


(let fileExists? (fun (_name) (...))) Check if a file exists, return True or False

Parameter

  • filename: the path of the file

Author

@SuperFola

Example

(io:fileExists? "hello.json")

listFiles


(let listFiles (fun (_path) (...))) List files in a folder, as a List of String

Parameter

  • path: A directory

Author

@SuperFola

Example

(io:listFiles "/tmp/hello")

dir?


(let dir? (fun (_path) (...))) Check if a path represents a directory

Parameter

  • path: A directory

Author

@SuperFola

Example

(io:dir? "/tmp/hello")

makeDir


(let makeDir (fun (_path) (...))) Create a directory

Parameter

  • path: A directory

Author

@SuperFola

Example

(io:makeDir "/tmp/myDir")

removeFile


(let removeFile (fun (_path) (...))) Delete file

Parameter

  • filename: path to file

Author

@SuperFola

Example

(io:removeFile "/tmp/test.ark")