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)
(exit (value) exit the current program)
Date and Chrono
; Chrono
(chrono) : creates a chrono object
; Date methods
(date) Initializes a 'date' object.
(year d (nv -1)): returns the year (nv = -1) or modifies it)
(month d (nv -1)): returns the month (nv = -1) or modifies it)
(day d (nv -1)): returns the day (nv = -1) or changes it)
(hour d (nv -1)): returns the time (nv = -1) or changes it)
(minute d (nv -1)): returns the minute (nv = -1) or changes it)
(second d (nv -1)): returns the second (nv = -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 values (-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)
(date_format adate format): returns a string according to `format` implemented as C date format:
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")
(date_format d "%Y-%m-%d") ; Format : "2025-12-17"
(date_format d "%A %B %d, %Y") ; Format : "Tuesday December 17, 2025"
(date_format d "%H:%M:%S") ; Format : "14:30:25"