freenode/#lisp - IRC Chatlog
Search
6:22:14
asarch
(setf value (or (foo) "Not defined")) <- How can I test (foo) in order that, if "" then the value would be "Not defined"?
6:31:51
Nilby
How about (let ((foo (foo))) (if (or (null foo) (zerop (length foo))) "Not defined" foo))
6:40:50
Nilby
If you don't mind calling (foo) twice, you can just say: (if (zerop (length (foo))) "Not defined" (foo))
7:05:23
azrazalea
I feel like such a beginner again after so long. So I got my whole metadata thing working and everything but now I'm getting an error on my generic function call where it says that there isn't a method specializing with the arguments given but as far as I can tell there is! See sly debug screenshots here: https://imgur.com/a/WZ3PAyA. I am confused. My guess is I'm doing something wrong with how I have my packages setup.
7:06:44
azrazalea
https://gitlab.com/azrazalea/lair-bot/-/tree/commands-refactor is the code, specifically https://gitlab.com/azrazalea/lair-bot/-/blob/commands-refactor/src/main.lisp#L118 for the function call, and https://gitlab.com/azrazalea/lair-bot/-/blob/commands-refactor/src/commands/ping.lisp#L12 for the implementation
7:09:38
azrazalea
Unless I'm reading the output wrong, in the sly debug screenshots the 4th arg is "ping" but it has it on the same line as the 3rd arg
7:10:57
azrazalea
The second half of the second screenshot is the specialization list for the method I am trying to call
7:11:57
azrazalea
My best guess is I somehow have my packages messed up to where my function call isn't "seeing" the defined methods properly
7:19:02
Nilby
It seems correct, so maybe the types got out of sync due to dependencies? Does a re-load of the whole thing help?
7:22:58
Nilby
I'm not really familiar with defmethod*, but could it be somehow specializing on the :void return value?
7:23:31
azrazalea
Yeah, I should probably remove defstar as a potential issue let me try that (and I did reload everything a couple times)
7:27:09
azrazalea
I'm passing the class definition object of my command, not an instance of my command. Duh. Sleepy me
7:32:20
Nilby
Sometimes I wish every project would list the flattened indirect dependencies. It's good to know before you quickload.
7:34:39
Nilby
Nice. It took me writing a dependency viewer before I could figure that out for myself.
7:35:02
azrazalea
I used (remove-duplicates (mapcar #'ql-dist:short-description (flatten (append (ql-dist:dependency-tree :lispcord) (ql-dist:dependency-tree :str) (ql-dist:dependency-tree :local-time) (ql-dist:dependency-tree :defstar) (ql-dist:dependency-tree :iterate)))))
7:37:26
azrazalea
It is one of those things that I technically did for myself but then put in the readme because it is also useful for users.
7:39:18
azrazalea
Sadly it works through quicklisp not asdf so unless your project is on quicklisp you have to do it like I did above
7:52:49
fiddlerwoaroof_
What's the "right way" to set the FDEFINITION of a symbol to a funcallable-standard-object?
7:55:14
fiddlerwoaroof_
I guess I don't understand how a macro like DEFGENERIC should be implemented, though: when does the equivalent of that SETF happen?
7:56:33
beach
ENSURE-GENERIC-FUNCTION checks whether the name is already defined as a generic function.
7:59:33
fiddlerwoaroof_
Well, I have code that works, but I'm not sure if I'm thinking through all the consequences correctly: e.g. making the function available at the time you expect function names to be in scope.
8:01:15
beach
There is an issue between the compilation environment and the run-time environment, though, if that is what you are referring to.
8:03:32
fiddlerwoaroof_
Well, the problem I actually have is that I've been experimenting with defining my own subclass of FUNCALLABLE-STANDARD-OBJECT, and I'm trying to figure out what I need to think about
8:04:01
Nilby
It can sure be an issue if, like me, you tried to use a generic function in a macro in the file it's defined in. But ensure-generic-function can come to the rescue.
8:05:07
beach
fiddlerwoaroof_: At any point in time, you can call (SETF FDEFINITION) to have the name associated with your object.
8:06:47
kpoeck
ansi test question: After I import an uninterned symbol x into a package y, is then the home-package of that symbol x package y? Is this specified somewhere in the clhs? Example in https://gist.github.com/kpoeck/430733f4774cde892166e45855e68dc4
8:07:12
beach
fiddlerwoaroof_: But SET-FUNCALLABLE-INSTANCE-FUNCTION does not alter the binding of the name to your object in any way.
8:36:43
Alfr
beach, IMPORT is specified to set the home package of the symbol, if it doesn't have one.
16:05:00
Josh_2
Unfortunately I need to write all these bindings to implement a feature for my CL program
16:06:28
Josh_2
Obviously the megolm protocol could be implemented in CL, but I don't think I'm capable of that
16:08:18
beach
Your time struggling with CFFI seems comparable to that of learning a fairly complicated subject.
16:09:32
Josh_2
I did consider rewriting the C++ and C code that implements Megolm in CL but I took a look and I didn't understand a bit of it