once и *Once

Sergey ShishkinSergey Shishkin
1 min read

once - выполняет prg один раз, когда текущий файл загружается в первый раз. Последующие загрузки в более позднее время не будут выполнять prg, и один раз вернет NIL.

(once . prg) -> any

(once
   (zero *Cnt1 *Cnt2)  # Init counters
   (load "file1.l" "file2.l") )  # Load other files

`(once T)  # Ignore next time the rest of this file

*Once - содержит дерево idx уже загруженных исходных расположений (как возвращенных с помощью файла)

: *Once
-> (("lib/" "misc.l" . 11) (("lib/" "http.l" . 9) (("lib/" "form.l" . 11))))

https://picolisp.tiddlyhost.com/#once

0
Subscribe to my newsletter

Read articles from Sergey Shishkin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sergey Shishkin
Sergey Shishkin

Всегда чему-то учусь!