freenode/#lisp - IRC Chatlog
Search
15:58:06
_spm
Hi all. Trying to clear up a little fuzzy thinking on my part. I'm trying to store an accessor in a variable so I can later call it, but I'm not sure exactly how to pull this off. Trying to (setf (funcall my-accessor obj) val) gives me "(setf funcall) is undefined". I'm sure there is a way to do this, and am hoping someone can straighten me out.
15:59:53
dim
/Users/dim/dev/yesql/src//tools/bin/sqli book.md build/book.md -- sigreturn returned ; that's still the CCL bugs in OSX Mojave :/
16:07:33
_spm
I tried to get cute and store some comparators and accessors in variable to prevent duplicating code, but the result is pretty messy from a readability standpoint.
16:28:47
dim
uiop from asdf made it easy for this little tool of mine to work with SBCL too, so at least I'm not stucked
17:13:54
jcowan
Where in the CLHS is described the meanings of +, ++, +++, *, **, etc.? I need to cite them.
18:25:44
emaczen
jcowan: If you use emacs, it is pretty nice to install the info pages for GCL (which is just the same as the hypersepc AFAIK) then you can C-s and C-r through the documentation
18:34:31
jcowan
I don't use emacs (I am an `ex` troglodyte, not to be confused with an ex-troglodyte), but I can use the stand-alone info client, more or less.
18:35:11
pjb
_spm: congratulation: you've discovered that accessors are not first class objects in CL. readers and writers are; they are functions. Accessors are informal pairs of functions. not lisp object.
19:08:29
beach
another-user: Imagine that you are the supplier of a library for manipulating geometric figures. You supply the root class geometric-figure and perhaps a few special cases like circle and square.
19:08:53
beach
another-user: There are four operations possible, rotate, scale, move, and bounding-rectangle.
19:09:27
beach
Your clients supply more specific classes like polygon, ellipse, etc. And they write methods on the generic functions representing the operations.
19:10:12
beach
another-user: In version 2, you want to take advantage of the fact that the bounding-rectangle operations is WAY more often used than the others.
19:11:28
beach
another-user: You also add a Boolean slots bounding-rectangle-valid-p, initially set to nil.
19:11:57
beach
another-user: You write :AFTER methods on rotate, scale, move that set the Boolean slot to nil.
19:12:54
beach
another-user: You add an :AROUND method, also with the root class as a specializer. It checks the Boolean slot, and if it is TRUE, it returns the cached value.
19:13:35
beach
If it is NIL, you invoke (CALL-NEXT-METHOD) to compute the bounding rectangle, you store the result and set the Boolean slot to TRUE.
19:14:12
beach
another-user: You can't do that without auxiliary methods unless you also change the interface.
19:15:08
beach
another-user: I am usually not here after 19:00 UTC+1, so I am off to spend time with my (admittedly small) family.
19:51:39
another-user
beach: thank you for great and detailed explanation, it's really nice example!
20:15:21
ecraven
are there typos in the hyperspec? http://clhs.lisp.se/Body/f_getf.htm#getf has ".. or modify of any part, car or cdr ..", which I think contains one too many "of" (.. or modify any part ..)
22:49:42
edgar-rft
All typos in a "standard" doument become the new standard. You're not allowed to use Common Lisp without these typos.
23:07:17
aeth
Common Lisp is dynamically typoed so the standard document doesn't have typos, but objects in the standard document have typos.
23:18:40
no-defun-allowed
compare this to the dependent typos of MLs, where functions can take any typo and produce appropriate typoed results
23:25:44
aeth
Are there any portability libraries for useful typos that aren't part of the standard?
23:28:16
no-defun-allowed
some implementations have implementation specific typos you can use sharpsign plus or sharpsign minus if absolutely neccesary
0:36:52
aeth
A let* variant with m-v-b is pretty simple, just use m-v-b in the correct moment. A let equivalent is trickier because let followed by m-v-b would take the let's values.
0:37:11
aeth
I think this could work, though: (defun foo (x y) (flet ((bar () (ffloor x y))) (declare (inline bar)) (let ((x 42f0)) (multiple-value-bind (a b) (bar) (+ a b))))) ; takes the outer x, and the inner x is unused
0:37:39
aeth
Essentially, capture the outer scope with a closure, but inline it so the closure is eliminated and it's like it was never there, except to tell it to use the outer x.
0:40:45
Bike
(multiple-value-bind* (((a b) form1) ((c d e) form2)) ...) => (multiple-value-bind (#:a #:b) form1 (multiple-value-bind (#:c #:d #:e) form2 (let ((a #:a) ...) ...))) is fine, isn't it?
0:42:36
aeth
Oh I see. So bind temporarily to a gensym, and then put all of the bindings in one big let.
0:43:31
aeth
Bike: There's still one problem: adding flet and macrolet to the mix (and symbol-macrolet?)
0:44:33
aeth
Bike: flet is not a problem, you are right, it would be (flet ... (let ((a #:a) ...) ...))
0:46:23
aeth
It looks like let, m-v-b, flet, and destructuring-bind are combinable, and let*, m-v-b, labels, and destructuring-bind are combinable, and let winds up actually being a bit easier (rather than the other way around) because there are only two levels of final bindings: the flet and the let.
1:07:35
dim
there's let+ and metabang-bind doing that kind of things already, and certainly more projects than we can count
1:14:12
aeth
It does, of course, already exist to some extent. The closest library is defstar, which is GPLv3 and thus essentially unusable for the vast majority of users.
1:14:40
aeth
If I'm going to combine types with bindings, though, I might as well combine different kinds of bindings, though.
1:16:27
aeth
dim: I think I can be safe to say that my define-function does more than most equivalents, and my let-equivalent will probably also be superior. I did not put in a little bit of effort that a throwaway has since this is the foundation of a large part of my game engine.
1:16:31
aeth
https://gitlab.com/zombie-raptor/zombie-raptor/blob/4a95b9d9445241b6e1b412189848e4d52a11eb52/util/util.lisp#L130-219
1:19:05
aeth
e.g. Unlike defstar, define-function allows easy per-function configuration for whether or not check-type should be used instead of type declarations. It looks like defstar relies on a global there, which is very problematic. The documentation also suggests that it does both declarations and check-type in that mode, which doesn't work on SBCL (SBCL will delete the check-type as unreachable code, it's either/or in SBCL)
1:20:27
dim
that said I should get some sleep, good luck with define-function! (maybe that could be shipped separately from the 3d game engine when you're happy with it?)
1:20:51
aeth
I'll definitely spin off parts of my util library when they are complete (atm only define-function is "complete")
1:29:04
aeth
(In case anyone is wondering why using a global is problematic for a configurable defun, keep in mind that a LET makes a function definition no longer considered as top-level. Only certain forms like PROGN are allowed there. So you can't always just rebind the dynamic global locally with a LET around the function definition when you need to.)
3:18:55
aeth
Oh, fun fact: define-function is no longer portable because (length (documentation 'define-function 'function)) is 2565 and ARRAY-TOTAL-SIZE-LIMIT "is not less than 1024"