Defining types
Posted: Fri Jun 29, 2007 1:08 pm
Is it possible to define new types in newlisp?
Friends and Fans of newLISP
http://www.newlispfanclub.alh.net/forum/
http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=5&t=1769
Code: Select all
(set 'x "hello"
(set 'y x) => "hello"
Code: Select all
(set 's "content of s")
(set 'x 's) => s
(set 'y x) => s
(eval x) => "content of s"
(eval y) => "content of s"
Code: Select all
(pop s) => "c"
(eval x) => "ontent of s"
(eval y) => "ontent of s"
(pop (evall x)) = "o"
(eval y) => "ntent of s"
yes, you still could do this:Is there a way to discover symbols that point to a value?
Code: Select all
(set 'x "hello")
(set 'y "hello")
(filter (fn (s) (= "hello" (eval s))) (symbols)) => (x y)
yes that would be possible, you could create a reversed index:Ooo! A reverse lookup! Interesting idea. Lutz?
Code: Select all
(set 'x "hello")
(set 'y 123)
; create a reverse index in Idx
(map (fn (s) (set (sym (string (eval s)) 'Idx) s )) (symbols))
(context Idx "hello") => x
(context Idx "123") => y