5.6 System Functions - naver/lispe GitHub Wiki

System

back

(command (cmd) Executes a system command and returns the result as a list)
(setenv (name value) Creates or modifies an environment variable)
(getenv (name) Retrieves the value of an environment variable)
(fileinfo (path) Returns information about a file)
(realpath (path) Returns the full path corresponding to a partial path)
(ls (path) returns the contents of a directory)
(isdirectory (path) checks if 'path' is a directory)

Date and Chrono

; Chrono
(chrono) : creates a chrono object

; Date methods
(date) Initializes a 'date' object.
(year (date (d -1)) year(int d): returns the year (d = -1) or modifies it)
(month (date (d -1)) month(int d): returns the month (d = -1) or modifies it)
(day (date (d -1)) day(int d): returns the day (d = -1) or changes it)
(hour (date (d -1)) hour(int d): returns the time (d = -1) or changes it)
(minute (date (d -1)) minute(int d): returns the minute (d = -1) or changes it)
(second (date (d -1)) second(int d): returns the second (d = -1) or modifies it)
(setdate(y (m -1) (d -1) (H -1) (M -1) (S -1)) setdate(y,m,d,H,M,S): Creates a date from its compasantes (-1 for the default value))
(yearday (date) yearday(): returns the number of the day in the year)
(weekday (date) weekday(): returns the day of the week)

Examples


; Using dates

(setq d (date))
(println "Year:" (year d))

; We initialise a first chrono value
(setq beginning (chrono))

; ... We do some stuff here

(setq end (chrono))

(println "The stuff took:" (- end beginning) "ms")