freenode/#lisp - IRC Chatlog
Search
17:00:54
phoe
mgsk: https://sites.google.com/site/sabraonthehill/postmodern-examples/postmodern-table-management has some data on it
17:45:53
Younder
Well, I'll work on that then. An MXNet interface to CL might be instructive. (I normally use Mathematica)
18:29:25
phoe
What would be the best pattern to only capture the kind of errors that happens as a part of DESTRUCTURING-BIND operation?
18:30:40
jasom
phoe: it's going to be implementation-specific unfortunately; this looks like someone needs to write a "trivial-bind-error" package :P
18:32:41
phoe
I'm wondering if I can somehow wrap the destructuring-bind body in some handlers that will only apply to whatever happens inside the d-b binding forms.
18:34:58
jasom
(let ((in-bind t)) (handler-bind ... (destructuring-bind X Y (setf in-bind nil) ...)))
18:36:02
jasom
djeis[m]: Y doesn't need to be wrapped, as it's identical in usage to destructuring-bind
18:36:47
phoe
I assume I could simply shadow CL:DESTRUCTURING-BIND with my own implementation that uses this trickery and is guaranteed to signal some DESTRUCTURING-BIND-ERROR when the binding fails.
18:36:50
djeis[m]
Depends if you want to catch errors raised by Y itself and not just the binding process.
18:38:20
djeis[m]
Right, so you’d either want to move that outside your handler bind using a gensym or you’d need to wrap that too.
18:38:23
jasom
(let (in-bind) (handler-bind ... (destructuring-bind X (prog1 Y (setf in-bind t)) (setf in-bind nil) ...)))
18:41:23
djeis[m]
And I don’t see a simple way around that one, actually, that doesn’t involve parsing a lambda list.
18:41:30
Younder
Look this is all ugly. You gotta restate the problem rather than rephrase the answer.
18:41:52
phoe
I am destructuring a list and I want to capture the kind of errors that happen when a list cannot be destructured.
18:42:17
phoe
I want to handle the DESTRUCTURING-BIND-ERROR condition that was not included in the CLHS.
18:45:05
Younder
The way I would do it is to paste destructing-bind-error, rename it and add it to your program in a portable way.
18:55:00
dbjergaard
Hi, I'm trying to load unit tests using fiasco and I cannot for the life of me get asdf to load it
18:57:50
dbjergaard
I made the test files/package according to https://github.com/stumpwm/stumpwm/blob/master/stumpwm-tests.asd
18:58:39
dbjergaard
I can (ql:quickload "packagename") just fine, but I can't do (ql:quickload "packagename-tests")
19:04:26
dbjergaard
now I've got another problem, but that's an actual "you wrote wrong code you dummy" problem
19:04:30
aeth
phoe: If you're only supporting a few implementations you could handle this with #+sbcl, #+ccl, #+ecl, etc. You would still need to think about which kinds of errors could happen, e.g. passing (list) to (a b c) gives an arg-count-error (and it looks like that's for defmacro lambda lists so internally they must have the same or a similar implementation) in SBCL, but that's probably not the only possible error
19:06:07
aeth
(If you're doing this as part of an application, then it's probable that your libraries already made the choice for you and your program can probably only run on SBCL and CCL and maybe ECL. If you're doing this as part of a library, you're going to have to support a longer list, but even that's only like 6-8 or so.)
19:10:03
scymtym
if you are willing to invest the effort, maybe try to make a protocol for generating destructuring forms (along the lines of CLtL's PARSE-MACRO, but more specific) instead. only standardizing the error condition seems like a lot of work for comparatively little gain
19:11:04
aeth
Well, just run invalid destructuring-binds and see what you get. #+sbcl sb-kernel::arg-count-error #+ccl ccl::simple-program-error #+ecl simple-error #+clisp system::simple-program-error #+abcl program-error
19:11:20
aeth
This only is problematic in #+abcl because SLIME isn't giving me the package, just the name, and program-error isn't in cl-user
19:13:21
aeth
There are some issues with just seeing what you get. SBCL might be too specific, i.e. you might get something else with a different invalid list passed in if that's possible (try cases with &key and &rest and &body).
20:08:46
phoe
it can properly handle things like (destructuring-bind* (a &optional (b (error "haha"))) '(2))
20:14:18
Shinmera
so it needs to be `(let ((,v ,expression)) (handler-bind ((error #',handle)) (destructuring-bind ,new ,v ,@body))))
20:21:07
Shinmera
`(let ((,v ,expression)) (handler-bind ((error #',handle)) (destructuring-bind ,new ,v (setf ,in-body T) ,@body))))
20:21:45
trittweiler
I'm a bit perplexed by what the point of this is, but assuming it's some kind of learning experience: please note LOCALLY won't be enough because locally only supports free declarations, not declarations of bindings. The bind-modify-lambda-list can also probably be written cleaner.
20:22:17
phoe
trittweiler: right, I'll need to extract the declarations from the body if there are any
20:23:09
phoe
trittweiler: also not really a learning experience, I realized that I have a use case where I want to capture errors that may happen during destructuring, and the standard doesn't let me do that easily.
20:23:46
trittweiler
can't you grab an implementation of destructuring-bind from sicl and use that instead? Seems cleaner imho :)
20:24:42
Shinmera
sicl's carries a lot of baggage, if I remember correctly, because lambda list parsing is extensible.
20:24:54
phoe
https://github.com/robert-strandh/SICL/blob/master/Code/Data-and-control-flow/destructuring-bind-support.lisp
20:36:41
Demosthenex
i think it was suddenly introducing mapcar that confused him, but he got over it
23:31:42
aeth
Oh, cool, someone ported one of Steve Russell's old projects to (a descendant of) another one of Steve Russell's old projects. https://www.guerra-espacial.rufina.link/
23:45:58
mrblack
hi everyone... I'm following the book "Land of Lisp" on Debian, and it tells me to install the "clisp" package. Unfortunately, this package is not part of Stable anymore, so I installed sbcl after a suggestion I got in #emacs. So my question is: when the book tells me to run "clisp", will I have any trouble if I use "sbcl" instead? I mean, will I be able to follow the same instructions and get the same result?
23:48:17
mrblack
I have experience installing stuff from source, as long as there are good instructions for me to follow
23:49:42
Bike
lisp code that works in clisp will almost certainly work in sbcl. the command line switches will be different, but i don't know if LoL uses those
23:50:15
aeth
mrblack: There is one chapter that requires CLISP iirc. The web server chapter or something like that.
23:51:39
aeth
mrblack: generally ime you'll find things to be the other way around, where they work on SBCL but not on CLISP.
23:52:31
djeis[m]
I'd suggest just doing the rest of the book on SBCL and figuring out the web server when you get to it tbh.
23:52:44
djeis[m]
Because I suspect that anything that book says about web servers is outdated at this point.
23:54:24
mrblack
one more: do you guys use Emacs for lisp? If so, do you have any links and recommendations for it?
23:54:36
aeth
mrblack: ime the issues I've had recently with trying to test a short portable program in CLISP were in LOOP (where CLISP either deviates from the standard or SBCL/CCL/ECL do) and in declaring something to be the type of a struct (not sure if structs don't create a type in CLISP or if I would have to wrap the defstruct in an eval-when to also run it at compile time to get the declaration to be valid)
23:55:15
aeth
mrblack: I don't think either would be an issue in the context of working through an introductory book that was written with CLISP in mind
23:56:58
oni-on-ion
undefined behaviors, implementation-dependant functionality, whats the use of a standard? to have a #channel of course
23:57:42
mrblack
aeth, My motivation to learn lisp is to do stuff on Emacs, so I doubt I'll ever get to this advanced stuff that created you problems
23:57:56
oni-on-ion
but it is always talked about, implementation this and that. ironically being a CL channel
23:59:15
mrblack
Bike, I'm using a Common Lisp resource because it is a good resource, educational wise... I don't like the Elisp specific materials very much
23:59:28
adlai
mrblack: be warned that treating emacs as a common lisp compiler will bring along a whole world of unwanted nuisance
23:59:55
djeis[m]
Elisp is definitely easier to learn knowing CL, but they're still rather different languages.
0:01:37
aeth
According to the HyperSpec syntax specification of LOOP, ':for foo type' has to be ':for foo :of-type bar-type' unless type is 'fixnum | float | t | nil' and I was saying ':for foo double-float' instead of ':for foo :of-type double-float'. I (and SBCL, ECL, and CCL) interpreted 'float' as allowing the various float subtypes (including double-float) but CLISP interprets it strictly and only wants fixnum, float, t, or nil, with no subtype of
0:02:06
oni-on-ion
all the CL compilers do all the CL like all the C compilers do the C, we can get into implementation-specific features later
0:02:39
oni-on-ion
its fun to get all the knowledge and information but sometimes we just want to code and get stuff done and play with computers =)
0:03:50
aeth
Put concretely, SBCL, ECL, and CCL accept this, but CLISP does not: (loop :for foo double-float := 0d0 :then (1+ foo) :until (> foo 42d0) :finally (return foo))
0:04:54
Bike
i think clisp is also stricter about clause ordering, or maybe the other way around, or maybe it's been fixed
0:05:11
aeth
Bike: I wanted to keep more :FORs as one-liners but I didn't want to break the line length limit of 100
0:06:51
aeth
oh, oops, I was using 80, not 100, and 1 technically went over it by 1 character anyway.
0:08:15
aeth
The majority use SLIME with GNU Emacs. The minority use Sly with GNU Emacs. Notice the pattern: GNU Emacs.
0:08:54
aeth
I suspect it's the same case, where the majority use paredit, but the minority use something roughly equivalent.
0:09:39
aeth
note that if you don't (setq paredit-space-for-delimiter-predicates '((lambda (endp delimiter) nil))) then some reader macros break with paredit iirc
0:10:04
mrblack
I usually don't do start something looking for lots of tools, but I have a serious case of not being able to parse parenthesis, so I decided to get all the help I can right from the start
0:14:17
oni-on-ion
we arent setting up pre-fab garages and studios, we make our own, based on our workflow
3:41:14
MetaYan
mrblack: A nice Lisp environment based on Emacs and SBCL: https://portacle.github.io
3:54:27
mrblack
MetaYan, oh, I know about Portacle, but I'm an Emacs user already, I think there's no turning back :P
4:01:32
MetaYan
Yes, Portacle is Emacs, SBCL, Quicklisp put together in a nice ease-to install package.
4:09:45
no-defun-allowed
using quicklisp you should install slime then use that slime to load quicklisp so kinda
4:12:26
ober
(ql:quickload :quicklisp-slime-helper) then be sure to source in ~/quicklisp/slime-helper.el in emacs
4:17:24
mrblack
nope... I don't know how to load. I instaled via apt and "whereis" it won't tell me where it is. May I should not use the apt version?