vectors in pwgl

View: New views
2 Messages — Rating Filter:   Alert me  

vectors in pwgl

by marco_d :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hallo list

i have a question concerning lisp-programming in pwgl:

if i use a list of vectors (used in a lisp-code-box with (in-package :cl-user) )
i have some problems accessing this data.

for example in cl:
-------------
(setf vec '#((a 1) (b 2) (b 3) (a 4))))
(type-of vec) ;=> (simple-vector 4)
(svref vec 0) ;=> (a 1)
(type-of (first (svref vec 0))) ;=> symbol
(equal 'a (first (svref vec 0))) ;=> t
-------------

in pwgl i can lookup the symbol as well, but it appears as something like:

(svref vec 0)
                                PWGL-> (common-lisp-user::a 1)

(what does this mean )
then equal is not working because of some reasons i can't figure out...

maybe somebody can help me
i hope my question is not too stupied - i just started to work with lisp/pwgl

thanks a lot
marco

Re: pwgl-users: vectors in pwgl

by Mikael Laurson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Symbols are always inside a package, this is why 'a' in the text-
editor becomes
'common-lisp-user::a' when evaluated. If you want to avoid packages  
altogether you
could use keywords instead of symbols:

> (setf vec '#((:a 1) (:b 2) (:b 3) (:a 4))))

Mikael

On Jun 19, 2009, at 9:14 PM, marco_d wrote:

>
> hallo list
>
> i have a question concerning lisp-programming in pwgl:
>
> if i use a list of vectors (used in a lisp-code-box with (in-package
> :cl-user) )
> i have some problems accessing this data.
>
> for example in cl:
> -------------
> (setf vec '#((a 1) (b 2) (b 3) (a 4))))
> (type-of vec) ;=> (simple-vector 4)
> (svref vec 0) ;=> (a 1)
> (type-of (first (svref vec 0))) ;=> symbol
> (equal 'a (first (svref vec 0))) ;=> t
> -------------
>
> in pwgl i can lookup the symbol as well, but it appears as something  
> like:
>
> (svref vec 0)
> PWGL-> (common-lisp-user::a 1)
>
> (what does this mean )
> then equal is not working because of some reasons i can't figure  
> out...
>
> maybe somebody can help me
> i hope my question is not too stupied - i just started to work with
> lisp/pwgl
>
> thanks a lot
> marco
> --
> View this message in context: http://www.nabble.com/vectors-in-pwgl-tp24116481p24116481.html
> Sent from the PWGL mailing list archive at Nabble.com.
>