freenode/#lisp - IRC Chatlog
Search
0:20:20
no-defun-allowed
what was that program that typeset mathematical equations using boxes and stuff in the terminal?
2:18:08
Bike
clschool is for learning the language, lisp is for when you've learned the language but not really
4:40:06
aeth
elderK: Meanwhile a question about e.g. "what web libraries should I use?" would belong here
4:44:17
aeth
There are also channels for specific topics, e.g. #lispgames so questions aren't just in one of the two
5:02:35
elderK
beach: Is there a place that details the method combination types? CLHS tells me about +, and, progn, etc. But there doesn't seem to be a page that actually describes how these combinations function.
5:03:43
beach
Oh, those are trivial. The effective method is just (<operator> method1 method2 .... methodn)
5:05:44
specbot
Built-in Method Combination Types: http://www.lispworks.com/reference/HyperSpec/Body/07_ffd.htm
5:10:41
elderK
Thanks beach. I was reading that last night but got kind of confused. I'll give it a another shot.
6:36:02
fiddlerwoaroof
Anyways, depending on how much information you want elderK, Didier Verna has a recent paper on method combinations
6:37:28
beach
He defines a different mechanism, called "method combinators". But he doesn't really provide a solution to the enigmas of the AMOP and the Common Lisp HyperSpec as to how to define method combinations.
6:38:36
beach
However, I figured out how to do it in the context of SICL, and the solution provides a behavior that is consistent with both the AMOP and the Common Lisp HyperSpec, and it doesn't have the strangeness of the PCL solution.
6:39:23
beach
So, Didier and I are going to write a joint paper about it, and submit it to ELS 2019.
6:40:08
beach
I mean, what would you do with this: (defclass t () () (:metaclass built-in-class)) outside SICL?
6:40:36
fiddlerwoaroof
I was thinking more of using it to get predictable MOP behavior across implementations
6:40:55
beach
fiddlerwoaroof: Yes, they are, during bootstrapping, because I use first-class global environments to make such definitions operational.
6:41:30
beach
I don't see how you can reasonably redefine any native MOP classes in any implementation.
6:43:13
beach
The minute I do, I lose all my nice tools in a more comfortable environment than UNIX.
6:43:38
beach
So the current plan is to create a fairly complete SICL system inside a host Common Lisp implementation and debug most of the code like that first.
6:44:17
fiddlerwoaroof
So, can I do something like load SICL in a host lisp and then dump an image that runs a sicl toplevel?
6:44:50
no-defun-allowed
i know some assembler but after you run out of registers then what do you do? how do you juggle between regs and the stack/heap?
6:45:06
beach
fiddlerwoaroof: I suppose that would be possible fairly soon, but I hadn't considered that.
6:45:53
beach
no-defun-allowed: Yes, you implement a register allocator that decides where to put lexical variables at various points in time. Typically the stack frame is used as backing memory.
6:46:02
loke`
(SBCL specific answer is acceptable) If I build a standalong application by dumping it, and then it's later started the source files have moved. Is there a way for me to tell the Lisp runtime what the new source location is?
6:46:58
fiddlerwoaroof
At least, that's what I generally do: open the .asd in Emacs, C-c C-k + then (ql:quickload :my-system)
6:47:22
loke`
(the application is very large, constiging of all of Maxima as well as McCLIM, so loading the asd is not fast)
6:47:45
loke`
I'm trying to package it up into a single directory that can be launched from anywhere
6:47:50
fiddlerwoaroof
Maybe a bit, you might be able to update ASDF's notion of where the system lives some other way
6:48:58
fiddlerwoaroof
So, I just went through a bunch of work to package a smallish app as a redistributable executable
6:49:19
fiddlerwoaroof
Here's the CircleCI build setup: https://github.com/fiddlerwoaroof/daydreamer/blob/master/.circleci/config.yml
6:49:56
fiddlerwoaroof
With minor tweaks you can make CFFI statically link all the ffi dependencies into the image.
6:50:24
fiddlerwoaroof
Although if you have non-source assets, I suppose that won't work very well.... maybe logical pathnames or a configuration prompt would help in that case?
6:52:30
fiddlerwoaroof
If you use cloudformation, you should be able to download a binary of that from the github releases and run ./daydreamer -s to get a list of all your CF stacks
6:56:52
fiddlerwoaroof
loke`: this might work, https://common-lisp.net/project/asdf/asdf.html#Using-logical-pathnames-1
6:58:15
fiddlerwoaroof
That is, adjusting your system definition to use logical pathnames and then figuring out how to set it up before running the app. That might also be a huge can of worms, but this seems to be the sort of thing they were meant to solve.
7:38:53
beach
loke`: What if you just pre-loaded all files that Maxima might need (except user defined files of course)?
8:40:37
fiddlerwoaroof
Has anyone ever had the issue where the slime documentation for the current form disappears
8:59:18
jdz
fiddlerwoaroof: the autodoc thing is quite flaky for me, i sometimes type extra spaces and a backspace to get it back.
9:00:03
jackdaniel
it also doesn't work if some form is being evaluated in repl (so there is no prompt)
9:00:46
jackdaniel
(so if something runs longer than a few seconds, you may want to start it in a separate thread)
10:55:43
elderK
Guys, I'm a little confused by the "Sorting the applicable methods by precedence order" part of CLHS. It states that if two parameter specifiers are of the type like, (foo (eql something)), that they must agree.
10:56:33
elderK
But, I've seen examples in PCL where there are methods that are like, (defmethod something ((type (eql whatever) stuff...) body....0
11:03:54
elderK
Couldn't you have a method that specialize on one parameter, and then has an eql on the other?
11:04:37
shka_
like, for instance (defmethod something ((instance some-class) (operation (eql :some-operation)))
11:05:22
elderK
Okay, but if I had say, (defmethod something ((instance some-class) (operation (eql :op-a))) and (defmethod something ((instance some-class) (operation (eql :op-b))) wouldn't that violate http://clhs.lisp.se/Body/07_ffab.htm
11:08:04
beach
elderK: The APPLICABLE methods are sorted like that. For a particular list of arguments there can not be two methods that EQL specialize on the same parameter but with different objects that are simultaneously applicable.
11:09:18
beach
elderK: Notice the difference between "all methods of a generic function" and "the subset of those methods that are applicable for a particular list of arguments".
11:09:19
pjb
Basically, EQL specifiers filter out the arguments that are not eql to the specified value. This is a string filter…
11:09:30
elderK
It is /applicable/. I.e. We're selecting one method out of a ton, not a set of them. So, once we get to the (eql ...), of course they would have to agree, to be the same applicable method. Right?
11:10:13
beach
elderK: But not more than one with a particular EQL specializer on the same parameter.
11:10:47
beach
elderK: There can be other methods that specialize on classes and there can be auxiliary methods that specialize the same way as primary methods.
11:11:13
pjb
(defgeneric foo (a b) (:method ((a integer) (b (eql 24))) 1) (:method ((a integer) (b (eql 42))) 2) (:method ((a string) (b (eql 42))) 3)) (foo 2 24) #| --> 1 |# (foo 33 42) #| --> 2 |# (foo "two" 42) #| --> 3 |#
11:12:54
elderK
pjb: I appreciate your help too, and I get that's what eql does there. But, I'm still confused by the wording of CLHS entry linked.
11:14:40
elderK
I.e. The things that have an eql specifier, and don't match your call,l will be pruned at the start say. Then it'll be ordered as specified.
11:15:08
pjb
I would have had to add a (:method ((a t) (b (eql 42))) 4) so that with b = 42 and a =33, you would have 2 applicable methods (:method ((a integer) (b (eql 42))) 2) and (:method ((a t) (b (eql 42))) 4).
11:16:05
elderK
I think I get it now. I'm just not sure how to say it back, word it back, that sounds sane :P
11:16:50
elderK
Yup, exactly. so, that narrows down the "set of possible applicable methods" right away, right. Then, you order them left-to-right (unless otherwise specified), as the CLHS states.
11:17:56
shka_
there is bunch of other things like :around but the gist of it is: order using left-to-right rule
11:18:09
elderK
So, it goes LTR (unless RTL is specified), comparing the parameter specializers. If it's a class, the one that is earliest in the CPL winds up having precedence over the other. So, if I have (a some-class) and (a t), the (a some-class) method would be more specific.
11:30:22
elderK
shka_: Can you recommend any other resources that can help me learn to like, do OO the CLOS way?
11:36:36
elderK
shka_: Was the blog you linked to, yours? I hit that a few days ago and read through it :) I look forward to seeing more posts.
11:38:08
jmercouris
so basically to achieve what I want to do I have to something like (defun asdf (a &optional (b nil))) and then within the body (unless b (some calculations to set b))?
11:38:09
shka_
jmercouris: but asdf is complicated and from what i understand, it is allowed to cache
11:41:23
jmercouris
I want a funciton to act on the currently active-minibuffer (which is a function call to determine what is the active buffer), UNLESS the user specifies a different buffer to pass in
11:42:21
Xach
jmercouris: i don't know exactly what you expect, but it is a common thing in common lisp
11:43:38
elderK
The init-form of the optional will be evaluated each time the function is called, unless you provide an actual parameter fofr it.
11:43:42
jmercouris
(defun qwerty (&optional (buffer (active-buffer (window-active *interface*)))) ...)
11:44:00
jmercouris
I expect that buffer will be the result of (active-buffer (window-active *interface*)) unless otherwise specified
11:44:09
elderK
So, (active-buffer ....) will be evaluated if you provide no actual parameter for buffer.
11:44:50
Xach
I use ((:credentials *credentials*) *credentials*) in reality, that establishes a new *credentials* for the dynamic extent of the call
11:46:08
elderK
jmercouris: There, it's not a function - it's just the name. :credentials is the say, keyword name - what you'd use when calling. But in the function itself, *credentials* is the name bound to the actual value passed.
11:46:48
Xach
I do often defun functions named by keywords, but only for local utilities in the repl.
11:48:07
jmercouris
Xach: interesting, is there a reason why you use a ":"? just as an informal convention?
11:48:29
Xach
jmercouris: so i can write it the same short way no matter what the current package is.