freenode/#lisp - IRC Chatlog
Search
19:44:42
jcowan
anamorphic: I mean the ability to have restarts with user-intelligible explanations that allow a user to say how to proceed from this point
19:44:57
phoe
or, if that's not an acceptable answer, I'd pick the fact that all the partial features forming the language (homoiconicity, macros, conditions, restarts, CLOS, debugger, interactivity, livepatching, introspection, syntax macros, ..., ...) actually work together in order to empower the programmer on their task
19:45:32
phoe
oh, right - that's the ability for Lisp to notice when and what screwed up, present the user with available options, and then be able to unwind safely to a predetermined spot and continue execution from there
19:46:07
jcowan
Just so. I think that emphatically beats all the other features in a ranking of excellence, though I agree that the effects of the other features are synergistic
19:46:07
oni-on-ion
https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-user/Restarting.html
19:46:52
jcowan
MIT Scheme has a lot of MacLisp features still surviving that other Schemes never adopted
19:47:23
phoe
including the ability to actually introspect the condition object using the Lisp inspector, which is an equally awesome mechanism (if not more!)
19:47:51
phoe
and, from the condition object (or from the stacktraces!), inspecting subsequent Lisp objects that happened on the way to the final INVOKE-DEBUGGER call
19:54:36
makomo
speaking of the condition system, what would be a nice way to handle a signalled condition (using SIGNAL), log it somewhere and continue going as if nothing happened
19:55:21
makomo
F wants to handle it, but only to be able to log it later on. it wants G to continue its work nonetheless
19:56:46
phoe
(handler-bind ((condition (lambda (c) (format t "WAAH! A condition happened!~%~A~%" c)))) (foo))
19:57:02
makomo
the handler that does the logging shoudln't decline the handling, i.e. it should perform a non-local transfer. but i'm not sure if there's a "pretty" way to do that?
19:58:05
Bike
if you decline to handle a condition signaled by SIGNAL, SIGNAL will still return normally (i.e. G will just keep going)
20:00:27
makomo
but how would that restart look like? don't restarts have to perform a non-local transfer as well, otherwise INVOKE-RESTART returns with w/e
20:03:30
phoe
you'll achieve what you want - the logging function will log your stuff, and execution will continue
20:03:54
makomo
i have a LU decomposition algorithm thingy. now, i want to report a "warning" when the matrix is nearly singular or similar
20:04:26
makomo
and since i already have this function returning multiple values, i really don't want to add more return values to signify "the matrix could be nearly signular"
20:04:40
makomo
and i don't want to do th elogging from within the LU algorithm itself, for obvious purposes
20:05:12
makomo
the outer function logs it, gets the results, and then maybe prints out the warning when printing out the result
20:05:37
phoe
you can have F have a handler that stores the condition in some list, and then calls the continue restart.
20:06:03
Bike
like if you use WARN (instead of signal) you automatically allow a given F to suppress warnings or not.
20:06:18
makomo
Bike: right, that might be simpler, but i somehow want to "clean up after myself". do you think that's just wasted effort or?
20:06:40
makomo
in the sense that, i want to be the only one to deal with the condition, and not let it bubble up
20:08:11
Bike
like maybe later you do something with a million matrices, and you don't want the interface for that to print a thousand warnings, but you do want a handler that just counts instances instead of logging something
20:08:50
phoe
for example, to invoke an external debugger, so the user may inspect the matrix and decide what to do
20:09:36
phoe
if your code is used as a library, then the information that your code signals a SINGULAR-MATRIX-WARNING might be valuable to programmers that write code that uses your code.
20:10:08
phoe
by catching all of those warnings yourself, you prevent them from getting that information.
20:10:16
makomo
Bike: oh, the function doing the logging is really a "top-level function", not meant to be called by other functions. like a REPL or something
20:10:29
makomo
it calls the underlying algorithms on some tasks and reports the solutions and warnings
20:10:55
makomo
well then i guess i would modify it not to call the restart, and let the signal bubble up
20:11:10
phoe
makomo: if it's a top level function, then I say that you write a handler in F that logs the thing to standard-output and then declines, and signal the condition in G.
20:11:54
phoe
if it's toplevel, then there's a very short handler stack, so efficiency won't hurt you.
20:12:36
makomo
meh yeah, not like i benchmarked it or that i really care anyway, but i just wanted to be as "pedantic" as possible
20:12:44
phoe
write it, and if it turns out to be too slow for you, I guess there'll nonetheless be many, maaany other things to fix rather than "oh this thing is signaling a condition".
20:14:12
makomo
but, putting this "let it bubble up vs. ..." issue aside, what do you think of handling this warning problem using conditions
20:14:27
makomo
i can't think of a better way to do it cleanly, and i wonder how stuff like MATLAB, etc. does it
20:14:44
makomo
how do their algorithms look like, and how does MATLAB's top-level find out that a warning occured within an algorithm
20:15:00
makomo
or Mathematica for example, which warns you when a system might not have a solution or w/e
20:16:19
makomo
well, i would like the user to know that the solution i computed might be really unstable
20:17:08
phoe
if the user wants to get notified of unstable results, they should handle your condition
20:17:22
makomo
yeah, that's what i'm going with, that's settled. i'm just wondering how other systems do it
20:17:53
phoe
a lot of other systems simply throw an exception if some flag is set, which gives you a poor man's condition system.
20:18:09
makomo
other options are returning extra values to notify the caller of warnings or setting some global warning flag or something
20:18:21
phoe
basically, if(throwOnUnstableResult) { throw new UnstableResultException(); } else { ... }
20:22:32
makomo
the other day i was writing some tests. never had so much fun writing tests in my whole life
20:32:31
HerrBlume
Hello, I'm trying to add an jdbc backend to clsql (for abcl.) To get it going i have to remove the ffi dependency from the clsql core package. Does someone know the cannonical repository or mailing list?
20:41:45
HerrBlume
phoe: It does not compile on my machine without throwing errors. And I think it should not be needed for clsql/clsql-sys. So my thought was to remove the cffi/uffi thingy. Writing a clsql-jdbc part should be trival (no other dependency, since the jdbc drivers are loaded via the classpath)
20:43:51
phoe
HerrBlume: hm - I think you might need to fork the github repostory for clsql and add your modifications there.
21:06:24
emaczen
phoe: If I create a bunch of threads with bt:make-thread and then do (format t ...) on them, each threads output gets tangled together
21:08:18
phoe
emaczen: make a lock and hold it around each call that prints something to *\standard-output*
21:08:23
sjl
Write a thread-safe-output-stream with trivial-gray-streams that wraps another output stream and uses locks from bordeaux-threads or whatever to synchronize writes to it, then (setf *standard-output* (make-thread-safe-output-stream *standard-output*)
21:24:34
emaczen
phoe: What you suggested seems to work, why go through the extra work with the gray stream?
21:25:56
phoe
and you can forget about locks altogether and just write FORMAT like you usually would.
21:26:35
phoe
it just writes to a stream; and the fact that the stream happens to be thread-safe is just a handy coincidence.
21:30:52
no-defun-allowed
are there any native machine vision libraries (similar to opencv without the floating point traps) for cl?
21:33:10
sjl
Note that you might also want to deal with *terminal-io* -- for anything but FORMAT, a stream of t means *terminal-io*, not *standard-output*
21:33:40
sjl
e.g. (format t "foo") writes to *standard-output*, but (princ "foo" t) writes to *terminal-io*
21:33:50
aeth
I'm considering implementing BLAS in native CL (and possibly also in a Lispy-lang-on-GPU as well) because the current options for this sort of thing disappoint me that much. From there it's only 3-4 steps to a useful library.
22:28:49
jcowan
Does anyone have practical experience with loading third-party plugins into their application with LOAD?
22:45:31
aeth
The only differences with that and ASDF (assuming you load the files in the same order) are, afaik, that you'll recompile every time and the FASL will be in the same directory (possibly implementation-specific?) instead of in ~/.cache/common-lisp
22:46:33
jcowan
but what I'm asking about is whether people exploit the ability to load a file whose name is computed at runtime.
22:48:28
aeth
The laziest way to do this would be to use Quicklisp to quickload an ASDF system. There's probably a proper way to do this via ASDF.
22:53:59
aeth
jcowan: I think the idiomatic way to solve that problem in modern CL would be to compute the directory containing the foo.asd file that describes the system foo and then have ASDF recognize that directory (would that be by pushing it to asdf:*central-registry*? not sure here)
22:56:18
jcowan
I see two problems, or perhaps only one: you can't sandbox what you load easily, and you don't know how to interface with it except by convention or reflection.
22:58:04
aeth
Sandboxing is apparently impossible in current implementations. Iirc, beach is working on an implementation that permits sandboxing as one of its goals.
22:58:07
aeth
https://github.com/robert-strandh/SICL/blob/e19613c61d8797a9ea586e3c513efdaeb0860d68/Papers/Global-environments/sec-benefits.tex#L92-L119
23:48:01
griddle
I've got a quick question. I've been working on implementing a small lisp interpreter and I'm interested in how '(...) and (quote (...)) relate
0:09:52
jcowan
If you had a sandbox, you could statically examine what it does and see if you are willing to load it into the live image, but of course there are no guarantees about what crimes it might commit dynamically.
3:17:45
r0sebush
question from a sbcl newbie.. What's is the best method to include libraries, like cl-ppcre into your lisp code for production release? .sbclrc or include (ql:quickload ...) in your code base?
3:39:49
gendl
2. When ready for release, use (asdf:operate 'asdf:monolithic-compile-bundle-op <your-application-system-name>)
3:40:24
gendl
that will produce one big .fasl with your whole application including its depended-upon stuff, presumably in the right order.
3:40:52
gendl
then start a fresh sbcl image, load this .fasl, then dump image. (I'm not sure the specifics of that with sbcl). ASDF also has built-in operators for doing that.
3:41:43
gendl
See this ancient blog post which needs to be updated/added to: http://gendl.blogspot.com/2013/03/saving-images-with-asdf3.html
3:43:37
gendl
it was suggested earlier today that someone needs to make a do's-and-don'ts for production application release and maybe a how-to. It's something which should be pretty routine and well known at this point but doesn't seem to be.
5:45:44
no-defun-allowed
- use burgled-batteries to interface python module that interfaces opencv for images
6:22:44
no-defun-allowed
still, most of this box-mangling and vision stuff would read better in lisp but common-cv is just a very fine wrapper over C unfortunately