<hashfunc1880>
is there a way to find out that VAR is associated with class A?
<beach>
The symbol is not "part of" or "associated with" the class. The symbol names a generic function that has a method that specializes to the class. And, yes, there are ways to find that out. Some of that might require the MOP.
Guest74 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
rotateq has joined #commonlisp
<beach>
So you need to find out whether the symbol names a generic function, or whether (SETF <that-symbol>) names one. Then you need to find out whether that generic function has a method that specializes to the class. It is not clear what you want, so the details will vary. For example does (defmethod VAR2 (a b (c A) d) ...) count?
<beach>
Then FIND-CLASS to get to the class metaobject from the class name.
<beach>
Then EQ to check whether one of the specializers is that class.
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
<beach>
hashfunc1880: Does that make sense to you?
<hashfunc1880>
beach: ok thanks. i just added (EQ (TYPE-OF (SYMBOL-FUNCTION VAR)) 'STANDARD-GENERIC-FUNCTION). but that is turning out to be too loose of an approach. ideally, i guess i just want if the symbol is either a 'STANDARD-GENERIC-FUNCTION (like a member function) or if it's the name of a class itself.
lisp123 has joined #commonlisp
<hashfunc1880>
beach: yeah, some of it does, i'll have to read more into it
<hashfunc1880>
*most of it does i think
<beach>
Maybe if you tell us what you are trying to do, it would be easier to give advice, because you are mixing up several things.
<beach>
First of all, functions can be named (SETF <symbol>) so symbols are not enough to find out whether there is (say) a slot writer.
waleee has quit [Ping timeout: 260 seconds]
lisp123 has quit [Ping timeout: 256 seconds]
<beach>
Second, a symbol "is" not a standard generic function. It can name one, but it isn't one. And generic functions don't necessarily have names in the global environment, so there could be a generic function with a specilizer that you can't find with FDEFINITION (or SYMBOL-FUNCTION if you insist on using only symbols).
<beach>
Third, there is no such thing as a "member function" in Common Lisp.
waleee has joined #commonlisp
<beach>
A slot reader or a slot writer is just a method on a generic function, and that method happens to specialize to the class with the slot.
<beach>
Fourth, TYPE-OF is not a good plan. Use TYPEP instead.
<hashfunc1880>
beach: ok, yeah i'm going to change it to typep in this case. i think i'll just have to stick with just checking if the symbol names a standard-generic-function for now.
<hashfunc1880>
i'm also unable to use the function GENERIC-FUNCTION-METHODS
<beach>
It is not in the standard, as I told you. It is in the mop.
<hashfunc1880>
like my environment says that GENERIC-FUNCTION-METHODS is undefined
<hashfunc1880>
oh i see
X-Scale` has joined #commonlisp
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale` is now known as X-Scale
<rotateq>
hashfunc1880: Which implementation do you use? SBCL?
<beach>
It is best to use the closer-mop library.
lisp123 has joined #commonlisp
<rotateq>
Yes for most nowadays used implementations. :)
<rotateq>
Ah it has even a file for the Mezzano operating system.
<rotateq>
hashfunc1880: closer-mop is a portable system that calls the implementation specific things, like with CFFI for the foreign function interface capabilities
<rotateq>
lisp123: Just five? I thought nine.
<lisp123>
rotateq: looks like it depends on the version, i can see the 9 one now as well
<rotateq>
maybe the point of view :)
<hashfunc1880>
rotateq: ok thanks
<rotateq>
So it gives you to write portable code too.
waleee has quit [Remote host closed the connection]
hashfunc1880 has quit [Ping timeout: 240 seconds]
waleee has joined #commonlisp
waleee has quit [Ping timeout: 260 seconds]
waleee has joined #commonlisp
lisp123 has quit [Ping timeout: 272 seconds]
rgherdt has joined #commonlisp
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #commonlisp
nature has joined #commonlisp
aartaka has joined #commonlisp
Josh_2 has joined #commonlisp
<Josh_2>
Hey
<Josh_2>
How do I write a (deftype <name> () `(satisfies <pred>)) in a defmacro?
<Josh_2>
<pred> is generated by arguments passed to defmacro, I can get (satisfies <pred>) or `(satisfies ,<pred>) but not `(satisfies <pred>) :(
<aeth>
you can use ' instead of ` in the deftype body
<Josh_2>
ah
<Josh_2>
I didnt know that, thanks
<aeth>
np
<aeth>
it's only ` by convention because sometimes you have to do something like this: (deftype <name> (x) `(simple-array 'double-float (,x)))
<aeth>
and it looks better if you always use the `
semz_ is now known as semz
<aeth>
but in a macro, nobody will see it
<Josh_2>
Okay sweet, thanks for the info
waleee has quit [Ping timeout: 256 seconds]
waleee has joined #commonlisp
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #commonlisp
waleee has quit [Ping timeout: 252 seconds]
nature has quit [Remote host closed the connection]
waleee has joined #commonlisp
admich has joined #commonlisp
dieggsy has quit [Quit: You have been kicked for being idle]
waleee has quit [Ping timeout: 256 seconds]
waleee has joined #commonlisp
shka has joined #commonlisp
waleee has quit [Remote host closed the connection]
waleee has joined #commonlisp
lisp123 has joined #commonlisp
waleee has quit [Ping timeout: 252 seconds]
waleee has joined #commonlisp
pve has joined #commonlisp
lisp123_ has joined #commonlisp
waleee has quit [Ping timeout: 260 seconds]
lisp123 has quit [Read error: Connection reset by peer]
lisp123 has joined #commonlisp
lisp123_ has quit [Ping timeout: 252 seconds]
nature has joined #commonlisp
cage has joined #commonlisp
rustacean has joined #commonlisp
razetime has quit [Ping timeout: 272 seconds]
lisp123 has quit [Remote host closed the connection]
prokhor__ has joined #commonlisp
<prokhor__>
hi all
<prokhor__>
Question: I am trying to get some old SW running.
tyson2 has quit [Remote host closed the connection]
domovod has quit [Quit: WeeChat 3.4]
tyson2 has joined #commonlisp
parjanya has quit [Ping timeout: 268 seconds]
rain3 has quit [Ping timeout: 240 seconds]
treflip has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
Guest98 has joined #commonlisp
treflip has quit [Remote host closed the connection]
<Guest98>
Hi everyone, is there a way for me to turn a lambda list that a function returns into a function object that I can call in another function ? :)
<Bike>
what about the code? a function has code, not just a lambda list.
<Guest98>
if my function returns a lambda list, how can I call it as a function
<beach>
Do you mean "lambda expression" rather than "lambda list"?
<rotateq>
Yes I wondered what could be meant by that.
<Guest98>
I guess, I was told it was a lambda list elsewhere, I can show you the error code but where should I post it ?
<beach>
Guest98: The lambda list is just the list of parameters.
<beach>
You can't call a list of parameters.
<Guest98>
OH not thats not what I want
<Guest98>
its an actual lambda expression
<Guest98>
let me try this compile function
<beach>
Then compile it and call the result.
<beach>
Don't hesitate to have a look in the glossary for "lambda list" and "lambda expression".
<Guest98>
Will do
<Guest98>
Seems like it worked but its telling me I have a compilation error, Ill try for a while and get back to you guys if I get stuck again, thanks :)
<Guest98>
By glossary you mean the cliki ?
<rotateq>
No the hyperspec.
<Guest98>
oooh the CLHS okay thanks
<rotateq>
So the official ANSI specification for Common Lisp.