date.clp
来自「一套美国国家宇航局人工智能中心NASA的专家系统工具源代码」· CLP 代码 · 共 27 行
CLP
27 行
; This is the date function
; for reasons of computational simplicity, the date is represented
; as an integer which represents days since jan 1 1900.
; because CLIPS does not capture the return of system calls, the intermediate
; value is stored in a file.
(deffunction get-now ()
(system "date '+%y%t%j' > datefile.dat")
(open "datefile.dat" datefile "r")
(bind ?year (read datefile))
(bind ?day (read datefile))
(close datefile)
( +(div ?year 4) (* ?year 365) ?day)
)
(deffunction elapsed-time (?date)
(- (get-now) ?date))
; is date more than 6 mo ago?
(deffunction six-months (?date)
(< 180 (elapsed-time ?date)))
; is date more than 5 years ago?
(deffunction five-years (?date)
(< 1826 (elapsed-time ?date)))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?