Anyhow, here's a full to-and-from conversion based on the challenge in that other thread:
(defun OSMode
->SnapList
(osmode
/ n
) '("END" "MID" "CEN" "NOD" "QUA" "INT" "INS" "PER" "TAN" "NEA" "APP" "EXT" "PAR"))))
(defun get
-SnapList
() (OSMode
->SnapList
(getvar 'OSMode
)))
(defun set
-SnapList
(Snaps
/ AllSnaps
) (setq AllSnaps '
("END" "MID" "CEN" "NOD" "QUA" "INT" "INS" "PER" "TAN" "NEA" "APP" "EXT" "PAR")) Snaps))))
And my version to list which bits are turned on:
(defun list
-bits
(num
/ pow val res
) res)
Gives a list stating the 0 based indexes of each bit set followed by its actual value. E.g.
_$ (list-bits 123456)
((6 . 64) (9 . 512) (13 . 8192) (14 . 16384) (15 . 32768) (16 . 65536))