freenode/#lisp - IRC Chatlog
Search
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...
4:25:10
beach
asarch: And, there is no such thing as a "lambda function" in Common Lisp. There are functions, and that's it.
4:27:26
beach
The situation is not ideal in Austalasia. When I lived in Auckland for a year, I found that there was only a handful of Lispers within a 3 hour flight. Here in Europe there are hundreds within such a radius.
4:29:57
montxero
Starting out with the SCIP videos but doing the exercises in common lisp. Fun so far...
4:31:28
montxero
every now and then, I have to do some mental gymnastics to get over the single/dual namespace difference
4:33:56
beach
Yeah, it can be tricky. Nowadays there is Portacle that packages those things conveniently.
4:34:31
beach
Make sure you use the slime-indentation contribution for SLIME. At least I *think* that is still only a contribution and not the default.
4:40:59
beach
montxero: Also, the function that you thought would be local seems to be using tail recursion with an accumulator. That is also a Scheme-ism because in Scheme, iteration is really tail recursion under the hood. In Common Lisp, you would use iteration instead, especially since Common Lisp does not guarantee tail-call merging.
4:44:35
montxero
I just noticed... not sure why that happened. https://pastebin.com/EG2FGJby just repasted the original
4:45:43
beach
It may have to do with TAB characters in your source. Pastebin may not handle them right. I suggest you make Emacs use spaces all the time. Other tools don't do TAB characters very well either.
4:47:51
montxero
So, labels / flets rather than nestd defuns.. Is there a particular reason for that? like the functions leaking out to global scope?
4:49:26
beginner_supreme
Example reference: (defun add (a b) (+ a b)) --> (add 1 2) => 3 is the usual way. (labels ((add (a b) (+ a b))) (add 1 2)) => 3 is the labels way.
4:56:41
montxero
Okay cool... I'm reading clhs for flet and labels. This portion: "labels is equivalent to flet except that the scope of the defined function names for labels encompasses the function definitions themselves as well as the body." seems a bit opaque to me; almost like it is hiding a very subtle warining
5:01:16
montxero
Oh!!!!!, so if I want to define a recursive function inside the scope of another function, I would be better off using labels (rather than defun). If I were to define said recursive inner function with FLET, on calling the function, I will get a symbol (unbounded / undefined) error or someting to that effect. Is that it or am I missing something else?
5:03:42
beach
Right now I am having my coffee in order to wake up, so any more taxing intellectual activity shall have to wait anyway.
5:09:24
montxero
beginner_supreme: Thanks for that. The namespace demo captures a lot of the problems I've encountered
5:09:34
beach
beginner_supreme: It is not common to use #'(lambda...) anymore. You can just use (lambda ...) instead.
5:11:46
beginner_supreme
That took a while to write up because I still haven't learned enough emacs.
5:16:25
beach
montxero: If you know how to program in other languages already, PCL may be a better alternative to SICP.
5:16:34
minion
montxero: look at PCL: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
5:18:10
minion
Are you a bot: An error was encountered in lookup: Parse error:URI "https://www.cliki.net/Are you a bot?source" contains illegal character #\ at position 25..