-
Notifications
You must be signed in to change notification settings - Fork 1
/
help.cljc
45 lines (30 loc) · 798 Bytes
/
help.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(ns fif.stdlib.help
"Functions for learning about how to use fif."
(:require
[fif.stack-machine :as stack]
[fif.stack-machine.words :as words]))
(def arg-help-op 'help)
(def ^:dynamic *help-msg*
"
Fif Help Message
----------------
Website: github.com/benzap/fif
View all words with 'see-words'
View values on the stack with '.s'
Learn more about a specific word with 'see <word>'.
Words are categorized by group.
- View all of the groups with 'see-groups'
- View all of the words in a group with 'dir <group>'
")
(defn help-op
[sm]
(println *help-msg*)
(stack/dequeue-code sm))
(defn import-stdlib-help
[sm]
(-> sm
(words/set-global-word-defn
'help help-op
:stdlib? true
:group :stdlib.help
:doc "Display a help message.")))