List of user symbols

Q&A's, tips, howto's
Post Reply
cameyo
Posts: 109
Joined: Sun Mar 27, 2011 3:07 pm
Location: Italy

List of user symbols

Post by cameyo »

A function to list the user symbols:

Code: Select all

(define (user-symbols)
  (local (_func _other)
    (setq _func '())
    (setq _other '())
    (dolist (_el (symbols))
      (if (and (lambda? (eval _el))  
               (not (= _el 'user-symbols)))
          (push _el _func -1))
      (if (and (not (lambda? (eval _el)))
               (not (primitive? (eval _el)))
               (not (protected? _el))
               (not (global? _el))
               (not (= _el '_func))
               (not (= _el '_other))
               (not (= _el '_el)))
          (push _el _other -1))
    )
    (list _func _other)
  )
)

; from a fresh REPL of newLISP
(user-symbols)
;-> ((module) ())
cameyo

Post Reply