List of user symbols

Started by cameyo, July 09, 2020, 09:12:16 AM

Previous topic - Next topic

cameyo

A function to list the user symbols:
(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