freenode/lisp - IRC Chatlog
Search
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"
3:31:06
capadoodle
is it better style to explicitly call out the package that an external symbol is from when used within your package? `package:function` rather than just `function`? Right now my package only depends on clim
3:35:43
aeth
capadoodle: There are three styles, each with drawbacks. You can :use a package, you can :import-from specific symbols from a package, or you can explicitly use the symbols like you said.
3:36:30
aeth
capadoodle: The disadvantage of :use is that even though there is no current conflict, a symbol could be added in the future creating a future name conflict. The disadvantage of :import-from is that you have to list every symbol you're going to use and it's easy to forget to remove it from the import if you're no longer using it (no tool currently detects this afaik).
3:36:52
aeth
capadoodle: And the disadvantage of always saying the package name is that the package name can be very long and nicknames are discouraged because nicknames can name conflict, especially very short nicknames.
3:38:48
pfdietz
:use also has the danger that you may accidentally redefine something with that symbol.
3:41:11
aeth
Fortunately, redefinition of functions and macros can give a warning (depending on the implementation) so at least you can detect that.
3:43:04
capadoodle
makes sense, I think I'd be partial to always saying the name, especially for clim which is so short already. the documentation for clim recommends using clim and clim-lisp rather than CL :( why is that? seems potentially shady
3:54:17
beach
I think CLIM-LISP makes the same promise as COMMON-LISP, i.e. no new symbols will be added, and only symbols with the same names as those in COMMON-LISP are present.
3:55:06
beach
Besides, your program would look very strange if you had to write CLIM-LISP:CAR, CLIM-LISP:IF etc.
4:28:06
asarch
How could I know the current version of ASDF (for example, from a running session of clisp)?
4:29:03
asarch
"/home/asarch/quicklisp/dists/quicklisp/software/bordeaux-threads-v0.8.6/bordeaux-threads.asd: You need ASDF >= 3.1 to load this system correctly."
4:30:25
beach
asarch: Normally, you don't have to care. If you install a recent version of your Common Lisp implementation, it comes with an appropriate version of ASDF.
4:32:07
beach
asarch: Do you have any particular reason for using CLISP rather than one of the more widespread implementations?
4:35:10
asarch
Well, all my attempts to have SBCL with threads on OpenBSD 6.4 for AMD64 have miserably fail
4:37:43
beach
But I don't know much more about it. I am suggesting ECL because jackdaniel maintains it and he is often here, so you can ask him questions.
4:50:21
aeth
(Also, the developers from some currently incomplete implementations like Clasp and SICL)