freenode/#lisp - IRC Chatlog
Search
20:46:09
|3b|
you could try expanding the macros yourself using implementation macroexpander where it works and your own if needed
20:46:31
|3b|
so you write a code walker but hopefully can reuse some of the implementation's macros
20:46:31
aeth
kristof: I think you want something like this: (let ((candidate-macroexpand (macroexpand-1 foo))) (if (typep (car candidate-macroexpand) member-type-with-forms-to-stop-on) #| continue on the candiate-macroexpand |# #| return the old macroexpand |#))
20:47:18
PuercoPop
kristof: maybe CMUCL/SBCL's IR1 would work for what you want? The CMUCL design document describes as a subset of CL
20:47:22
|3b|
or just read things into a package that shadows things like DEFUN where you don't like the built-in definition
20:47:23
aeth
kristof: e.g. (macroexpand-1 `(dotimes (i 42))) in SBCL gives a form beginning with DO and (macroexpand-1 (macroexpand-1 `(dotimes (i 42)))) gives a form beginning with BLOCK over a LET over a TAGBODY
20:48:03
kristof
Although I also like |3b|'s idea, to be honest. I could write my own package that doesn't use CL and imports only the macroexpansions I want.
20:49:19
kristof
PuercoPop: if I'm going to eventually port to Cleavir I see no reason to devote myself to someone else's IR, but I appreciate the suggestion
20:51:26
pjb
kristof: if you want more "primitive" then go ahead! ALL the operators in CL can be primitives! The macros in CL can be special operators (but you must still provide macros for the user programs to macroexpand them), and all the functions in CL can be open-coded.
20:57:27
aeth
kristof: (defun macroexpand-until-symbols (form) (loop :for macroexpand := (macroexpand-1 form) :then candidate-macroexpand :for candidate-macroexpand := macroexpand :then (macroexpand-1 macroexpand) :until (or (typep (car candidate-macroexpand) '(member do)) (eql candidate-macroexpand macroexpand)) :finally (return macroexpand)))
20:57:51
aeth
That stops macroexpand-1 on either DO or exhausting the macroexpansion (i.e. the macroexpand being itself)
20:59:42
aeth
hmm, doesn't work on (defmacro foo (i &body body) `(dotimes (,i 42) ,@body)) (macroexpand-until-symbols '(foo a))
21:01:49
aeth
This one works on both: (defun macroexpand-until-symbols (form) (loop :for macroexpand := form :then candidate-macroexpand :for candidate-macroexpand := (macroexpand-1 macroexpand) :until (or (typep (car candidate-macroexpand) '(member do)) (eql candidate-macroexpand macroexpand)) :finally (return candidate-macroexpand)))
21:03:22
aeth
You have to have two versions of the macroexpand to eventually terminate in the case that it's not part of the member type, in this case an example would be '(defun foo ())
21:10:16
pjb
Or you can macroexpand in an environment where you've removed all the macros that are implemented as special operators.
0:51:16
pjb
You can alway (defun fpos (f) (file-position f)) (defun (setf fpos) (n f) (file-position f n) n) and use fpos instead.
0:54:12
|3b|
but silently discarding errors doesn't seem good either, so i'd say it just shouldn't return if it can't validly return the value returned from FILE-POSITION
0:54:59
pjb
I've got a serie of accessor to read and write files, but of course, you have to take them with a grain of salt.
0:55:23
|3b|
ACTION can't tell from spec if it is allowed to set it to a position other than the one you requested (and then return that different position, though doesn't seem like it)
0:56:05
pjb
The only file position that have a good chance of success are those returned by file-position.
0:57:33
pjb
So, you have (unsigned-byte 8) files, which will probably do what you expect on posix systems, and there are other files for which you need to be more careful.
1:10:43
AeroNotix
pjb: thanks for informing me that functions and setf functions are a possibility in Common Lisp
2:14:55
no-defun-allowed
if spi speed isn't a problem, i might have a go at writing an "extended" lisp for arduino
2:15:22
no-defun-allowed
i have two 128kb sram chips, so one will be from-space and the other is to-space
2:16:43
|3b|
if there is no :use clause in defpackage, behavior is unspecified so it is OK, :use () shouldn't use any other package though
2:20:59
no-defun-allowed
*when the reader reads a symbol it flips a coin and uses that to decide if it should intern a new symbol or use the CL symbol
2:25:05
kristof
Right, but the *compiler* might not even store a fill pointer (and I would hope not)
2:25:45
|3b|
antonv: you aren't allowed to modify any object created by the reader while reading the program source
2:31:03
|3b|
right, at the point where you are evaluating (read-sequence #() ...) you are evaluating a list containing the symbol CL:READ-SEQUENCE, the self-evaluating object #(), and whatever objects are in the ...)
2:32:31
|3b|
as opposed to when you evaluate (read-sequence some-vector ...) or (read-sequence (vector ...) ...), in which case the 2nd element of the list is a symbol (which evaluates as a variable), or a list starting with the symbol CL:VECTOR (which evaluates as a function call), in neither case a self-evaluating object
2:35:39
antonv
kristof: the reference to The ANSI Standard, Section 3.2.2.3 doen't really help, IMHO
2:36:34
|3b|
consider what would happen if you were using a lisp editor to edit your code, and it stored your source (read-sequence #(1 2 3) ...) as lisp forms instead of a string, then evaluated the form and it changed the #(1 2 3) that was being used to store your code
2:39:28
|3b|
and for a more current example, i think sbcl gets confused (or has recently) by macros that modify their input since it changes the forms it stores for debug info (or something like that, been a while)
2:39:40
antonv
kristof: adding "3.7.1 Modification of Literal Objects" to the warning message might be helpful
2:55:43
beach
"The idea behind establishing this convention was to eliminate noise generated almost every time someone comes in and greets using some form of day-time based greeting, and then channel members on the other side of the globe start pointing out that it's different time of the day for them."
3:00:45
beach
no-defun-allowed: [getting back to topic] There is lots of work to be done in all the Common Lisp projects I have listed. Yesterday I made excellent progress on SICL bootstrapping, and I want to continue that work while it is still fresh in my mind.
3:02:11
beach
This bootstrapping thing has got to be one of the most complicated tasks I have ever tried.
3:03:41
beach
no-defun-allowed: A mixture of the fact that nobody has tried this before (as far as I can tell) and (more importantly) that I have 4 different SICL first-class global environments in which the meaning of classes and generic functions may be different.
3:04:51
beach
In my head, I know how it works (though I sometimes need a little diagram), but I still have no real clue how to document it so that other people can understand.
3:09:55
no-defun-allowed
i wonder if there's a really obscure loop expression i can use to do box blur
3:11:08
no-defun-allowed
(loop for this-x from (- pixel-x width) to (+ pixel-x width) summing (aref image this-x) into total finally (return (/ total (* 2 width)))
3:15:37
equwal
I was asking if no-defun-allowed has read an obscure paper about graphics only tangentially related to the original topic.
3:26:08
equwal
Object Oriented Shader Composition using CLOS by Nicholas Hafner. I think it is pretty accessible if you are interested.
5:25:29
|3b|
no-defun-allowed: for separable filters like box, 1d is all you need, and for box you can just keep a running total adding in pixel at leading edge and subtracting out pixel at trailing edge
5:33:26
drmeister
Stupid question - is there any reason why quicklisp/setup.lisp can't be compile-file'd ?
5:45:49
|3b|
drmeister: probably harder for it to figure out its containing directory if compiled (.fasl wouldn't get recompiled to change *compile-file-truename* if directory was moved for example)
5:49:04
drmeister
Hmm, that might be a bit of trouble for us for a while. Clasp's compiler is slow and will probably remain that way for a while (llvm dominates compilation time 60-90%).
6:15:16
beach
This is a figure I am planning to use in the SICL specification document to illustrate the bootstrapping phases: http://metamodular.com/bootstrapping.pdf
6:24:51
nydel
beach: do you keep anything like a weblog or etc that i might add to my list of things i read?
6:37:22
beach
Slightly updated figure: http://metamodular.com/bootstrapping.pdf showing that ersatz generic functions are capable of operating on ersatz instances.
7:06:55
phoe
drmeister: a workaround would be to change setup.lisp and split it into two files - one doing the basic setup (compilable), the other being tiny, non-compilable, and only used to fetch *compile-file-truename* on each load
7:07:48
phoe
I think that literally a file containing only (defparameter quicklisp::*ql-path* *compile-file-truename*) would be enough to solve this issue.
7:08:12
phoe
But then again, there might be other ones, too - Xach would need to be asked for more insight.
7:31:45
d4ryus
is there a system in quicklisp to benchmark/compare runtime speed of cl implementations?
7:55:04
no-defun-allowed
|3b|: I've read how to implement box blur as a two-pass O(n) procedure, don't you worry.
7:55:22
beach
d4ryus: Oh, but maybe I'm mistaken about what it does. Now that I think about it, I think Shinmera created a system for exactly the purpose you want.
7:56:10
Shinmera
beach: trivial-benchmark is for benchmarking user code, it won't automatically compare the performance of implementations across a standardised set of forms for you.
7:57:19
Shinmera
my other project, cl-all can help you compare implementation behaviour though, by invoking them for you
7:57:45
no-defun-allowed
I should add start and end keywords for ffmpeg to allow it to create high quality Lisp ytp.