libera/#commonlisp - IRC Chatlog
Search
20:53:16
ecraven
does slime have a "call this lisp function with region as a parameter and replace region with the result" builtin?
20:55:03
lisp123
I haven't played around much with slime's output / result settings, so I might do that as an exercise one day - let me know if you struggle with it
21:11:14
lotuseater
lisp123: spacemacs with slime is running here fine too. this DELL laptop I borrowed temporarily has some hardware issue
21:12:46
phantomics
I've been looking at developing an Emacs mode for April to give a REPL experience similar to the GNU APL mode
21:13:27
lisp123
ecraven: Functions you need to use to do what you are after are (slime-eval-defun), (kill-region), (insert ...), slime-eval-print
21:13:54
phantomics
Apart from that, another longer-range project of mine is aimed at creating a general-purpose Lisp interface, kind of like an IDE
21:14:01
lotuseater
phantomics: yes that was also what i thought about. or as i wrote, building with McCLIM some sort of IDE as Dyalog offers
21:14:46
lisp123
the first one (slime-eval-defun) you can probably avoid - you can use (buffer-substring-no-properties (region-beginning) (region-end)) to get the form, then pass it through slime-eval-print to get the result, then kill-region to delete the current region and finally insert to insert the result
21:15:10
lotuseater
we talked about eg it can get more performance by eg SIMDs meaning the SBCL intrinsics
21:16:05
lisp123
lotuseater: nice :-) will be curious to see how much performance you can get out of it (e.g. can you run a CRUD server)
21:16:54
phantomics
I build a web-based interface before where I had a window of APL code next to a window containing a Minecraft-style voxel environment generated by the APL
21:17:03
lotuseater
lisp123: atm i have NO IDEA how that even works. there is this nice blog article by Paul Khuong about it "for when abstracts too much away" :D
21:24:46
lotuseater
it was beginning of last year i got it running but didn't get how to do stuff. before my system had issues finding the .so files
21:39:54
lotuseater
the most important file is spec.lisp as you said in your long talk, right? i have to watch it again in detail and try out
21:45:33
phantomics
Most of the functions are implemented in library.lisp and aplesque/aplesque.lisp
21:46:01
lotuseater
and as i see the parser is with combinators. i wonder if Dyalog does it this way
1:10:54
Josh_2
I keep getting a very annoying bug when making HTTP requests using Dex I get an error complaining about writing to closed SSL, https://plaster.tymoon.eu/view/2564#2564 however if I try the request once again it works just fine, five minutes later it will signal that error again..
1:21:46
etimmons
Josh_2: Try with `:use-connection-pool nil`. Dexador's connection pool support is broken and unsafe in general.
1:23:48
etimmons
No idea. It's also worth noting it's possible to do connection pooling in Drakma, it's just not built in.
1:24:19
etimmons
I tend to only use Dexador on Windows since its story for https on Windows is better
1:27:38
etimmons
I wish I had the time to integrate winhttp into drakma, then I wouldn't have to worry about dex at all
1:32:10
moon-child
the sicl meme precedes it. I kinda wonder how that happened--it's not like it has a large marketing budget
3:07:56
beach
moon-child: I think it's the published papers. They have been peer reviewed, so there must be some substance there.
3:10:26
pillton
I have a design question which relates to a chronology I have observed many times. An application originally invoked a function f(x). Over time, the function changed to f2(x) = h(x;p) where p is a parameter provided by the user of the application. My question is, how would you structure the application given that f(x) and f2(x) or potentially f3(x) are useful implementations? Would you 1) add a slot to the application state which stores
3:10:26
pillton
a closure which closes over the parameter p or 2) implement f(x) using a dynamic variable *VAR* which invokes the generic function (EXTENDABLE-F X *VAR*) or 3) just change f(x) to h(x;p) and provide a default value for p or 4) something else?
3:14:11
beach
pillton: I think the right answer depends a lot on the details. But I can tell you that, for SICL, we have developed a style that is close to number 2, but not for the reason you give. We have a first argument CLIENT that the library does not specialize to, and client code can write methods with specific clients.
3:15:53
beach
This style allows us to provide lots of useful default functionality in the library, while still allowing complete customization for clients who need it.
3:17:37
beach
This style also allows the same library to play different roles in a single Common Lisp image.
3:24:53
beach
I guess that's true. But I didn't generalize what Josh_2 said to be a "positive public image".
3:29:30
moon-child
I feel that there is a general perception of sicl as somewhat of a holy grail in lisp implentation, and that this perception has more than a little to do with performance
3:29:48
moon-child
how many times is it now people have asked whether sicl is ready yet, or when it will be ready? :P
3:45:56
beach
It is true that we have come up with techniques that are likely faster than the analogous technique used in current Common Lisp implementations (like generic dispatch, path replication, call-site optimization), but my main goal is for SICL to provide excellent debugging support.
3:48:41
beach
In fact, until I came up with the call-site optimization technique, I was convinced that SICL would never be able to compete with the best existing Common Lisp implementations in terms of performance.
3:56:44
beach
Another issue is that, although we are getting closer to generating a native executable for SICL, there is a lot of work left to implement all the optimizations we want, and that is going to take time.
4:11:15
phantomics
One key to performance will be allowing the generation of ASM code like SBCL does, I think I asked you about that before
4:12:10
beach
That's an easy one. And it is taken care of. But that alone won't imply good performance.
4:12:35
phantomics
People have complained about the stagnation of CL, but the define-vop in SBCL is a major point of distinction that makes much higher performance possible, it could lead to a division of CL between SBCL and non-SBCL
4:14:17
beach
I don't see that. The Cleavir compiler framework is quite easy to customize, but it doesn't have a define-vop.
4:19:24
beach
Well, first of all, we don't generate "ASM". We generate a graph of standard objects representing "instructions" that are closer and closer to native with different passes. And each pass is defined by a bunch of generic functions that can be customized, so that new "instructions" can be provided.
4:20:06
kakuhen
Is there a function like FIND-CLASS that does not signal error if class is not found? I know that you can write (find-class 'name nil), but it does not feel "idiomatic" to me.
4:20:09
beach
I haven't studied SBCL internals much, but I suspect define-vop is just an implementation echnique.
4:22:08
beach
kakuhen: It is a slippery slope to start writing code for people who might now only part of the language.
4:41:58
beach
phantomics: SBCL is great, of course, but there are some issues with it as well. For one thing, the garbage collector is not that great. And the technique used for generic dispatch was designed at a time when memory access and register operations were roughly equally fast. For call-site optimization, SBCL addresses a number of special cases, but in general, I don't see any attempt to get good performance out of keyword arguments an
4:45:45
phantomics
beach: I see, I'm sure there's room for improvement. It seems like SBCL is ahead of other impls in the area of generating custom ASM, which you need for SIMD. That's why things like the sb-simd project are SBCL-only, and why if I add SIMD support to April it may only be available in SBCL. It would be great to see more support for use cases like this
4:47:33
phantomics
Also, all CL impls have some shortcomings related to array handling: for instance, you can't have a vector of 8 64-bit ints and create another reference to it as a vector of 64 8-bit ints like you can in C, this would help in some situations
4:55:56
beach
Most such "shortcomings" are not about the implementation(s), but about language semantics. This particular case might be possible, though.
4:57:16
kakuhen
a little birdie told me sbcl is getting a new garbage collector and it's apparently going to be great
4:58:40
|3b|
i suspect sb-simd being sbcl only is more about # of users than anything else (and ecl has had a simd extension for a while i think)
4:59:39
|3b|
(and also that "sbcl is fast" so the users that care about performance enough to write simd code are using sbcl)
5:00:41
kakuhen
there's pretty much only three reasons i use ccl: objective-c bridge, more "efficient" gc, and starts up faster on my computer; it seems inferior to sbcl as far as number crunching and saving heap images goes
5:01:00
kakuhen
so for instance, on sbcl you can save a heap image and compress it down quite a bit, with minimal impact on performance; ccl has nothing like this
5:02:51
|3b|
the nibbles library helps with a lot of the situations where you want to read a chunk of memory as various types, though not transparently and you have to start from a vector of 8-bit ints
5:04:30
|3b|
(and most of the cases where i care about that sort of thing, transparent "8x64-bit <-> 64x8-bit" isn't what i would want anyway, since i usually care about "Nx8-bit <-> some arbitrary layout of mixed types")
5:07:43
|3b|
i think ccl has "LAP" for defining things in asm, and according to the docs that supports altivec on ppc, so you could make a portable simd lib that supported that if you happened to still have some PPC somewhere :p
5:15:12
kakuhen
i was planning to build a small blackbird workstation, but the power9 chips are on backorder
5:15:39
kakuhen
the power architecture is forwards compatible, based on what little i was able to find online
5:37:25
beach
kakuhen: That's great news about the SBCL garbage collector. Do you know any details about it?
5:38:40
hayley
|3b|: Right, there's a Lisp assembler in Clozure. Though I don't know if the assembler knows any SIMD instructions on PowerPC or x86-64. (It does, however know about the instructions to do an atomic increment rather than a CAS loop, but that is something else.)
5:39:36
hayley
beach: SBCL is going to support use of the Memory Pool System. The Boston Lisp Meeting I attended was about it, and I believe I provided a link for the slides...
5:41:26
hayley
I forgot exactly how DEFINE-VOP works, but it ends up generating another kind of instruction, which eventually is replaced by a user-defined sequence of instructions. This would not be awfully difficult to do in Cleavir.
5:42:55
hayley
We could create a HIR instruction class which eventually is replaced with a sequence of LIR instructions that the user provided -- well, yes, that's pretty close.
5:45:45
hayley
But generally I hope that DEFINE-VOP is the last resort for doing SIMD work; rather the compiler should vectorise where possible, and then a programmer could use "intrinsic" functions like in C or SB-SIMD if the compiler cannot vectorise for them.
5:47:25
hayley
Such functions are probably more important in Common Lisp, as they can perform type and bounds checks and are generally safe. Although VOPs do require precise type definitions, it is not hard to generate completely broken and unsafe code.
5:51:16
hayley
Of course, in an APL compiler like the one phantomics is writing, there are relatively few tight loops that need assembly to be written for them. But otherwise measuring the performance of anything with explicit SIMD instructions tends to be more of a challenge of who memorised the fastest instructions.
5:55:15
kakuhen
I was using remove and comparing the car of each cons cell; but this kept giving me an error that the alist was not the type SEQUENCE
5:59:15
kakuhen
ok thanks so much; this solved my issue... not using #'car in particular, but I put in a small lambda that did exactly what I wanted. thanks
6:44:37
kakuhen
so I was adding custom conditions and signalling errors, and offering restarts for these errors
6:44:48
kakuhen
in some random cases, the restarts simply wouldn't appear, and then the restarts would provide errors
6:47:27
hayley
It could help to do the work of the macro in a function, and then have the macro expand to something like (call-with-foo (lambda () body ...)), provided that there is enough code that doesn't need to be generated every time.
6:58:42
beach
Speaking of SIMD, one thing I would like in SICL some day is a set of excellent FFT functions, and those would very likely use SIMD.
7:11:56
hayley
I have an implementation of the Cooley-Tukey algorithm written in Petalisp, and Petalisp will likely be an early user of SB-SIMD.
7:16:35
beach
That's optimal with respect to arithmetic operations as I recall, but hard to manage because of the space.