freenode/lisp - IRC Chatlog
Search
12:34:33
beach
I think I had better let others figure this out. I do not understand your terminology. I feel more stupid than usual. Sorry.
12:42:14
ck_
thijso: maybe show an invocation and the result of it, then people can tell you whether your naming is somehow unusual or not
12:42:21
beach
I am guessing that it is not a call that is named find-node, but some function that, when called, makes the remote procedure call. Am I understanding this right?
12:47:20
thijso
I'm probably not being clear. Indeed there are rpc calls being done to a different node (instance of the same code running on a different host/port/whatever). Some of them have a type :find-node and pass on a :node-id they want to find. The other side replies with the closest ones it knows and the requester iterates on those to find the one it wants (or ends up with x closest results, but not the actual one
12:49:02
thijso
I'm thinking of making a class that keeps track of the iterations of the rpc calls it has done, keeping track of the replies (found nodes) it gets and removes the duplicate results from different nodes it has queried. In the end it should end up with the answer (1 node, or the x closest ones to that id)
12:50:46
beach
Now it makes more sense. But again, only instances of classes that are also functions do things, like "keep track", "remove", etc. Those would be generic functions specialized to some class.
12:53:21
beach
thijso: So a class could be called rpc-state, or find-node-state or something like that.
12:54:30
beach
thijso: And you would have one or more generic functions with methods specialized to that class for keeping track of the answers.
12:55:53
thijso
beach: I think we have different understandings of 'keep track'. In my view, the slots in the class are where the keeping track is happening, the method manipulate the data in those slots, but it's 'saved' in there. Or am I seeing this completely wrong?
12:58:25
beach
thijso: I was remarking on your saying that "it [referring to the class] gets and removes the duplicate results from different nodes it has queried"
13:04:10
thijso
yeah, I understand. I wasn't being clear. And I probably have too much bagage from other languages in there still.
13:04:39
beach
shka_: Except that it gets complicated, because a function is an instance of the class FUNCTION.
14:25:23
ralt
thijso: composition usually comes in handy there, where the instance would hold an "rpc" object in one of its slots, and the rpc object can manage caching and whatever is needed, and the methods just do e.g. (defmethod find-node ((node node)) (rpc-call (rpc node) :method :find-node :node-id ...))
16:45:34
alandipert
what are good references on compiling lisp? representation, transformation, heuristics, etc. i have PAIP and Lisp in Small Pieces, looking for others
18:29:43
remexre
like, (can-call (x) (foo fixnum x x)) would apply to string iff there were a (defmethod foo ((_ fixnum) (_ string) (_ string))), etc
18:35:00
Bike
well, those aren't the compiler. i'm just saying compiler declarations are a major use of types and what you're describing would be totally useless there.
18:37:24
Bike
also, there being applicable methods doesn't mean a call would be valid. for example you could have a gf with one primary method on fixnum, and one around method on T; then there would always be applicable methods, but it would be an error on anything but a fixnum
18:39:18
remexre
I've got a function that takes either one of a couple of symbols, or a couple different classes, with the commonality being a single generic function they all have methods defined on
18:40:07
remexre
and the method may not be called for a hot minute after the function is, so I'd rather fail fast than crash 20 minutes later
18:41:35
Bike
But you're anticipating changing the generic function enough that you can't just maintain a fixed list of what to allow?
18:45:52
remexre
the generic function is the extension point, not the couple of builtin classes that have methods for it
18:49:01
Bike
there's no guaranteed way to tell that a generic function has an effective method for a given list of classes. first off if there are any eql specializers it's hopeless, and secondly you can't determine that the applicable methods actually add up to an effective method with the given method combination.
18:50:44
remexre
hm, if I ban qualifiers, and the symbols are non-extensible (and I just allow them explicitly), that seems more tractable?
18:53:30
remexre
idk, it still seems kinda surprising that there's no "could I call foo with these args"...
18:55:41
Bike
clos also generally assumes that when you're figuring out what a call does, you actually have all of the arguments. not just their classes.
18:57:49
Bike
i don't know what that means. if your generic function has the standard method combination and you don't allow qualified methods and you can sort out what to do with eql specializers in some particular way you can probably work out whether a call is valid.
19:00:59
Bike
Nil is which argument to find-method? the first argument to find-method is the generic function.
19:01:56
Bike
find-method finds a method with the exact specializers you get it. like, if you provide a class that's a subclass of a class that does have a method specialized on it, that method won't be returned
19:05:32
Bike
this is the function that's actually used during a call, if you pretend caching doesn't exist
19:38:34
thijso
How do I just restart/retry a function if it fails? Can I do (restart-case (somefun) (restart-fun () (somefun)) and then bind handler to invoke that restart on failure? Is there a better way to do this? For context, 'somefun' starts a UDP listener on a port, and regardless of errors, it needs to get back up and listening.
19:40:50
jmercouris
I assume the operation is a blocking one in this case, if it is not, my suggestion doesn't work
19:44:38
thijso
My idea was to wrap the (wait-for-input ...) call in an unwind-protect, where the socket gets correctly closed in case of failure. Then the function that called udp-start-server in the restart calls that same function again, re-connecting the port. But I'm not sure if this is the correct way to do this.
19:45:20
Josh_2
if an error is called it just attempts to restart the function in a networking context
19:50:29
Josh_2
Plaster has absolute murdered the indentation, I think it is because I use tabs not spaces ¯\_(ツ)_/¯
19:52:13
thijso
jmercouris: yeah, that's next on my list to figure out, but I'm having trouble debugging as it's threaded code. I'm using the udp port to also send dump commands, so I can see what is going on. Bit of a hack, I know, but it works. As long as I have the UDP port to talk to...
19:52:51
Josh_2
thijso: you can print to standard output with a background thread by printing to *standard-out* if that helps with debugging
19:53:43
jmercouris
thijso: I guess my question is, if you are just listening on the UDP port, why does it crash? is it *what* you are doing with the data that you listen to that is causing your program to crash?
19:54:41
thijso
The issue I'm having is not printing to stdout while my program is behaving. The issue is that my errors seem to miss a lot of information when they happen. It's a lot less than what I get in slime, for example.
19:55:14
jmercouris
thijso: aha! well then, I should inform you about the two types of slime you can have
19:56:00
jmercouris
thijso: you can have a ~/.swank.lisp like this (setf swank:*communication-style* :spawn) or like this (setf swank:*communication-style* :fd-handler)
19:57:45
jmercouris
I'm not sure exactly, I believe FD handler is file descriptor handler rather than a BSD socket
20:00:00
thijso
Ah, yes. But I'm running the code without swank or slime, as I need to run x instances (nodes) that talk to each other.
21:13:13
eich
Hey everyone, I just downloaded CLisp from sourceforge. how can I build from source on a mac?
21:36:04
remexre
is there a builtin to turn a (vector unsigned-byte) to a bit-vector in big-endian order?
21:38:39
kpoeck
than ./configure --with-libiconv-prefix=<yourlibiconvpath> --with-libsigsegv-prefix=<yourlibsigsegvpath> --with-libreadline-prefix=<yourlibreadlinepath> --with-libffcall-prefix=<yourlibffcallpath> --cbcx <directoryname>
0:10:15
remexre
is there a way with iterate to iterate through all the active elements of an arbitrary array?