freenode/#lisp - IRC Chatlog
Search
8:00:52
Nilby
I must have forgot. Is there some way to turn a list into a function without eval, compile, or macro around defun?
8:01:43
Nilby
Like I want to turn l2 into a function: (let* ((l1 '(+ 2 3)) (l2 `(lambda () ,l1))) l2))
8:03:13
Nilby
no-defun-allowed: Hmmm. I guess compile and eval seem heavy for a tiny anonymous function.
8:04:10
no-defun-allowed
In this specific case, you could make it (let ((closure (lambda () (+ 2 3)))) (lambda () (funcall closure))).
8:05:33
no-defun-allowed
Using a chain of closures works well enough most of the time. (For example, CL-PPCRE uses a chain of closures to basically produce a non-deterministic machine which finds matches.)
8:08:46
Nilby
I guess I'm thinking of some old days where it just stored the lambda list as the function binding.
8:10:36
Nilby
Tangentially related, I was surprised by sbcl telling me this: "Objects of type COMPILED-FUNCTION can't be dumped into fasl files."
8:10:48
saturn2
that's pretty much what sbcl will do if you set sb-ext:*evaluator-mode* to :interpret
8:12:05
Nilby
saturn2: That's what I was thinking I guess, but if I do that then I'm in non-portable land.
8:16:27
no-defun-allowed
Really, if the forms you generate are similar enough, just use a chain of closures. If not, then compiling wouldn't hurt.
9:02:25
lukego
Hey how do you normally do a (list-of FOO) type? is there anything like that in e.g. alexandria or serapeum that's standard and idiomaic?
9:04:24
beach
He defines something called a "regular type expression", or RTE, that can express that kind of stuff. But it uses SATISFIES, obviously.
9:04:40
lukego
I will, but to be clear I mostly want to write (list-of FOO) in the source code for clarity, I don't mind if the impl would be e.g. with SATISFIES or just (deftype list-of (x) 'list)
9:07:05
lukego
that library looks very interesting (https://github.com/jimka2001/regular-type-expression) but looks like it's excluded from quicklisp due to build problems? https://common-lisp.net/project/cl-test-grid/library/regular-type-expression.html
9:07:37
lukego
yeah. I'll probably use SATISFIES although I understand that people generally resist this so wondered if there was another popular formulation
9:29:47
lukego
but for now I've written (deftype list-of (x) (declare (ignore x)) 'list) and this is ample for current purposes i.e. to avoid losing information while transcribing from an EBNF grammar into lisp structs.
9:30:34
lukego
I also added a similar (nyi-of X) that translates into T but captures that I need to define a proper X type later.
9:48:30
lukego
(I'm trying to transcribe an EBNF grammar for LLVM IR into Lisp structures - with serapeum DEFUNION - and trying on the one hand to only do the few bits I'm interested in right now while on the other hand keeping track in a disciplined way of what I'm skipping using information-preserving stubs.)
9:54:09
phoe
the main issue with gensyms is that it's impossible to preserve their identity across FASL-dumping
13:56:20
gendl
hey, I’ve been helping my son with his university C++ class. He recently decided to give Emacs a try, so I helped him follow the professor’s set up instructions to install company-mode and flycheck mode. These two modes pretty much makes emacs emulate the good parts of vscode, for c++ at least.
13:57:00
gendl
Then I noticed that company-slime mode is a thing, and it looks pretty active. I’m eager to give it a try. Any caveats there?
13:57:48
gendl
and how about flycheck-mode for CL? Is that a thing, or is there a potential for something like that?
14:01:17
gendl
oh is that what spacemacs is. Sorry, should’ve looked it up. Are used to be a vi user years ago, and I can still use VI in a terminal when I need to, but my fingers have pretty much been trained with native Emacs editing commands now
14:01:28
spacebat2
spacemacs, doom-emacs, there are several "config distributions" that are good to get started
14:02:12
spacebat2
also consider trying out sly, which is a fork of slime that has diverged significantly
14:02:48
gendl
well, I have a custom extension to slime called glime, I’m not sure if that would work with sly
14:03:07
phoe
spacemacs is just a collection of melpa packages that are preconfigured to work together, plus some custom configuration mechanisms
14:03:46
phoe
slime-company should work fine wherever you have slime loaded, it's not like it has a spacemacs dependency
14:04:51
gendl
I am a complete noob with emacs lisp, glime was developed by a few consultants we hired over many years. At some point I’m gonna have to learn How it works, to be able to maintain it — or find a consultant who is willing to do same
14:08:10
gendl
glime shows you The possible completions for gendl, which typically are object messages, it’s kind of a Smalltalk kind of thing
14:14:25
gendl
glime just piggybacks on slime’s completion mechanism so we’ll see — if it’s set up properly, I’m supposing it should “just work” with slime-company. But I certainly won’t be surprised if some tweaking will be necessary. In which case I might be back here begging For help or asking if any slime experts would be interested in a small paid gig
14:16:35
gendl
Because I’m pretty sure we will make gendl look more attractive to the kids these days If it is mimicking their shiny “modern” IDEs such as vscode — and slime–company looks like a step in that direction.
14:21:51
gendl
I just noticed there is a separate #slime channel in here. I suppose any more talk on this thread could move over there
14:28:21
pjb
you use the lisp syntax. Have you have a look at Objective-CL, my reader macro to use a Objective-C-like syntax: [objet messageWith:[ref getArgument] andWith:(+ 2 3)]
14:29:33
pjb
Using a reader macro let's you define syntactic scopes where you may use identifiers without shadowing similar named symbols.
14:30:23
pjb
[super sameMessage] and [self otherMessage] are such examples (super and self are just identifiers, not interned as symbols).
14:32:00
gendl
We would have to work out some kind of licensing deal with you before I can truly take a look at your stuff or consider it, because I believe it is all AGPL licensed. And we do dual-license Gendl as Genworks GDL which is used for closed-source proprietary distributions.
14:34:49
gendl
Gendl itself is also AGPL licensed, which I suppose makes it totally compatible with your stuff license-wise, if people are going to use it according to AGPL terms. So a third-party Who is not concerned about being exposed to these code bases could happily take a look at what you’re talking about and see if there is potential there.
14:53:16
gendl
OK, perhaps we can discuss potential terms in due course if it appears mutually advantageous to do so.
14:54:39
pjb
The lower layer would have to be implemented for gendl. Do you need only the Objective-C smalltalk syntax?
14:54:47
pjb
There is also an alternative library: https://common-lisp.net/project/cl-objc/cl-objc.pdf
14:58:26
gendl
pjb: my guess is that gendl could benefit from many of your packages. Objective-CL may or may not be one of them. But, our message passing syntax, especially for messages which take arguments, Is
17:23:32
contrapunctus
beach: https://varnish-cache.org/docs/trunk/phk/notes.html#so-what-s-wrong-with-1975-programming ?
18:30:46
pjb
contrapunctus: beach: to be profitable in lisp, we need to be able to talk with the GC to manage zones that are mapped to files, and to specify file-local root-sets (since files could be used by several processes, the objects in memory mapped files cannot be collected willy-nilly).
18:31:32
pjb
the question is what to do when an object is referenced from the root sets of two different files? In what zone should it be moved/stored?
18:33:23
pjb
file 1 rootset = {#1=(a . nil)} file 2 rootset = {#2=(a . nil)} (setf (get 'a :k) 42) should the plist (symbol-plist 'a) be stored in file 1, in file 2?
18:39:36
pjb
or a dynamic scope? (with-zone (file1) (push (list 1 2 3 4) (root-set file1))) for explicit allocation in the memory mapped zone. Otherwise (push (list 1 2 3 4) (root-set file1)) would imply moving the objects.
18:40:12
pjb
Of course, great care must be applied to avoid moving the whole lisp image into a memory mapped file (unless this is what we want).
18:43:09
pjb
This could be used instead of fasl files. Compiling could generate such partial lisp images that would just be memory mapped when "loaded".
18:51:25
pjb
In ccl, if we compile this file, restart and load it, https://termbin.com/fsre then the symbol-value and the plist are lost, while the uninterned symbol itself is still referenced by foo::*foo*. Is this conforming? Is this acceptable?
18:52:02
pjb
Of course, if the symbol wasn't uninterned, we could have conflicts between values, functions, and plists coming from different files…
18:56:23
pjb
Lisp images don't have load-time-values, but there are extension hooks to run code when loading a lisp image in some implementations.
18:57:06
pjb
the advantage of load-time-value is that it gives a clear semantic (the side effects are applied when the file is loaded/mapped).
18:57:44
pjb
But this means that we have to specify a list of objects that are not saved (entirely) in the memory mapped file…
19:29:24
jmercouris
I'm trying to run the CLIM demos and when I try to (ql:quickload :clim-examples), get this: http://dpaste.com/CVVXAHKUN
19:45:14
phoe
AFAIK you need to quickload one more system that contains the fonts, but I don't remember the details
19:45:52
jmercouris
and I see the following: (defparameter *truetype-font-path* (find-if #'probe-file '(#p"/usr/share/fonts/truetype/ttf-dejavu/" ...)))
19:46:09
jmercouris
seems those paths are hardcoded... UNLESS I get to that restart and handle it myself
19:46:49
jmercouris
I guess I need to convince NixOS to have fonts at that path or something, not sure
19:53:17
waleee-cl
jmercouris: isn't it ostensibly possible to use clim on windows? If so it must be ways to configure the font paths or another mechanism
19:53:47
phoe
then fill in that variable yourself with the value of (uiop/pathname:pathname-parent-directory-pathname (cl-dejavu:font-pathname (first (cl-dejavu:list-fonts))))
19:54:06
waleee-cl
ah, xserver dependeny. Ok, so technically possible to run on windows, but a hassle
19:55:47
jmercouris
phoe: I don't see this system anywhere, that's OK, I'll specify the path in the restart