Commit | Line | Data |
---|---|---|
13e679cd NB |
1 | ;; Like load-file, but will never load the same path twice. |
2 | ||
3 | ;; This file is normally loaded with `load-file`, so it needs a | |
4 | ;; different mechanism to neutralize multiple inclusions of | |
5 | ;; itself. Moreover, the file list should never be reset. | |
6 | ||
7 | (def! load-file-once | |
8 | (try* | |
9 | load-file-once | |
10 | (catch* _ | |
11 | (let* [seen (atom {"../lib/load-file-once.mal" nil})] | |
12 | (fn* [filename] | |
13 | (if (not (contains? @seen filename)) | |
14 | (do | |
15 | (swap! seen assoc filename nil) | |
16 | (load-file filename)))))))) |