freenode/#lisp - IRC Chatlog
Search
0:11:30
AeroNotix
I just had a whacky idea of layering a description similar to what PAT uses, to both create the model and the executable CSP code
4:09:01
asarch
If I already have installed some packages with QuickLisp and SBCL, is it ok to load other packages with CLISP? I mean, both actually save the package information in $HOME/.cache/common-lisp
4:39:40
MichaelRaskin
Xach: jcowan: I think there was a talk on ELS about automating use of rename-package — it was described as a mostly sufficient escape hatch in practice.
6:35:49
mange
I'm also not sure I understand the question, but ',(wrap-1 'macro-arg) would be closer.
6:39:04
beach
mange: Your second one gives a "comma not inside backquote". If I replace the ' by `, then the result is not the same.
6:44:52
mange
I'm not sure it will be possible. You need to pass a value into #'wrap-1 that will unquote itself in the expansion. Can you change wrap-1?
6:46:50
mange
Or, alternatively, can you rely on wrap-1 to always do a simple wrapping like it currently does?
6:49:07
beach
These are condensed examples of something much more complex, so in reality wrap-1 does much more and I want to reuse it if possible.
6:50:46
MichaelRaskin
If wrap-1 is given as a function, it is undistinguishable from (defun wrap-1 (form) (list 'bar form)))
6:54:32
no-defun-allowed
i want to write an async client for cl-decentralise which will register listener functions on cl-d channels whenever a certain message is received
6:56:56
beach
I want to write a function wrap-3 so that if I type (wrap-3 'some-form) I get the same result as if I type (wrap-2 'some-form), but instead of mentioning BAR explicitly in the body of the function, I want wrap-3 to call wrap-1 to obtain the same result.
7:00:48
MichaelRaskin
Because ,(list (first '`a) (wrap-1 (second '`,macro-arg))) happens to work on SBCL
7:03:49
beach
Anyway, thanks everyone. It appears that any solution will be more complicated than just repeating the body of the wrap-1 function inside wrap-3.
7:04:32
MichaelRaskin
You can also just put a wrap-1 call there, which will give a different expansion but the same functionality
7:04:46
mange
If you're willing to have wrap-1 be (defun wrap-1 (form) ``(bar ,,form)) then I think you can do it, but it will mean that other calls need to have an extra quote.
7:05:35
MichaelRaskin
But yeah, implementation is free to treat `form as _any_ form that evaluates to the correct result
7:05:55
jackdaniel
mange: as I understand it wrap-1 may have arbitrary expansion, this is just an example
7:06:56
mange
jackdaniel: Yeah, but the approach of "add an extra layer of quasiquotes" may be able to be applied more generally.
7:09:36
MichaelRaskin
Actually, just putting unadorned (wrap-1 macro-arg) should be a viable strategy
7:19:18
beach
Not just that. I think I can do it if the expansion of wrap-3 is allowed to contain a call to wrap-1. But I do want the immediate output of wrap-3 to be the same as that of wrap-2.
7:21:44
MichaelRaskin
I think it is provably impossible without modifying wrap-1. There are multiple posible read results of `, and if you want your code to look the same as if ` was written, input-output relation of wrap-1 is not wnough
7:28:07
beach
Anyway, I have several ideas now. Thanks to everyone. Time to go do something else for a while.
8:31:28
beach
Hmm. CALL-METHOD and MAKE-METHOD are some of the most complicated macros (or rather forms that wrap some other forms in those macros) I have ever attempted to write. In case anybody wondered, that's what the exercise was about.
9:36:35
beach
j`ey: Er, no. It doesn't provide anything except code to compile any Common Lisp form.
9:38:28
beach
SICL, on the other hand has as a goal to be a fully conforming Common Lisp implementation. But it is not finished yet, so there is still some code missing.
9:40:19
j`ey
beach: does Cleavir have textual output? Do you have a really basic example I could look at
9:42:00
beach
What kind of textual output are you referring to? Currently it generates a graph of intermediate code that client systems can then translate to LLVM or assembler or whatever.
9:43:42
j`ey
I was thinking textual output like LLVM IR has, but a picture/graph would be useful too
9:46:35
no-defun-allowed
ACTION uploaded an image: tumblr_o16n2kBlpX1ta3qyvo1_1280.jpg (137KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/QKyfnMJUkJdTxClYnaEJneZJ >
9:48:01
beach
no-defun-allowed: Come on. This is a picture of a tool to view IR with. The person using that tool knows perfectly well what it means.
9:48:31
beach
no-defun-allowed: I wasn't about to make a special picture for j`ey with a legend in it.
9:48:46
jackdaniel
I expect that the guy with cigarette on the photo knows perfectly well what these sheets and lines mean :)
9:54:40
shrdlu68
I'm trying to optimize some code which subseqs a simple-bit-vector a lot, and it appears that subseq'ing conses much less that using displaced bit vectors.
9:57:57
beach
A displaced vector must set up a lot of information that needs to be stored somewhere.
10:00:27
Shinmera
right, so the contents fit into a word, meaning the overhead of a copy is going to be very small
10:00:45
beach
j`ey: I think you may have a hard time finding that kind of information. There is Lisp in Small Pieces, but you won't find IR graphs and stuff in it.
10:02:01
shrdlu68
shka_: I'm keeping that in mind, eventually I will try it . Right now I'm trying a scheme where I sxhash the substrings, converting them to fixnums.
10:02:02
j`ey
beach: what I was really thinking about was macros from CLHS, which I assume cleavir does have to implement
10:03:17
beach
j`ey: Which is fortunate, because there is not standardized expansion of standard macros.
10:04:48
shrdlu68
shka_: Indeed it isn't. Using (mod (sxhash substring) (expt 2 24)) as the indices of an array, it's about two seconds faster than the hash-table implementation. It consumes much less memory, though.
10:04:56
beach
j`ey: Cleavir sees a macro in the current environment. It calls the macro function, giving it the form and the environment. It then compiles the resulting form instead.
10:05:03
j`ey
beach: when you say 'supplied', is it just like how the defmacro from yesterday is supplied? https://github.com/robert-strandh/SICL/blob/master/Code/Evaluation-and-compilation/defmacro.lisp
10:06:18
beach
j`ey: I don't remember the defmacro from yesterday. Compilation takes place in an environment that the client defines. That environment must contain definitions of every macro that is used in the code to be compiled.
10:07:43
beach
j`ey: You can do the following experiment. In a SLIME REPL, type (macro-function 'with-output-to-string)
10:08:13
beach
j`ey: The client (SBCL or whatever) already has a definition of that macro. Cleavir just works with that.
10:10:28
beach
j`ey: Then it compiles the IF instead. Now IF it has to know how to compile, because that's a special operator.
10:16:09
j`ey
beach: ok, so the client will setup an environment that contains all the macros that CLHS has declared?
10:23:05
j`ey
still a little unclear how defmacro works. cleavir seems a (defmacro blah..) and calls the defmacro macro from the environment. does that update the environment to include the 'blah' macro?
10:25:52
beach
I can't understand the "cleavir seems a ..." part. But yes, DEFMACRO updates the environment so that it includes the definition of that macro.
10:27:19
beach
Try (defmacro foo (x) `(car ,x)), then (funcall (macro-function 'foo) '(foo (f y)) nil)