How do I define a keyword as a integer constant?

Discussion of Common Lisp

Re: How do I define a keyword as a integer constant?

Postby joeish80829 » Mon May 12, 2014 3:39 am

You mentioned "You cannot. There is no "direct" way to associate a "value" to a keyword without some indirection" is there a way inolving redirection that would be under .10 seconds per million iterations...I could sure use an example
joeish80829
 
Posts: 153
Joined: Tue Sep 03, 2013 5:32 am

Re: How do I define a keyword as a integer constant?

Postby marcoxa » Mon May 12, 2014 5:13 am

joeish80829 wrote:You mentioned "You cannot. There is no "direct" way to associate a "value" to a keyword without some indirection" is there a way inolving redirection that would be under .10 seconds per million iterations...I could sure use an example


I go by the maxim "first get it right, then get it fast". What you want is the constant which you initialize beforehand. It's the right way to do it. Forget about the keyword (or hack Emacs/Slime highlighting).

If you want you can do

Code: Select all
(defenum foo ((baz #.(cffi:foreing-enum-value 'foo :baz))) ; etc


Now you will have a mapping to the "constant" BAZ. AFAIU It cannot become faster than that.

Cheers
--
MA
Marco Antoniotti
marcoxa
 
Posts: 70
Joined: Thu Aug 14, 2008 6:31 pm

Re: How do I define a keyword as a integer constant?

Postby joeish80829 » Thu May 15, 2014 5:07 am

How would I fix emacs highlighting to see constants highlighted...also the package prefixes aren't getting highlighted e.g. gc:test, the gc: is the same color as "test"
joeish80829
 
Posts: 153
Joined: Tue Sep 03, 2013 5:32 am

Re: How do I define a keyword as a integer constant?

Postby joeish80829 » Thu May 15, 2014 5:07 am

How would I fix emacs highlighting to see constants highlighted...also the package prefixes aren't getting highlighted e.g. gc:test, the gc: is the same color as "test"
joeish80829
 
Posts: 153
Joined: Tue Sep 03, 2013 5:32 am

Re: How do I define a keyword as a integer constant?

Postby marcoxa » Fri May 16, 2014 1:31 am

joeish80829 wrote:How would I fix emacs highlighting to see constants highlighted...also the package prefixes aren't getting highlighted e.g. gc:test, the gc: is the same color as "test"


Well, well, well... I don't know. I just know it is possible. The only enlightened and wise answer is thus: RTFM (either Emacs highlighting, or ask the slime guys) :mrgreen:
Marco Antoniotti
marcoxa
 
Posts: 70
Joined: Thu Aug 14, 2008 6:31 pm

Previous

Return to Common Lisp

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests