request for symbols

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

request for symbols

Post by newdep »

Hi Lutz,

How can I get from 'MAIN (because i always work in MAIN all the new (symbols)
from my program?

Currently (symbols) does display it but its a sortened list .. and I cant pick out
the symbols i just added..

Perhpas you could change default MAIN (symbols) behaviour?
so.. that it displays different parts?

Part #1
All internal newlisp symbols from MAIN

Part #2
All symbols added to newlisp not from newlisp by default.
(This includes also init.lsp and varibles from user program but not seperate contexts)


Norman.
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

PS: im not seeking something like this ;-)

(difference (map string (symbols)) (map string (old-symbols)))
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

But more somthing like this ->

> (symbols)

( newlisp ' (! != $ $0 $1 $10 $11 $12 $13 $14 $15 $2 $3 $4 $5 $6 $7 $8 $9 $HOME
$args $main-args % & * + - / < << <= = > >= >> ? @ MAIN MY NaN?
^ _arguments _func _func-name abs acos add address amb and append
append-file apply args array array-list array? asin assoc atan atan2
atom? base64-dec base64-enc bayes-query bayes-train begin beta betai
binomial case catch ceil change-dir char chop close command-line
cond cons constant context context? contexts copy-file cos count
cpymem crc32 crit-chi2 crit-z current-line date date-value debug
dec def-new define define-macro defun delete delete-file device
difference directory directory? div do-until do-while dolist dotimes
dotree dump dup edit empty? encrypt ends-with env erf error error-event
error-number error-text eval eval-string exec exit exp expand explode
factor fft file-info file? filter find first flat float float? floor
flt for fork format fv gammai gammaln get-char get-float get-int
get-integer get-string get-url global help if ifft import inc index
int integer integer? intersect invert irr join lambda? last legal?
length let letn list list? load log lookup lower-case macro? main-args
make-dir map match max member min mod mul multiply name net-accept
net-close net-connect net-error net-eval net-listen net-local net-lookup
net-peek net-peer net-ping net-receive net-receive-from net-receive-udp
net-select net-send net-send-to net-send-udp net-service net-sessions
new nil nil? normal not now nper npv nth nth-set number? open or
pack parse peek pipe pmt pop post-url pow pretty-print primitive?
print println prob-chi2 prob-z process push put-url pv q quote quote?
rand random randomize read-buffer read-char read-file read-key read-line
ref regex remove-dir rename-file replace replace-assoc reset rest
reverse rotate save search seed seek select semaphore sequence series
set set! set-locale set-nth setq sgn share signal silent sin sleep
slice sort source sqrt starts-with string string? sub swap sym symbol
symbol? symbols sys-error sys-info tan throw throw-error time time-of-day
timer title-case trace trace-highlight transpose trim true true?
unique unless unpack until upper-case wait-pid while write-buffer
write-char write-file write-line xml-error xml-parse xml-type-tags
| ~)

init '( functions here etc )

users '( my own symbols are listed here in a FIFO way )

contexts '( () )

)
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

You could do something like this:

Code: Select all

(define (mysyms )
  (filter (lambda (s) (and (not (primitive? (eval s))) 
                           (not (starts-with (name s) "$")))) 
          (symbols MAIN)))
an filter out some others like 'nil', 'true', '?', '@' etc.

Lutz

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

I just realized that newlisp-tk has this ofcourse, Ill sneek around there ;-)
-- (define? (Cornflakes))

Locked