freenode/#lisp - IRC Chatlog
Search
16:03:23
hjudt
i have a slime usability question. when i have a macro like (with-stuff (bindings) object) and object is in the same line as the last binding, emacs highlights object in red color. why does it do that? if i put it in the next line, it doesn't get highlighted in red.
16:07:13
beach
hjudt: It doesn't happen to me. At least not in every situation similar to what you describe.
16:11:17
Xof
if you are closing something that was opened on a previous line, it's unconventional to have more stuff on the line that closes
16:37:32
beach
Hmm. Finding GC roots when stack traversal is precise, and in the presence of callee-saves registers is, let's say, interesting. A datum in a register or in a stack location close to the top of the stack may or may not be a Common Lisp object, depending on the value of the program counter in a stack frame much further down the stack.
17:29:18
Ukari
is it possible to expand a list as a funcall's arguments without macro? for example, (defun test (&rest rest)) (defun expand (list) ...) (test (expand list))
17:44:53
hjudt
i have require 'slime-autoloads, slime-contribs fancy and indentation and ac-slime loaded
17:46:12
hjudt
it also happens with-slots. xof's description is more accurate than mine and makes sense.
17:46:42
hjudt
maybe i just need to get over the fact that is is highlighted and accept that it is good the way it is.
17:47:18
hjudt
this way, one cannot miss stuff and sees it immediately. i just wondered whether it is normal.
17:47:25
jackdaniel
this highlight is a good hint, that you should break the line before the red elements
17:48:20
jackdaniel
akkad: good, right now I'm focused on dragging ECL through 16.2.0 release finish line
17:49:11
jackdaniel
also froggey and fittestbits works on Mezzano port, I hope it will be ready to be a pull request soon
17:56:16
beach
So I guess for each safe point, we must keep a table that, for every callee-saves register contains the stack location where it was saved, if at all. Then traversing the stack, it suffices to swap the contents of the register (or the representation of it in the GC) with the corresponding location, to get a valid next stack frame. Then on the way up, do the operation in reverse.
19:16:53
Beep-Lord
Is there a way to tell SBCL not to use the cache'd temp .fasl? It's loading an earlier version of my file and not recompiling it.
19:37:31
eMBee
alvinstarr: interesting, i have been considering this approach too, but i have not looked at it. overlayfs not handling gluster at the top would be a real bummer :-(
22:24:07
aeth
Does anyone have an example of something that can only be (easily) done with multiple dispatch?
22:42:35
mfiano
There isn't really anything that can _only_ be done with multiple dispatch. It's just another tool to solve the same old problems. However it is much more widespread in languages such as Clojure, where you are allowed to specify the function for how dispatching is performed, which you simply cannot do in portable CL
22:45:29
mfiano
An obvious example of when multiple dispatch would be useful is collision detection. Does object A always collide with object B? Does object B always collide with object A? No, we don't have to tie that behavior to a single object -- they both collide with each other.
22:46:44
aeth
Collision detection's always the example that comes up and I don't think it's a good example because it's a toy example. It's rarely how collision detection *actually* works.
22:49:39
Bike
though those are actually kind of annoying with multiple dispatch if they're commutative
22:52:19
mfiano
I mean shape intersections can be quite reptitious. I think multiple dispatch would help here.
23:00:28
aeth
There has to be something better than the collidep that always comes up. I didn't think about the commuative issue before, though.
23:06:12
aeth
I use multiple-dispatch for vec= (via specialization-store instead of defmethod, though)
23:06:28
aeth
Equality seems like... a bit of a weak example, but that's the best one I can think of.
23:07:17
aeth
It's particularly weak because most of the results are NIL, although I guess I could have a vec3 compare to only the first three elements of a vec4 or something. Probably not very intuitive, though.
23:08:58
aeth
It's a stupid example or it's stupid to have them return NIL or it's stupid to have a vec3 ever be vec= to a vec4? Because I think having them return NIL is the right answer.
23:09:07
mfiano
Then you lose meaning of whether the vec4 is in homogenous coordinate space, and the types of operations you do on it need to know this.
23:16:07
aeth
(It especially becomes problematic when there's ambiguity, like with + being used for addition and string concatenation.)
23:29:10
_death
e.g., 98:(defmethod evaluate ((problem (eql 'line-fitting)) model (point point)) 104:(defmethod evaluate ((problem (eql 'line-fitting)) model (points sequence))
23:30:42
_death
e.g., 680:(defmethod mouse-down ((palette palette) (button (eql sdl:mouse-left)) x y)
23:31:26
_death
sometimes not, like 228:(defmethod pour ((source tap) (target jug)) 231:(defmethod pour ((source jug) (target jug)) 236:(defmethod pour ((source jug) (target sink))
23:32:41
aeth
_death: The last one is interesting because those clearly have a source and destination
23:32:44
mfiano
I cannot, but consider the application of image processing, where you need to define a kernel whose size and shape are compositions of multiple primitives shapes You could simply have a multiple-dispatch method return a function that would loop over the required cells, and then the kernel could use this function as it rolls over the image.
23:33:52
johnnymacs
Is there a function that takes a function and a list and calls the function on the list
23:34:01
mfiano
Like return a function that will map over all cells where a ellipse is cut out from a square
23:37:08
aeth
_death: (pour source target) avoids the commutative problem Bike mentioned earlier, and your example gives something (the tap) that wouldn't be a valid target but is a valid source (assuming you're only refering to the faucet and not the drain)
23:38:02
_death
there's the familiar 17:(defmethod asdf:perform :around ((o asdf:load-op) (c asdf:component))
23:45:26
mfiano
Well, are you familiar with image processing; particularly what a kernel-based convolution is?
23:49:05
mfiano
Ok, so I'll keep this close to home for you. Consider you were using CL to design a very simple procedurally generated map for your game.
23:50:40
aeth
I guess the key point is that you want to use multiple-dispatch to return (non-generic?) functions that iterate?
23:50:45
mfiano
You start with a bunch of "pixels" that are solid walls, and you want to "carve" out space where players can roam around. Your simple algorithm decided that it wants to carve out rooms first, and rooms are compositions of ellipses and rectangles. That is a room could be the union of an ellipse and a rectangle, or even the difference.
23:52:45
aeth
So the multiple dispatch is used as a way to select which iteration to run, essentially? In this example, what rooms to carve.
23:52:55
mfiano
So you can start writing functions for circles, which would just be the parametric equation of a circle with different axis values. So given a size, it would return the pixels to flip. You also have one for rectangles. Each iteration, you could use multiple dispatch to compose a new shape from these functions, and place it somewhere on your map.
23:54:23
mfiano
I skipped over a lot, but the point is you can compose functions from existing functions using multiple dispatch, and it can save a lot of reptition in theory. I did similary when I wrote crawler, which I'm sure I've showed you before.
23:56:09
mfiano
I probably didn't explain very well, but point being, you can dispatch on multiple shapes, and have it do set-theoretic operation(s) on them to return a new shape
23:58:26
mfiano
Well for something simple, like a vertical strip of pixels composed with a horizontal strip, You could just do: https://gist.github.com/mfiano/d1793462a13a5944a7fbb3bad3afb3c4, and then your multimethod would just merge the lists. Sorry a lot of context is left out of this code, but it should be fairly straight forward what is going on
0:01:38
mfiano
Basically you would compose those 2 functions instead of doing what I did here: https://gist.github.com/mfiano/4565f6b99cbfaf7a6abc694c10e2c834
0:02:33
mfiano
and you can extend this to other shapes as long as you know the math for selecting pixels, and for any arity.
0:07:34
_death
if a generic function takes more than one required argument, one could likely figure out some case where multiple specializers make sense
0:09:54
mfiano
aeth: Anyway, my point is not that they're lists...they could be functions which return arrays, and your multimethod could in theory return multiple values for selecting the interesting cells.
0:10:33
mfiano
The point was that you can compose selections of cells from previously defined functions, by specializing on multiple required arguments.
0:11:34
aeth
mfiano: Maybe I'm not quite understanding you or maybe your examples are oversimplified or something else, but it seems like you're close to something but not quite there.
0:13:30
mfiano
To be perfectly honest, I didn't realize that my CL implementation of this was incomplete part way through this example, though I did do it with Clojure.
0:19:23
mfiano
aeth: If I ever complete it with the 37 other active projects I'm working on, real life excluded, I'll keep you informed :)
0:20:57
mfiano
Ha yeah, he's like fukamachi, except with code that doesn't leave a bad taste, complete with documentation and all
1:25:40
PuercoPop
akkad: I don't remember ever being a time where there wasn't an ssl-acceptor. And even if that weren't the case, one could always nginx in front to take care of it
1:31:25
PuercoPop
Not really, you don't want to serve static files from your application server most of the time.
2:45:16
beginner_supreme
Does anyone feel as though there is a built-in function for every little thing? Every time I write some code I wonder if I should be using some sort of built-in instead...