freenode/lisp - IRC Chatlog
Search
16:03:19
jmercouris
I'm trying to develop a macro, but unfortunately, there are two variable length sections, normally I would use something like ,@rest but I can't see how that would work here:https://gist.github.com/07a0cbaedd4f0aebb8d05646c3397426
16:06:52
jmercouris
Yeah, I had this gap in my knowledge, I assumed it consumed every word as a new argument to the macro
16:08:58
jmercouris
Hmm, yes, I'm not sure how to describe it in this context, so I'll just list the words in my example
16:10:09
jmercouris
ok, so here's another thought, what if I wanted to get at the individual arguments within the list, how would I do that?
16:10:23
jmercouris
I don't actually need to do this, I'm just trying to improve my understanding of macros
16:10:46
Bike
So you were worried that if you wrote (defmacro defparen (name lambda-list &body body) ...) and then tried (defparen foo (a b) ...), it would bind lambda-list to a, and body to (cons b ...)?
16:11:37
jmercouris
I guess I should have just tried it first, but I figured maybe there is something else I can learn as well by asking here
16:11:39
phoe
What's the practical difference between (defmacro foo (bar baz qux) ...) and (defmacro foo (bar (&rest baz) qux) ...)?
16:12:19
jmercouris
I'm not saying the system is out to get me, but we don't exactly get a long 100% of the time :D
16:12:45
Bike
jmercouris: have you read PCL or something? i don't mean to be mean, but symbols are pretty fundamental and it worries me that you're so far into an involved program like a browser without knowing about them.
16:13:18
jmercouris
Bike: I actually consulted my notes from the book on Macros while thinking about this issue
16:13:38
jmercouris
In terms of symbols, I'm hesitant to use the word because it feels like I use it in the wrong way every time I talk about it :D
16:15:22
jmercouris
The concepts are clear in my head, but some part of the interface head:mouth jumbles things up
16:15:25
Bike
Anyway here's a brief explanation of macros. Say the evaluator or compiler runs into the form (foo ...), as in a list where the first element is the symbol foo. It knows that there's a macro named by that symbol. To evaluate or compile the form, it looks up the macro function with that name, and calls it with two arguments: the form (foo ...), and the current environment. Then it proceeds recursively, evaluating or compiling, on the res
16:17:23
jmercouris
the compiler knows of that function and looks it up when finding a symbol with a special name
16:17:57
jmercouris
all the arguments to the special macro function are the complete form body of the special named symbol
16:18:28
Bike
The macro function gets two arguments. The first one is the form, the second one is the environment. defmacro arranges things so that it destructures the form into the lambda list you specify
16:18:40
Bike
Like, you know you can do (destructuring-bind (foo bar) '(1 2) (+ foo bar)) => 3, right?
16:19:52
Bike
Let's have a macro (defmacro my-let (var value &body body) `(let ((,var ,value)) ,@body))
16:21:46
Bike
We can have (defun my-let-mf (form environment) (declare (ignore environment)) (destructuring-bind (var value &body body) (rest form) `(let ((,var ,value)) ,@body))
16:22:19
Bike
and if we do (my-let-mf '(my-let x 3 (+ x 7)) nil), we get (LET ((X 3)) (+ X 7)) same as the macro expansion.
16:24:10
Bike
If you don't know destructuring-bind, we can be more verbose and write (let ((var (second form)) (value (third form)) (body (cdddr form))) `(let ...)) instead.
16:24:56
Bike
As it happens we can also get the macro function explicitly, with (macro-function 'my-let). If we do (funcall (macro-function 'my-let) '(my-let x 3 (+ x 7)) nil) it returns the same as my-let-mf.
16:25:04
jmercouris
I have read PCL a couple times now actually, and this is the only time it has made sense to me how they actually work
16:35:51
jackdaniel
(destructuring-bind (&key a b c) '(:a 3 :b 4 :c 6) …) ;is a nice way to destruct things too
17:05:47
TMA
is there a way to distinguish between a list and nonlist argument to format? ~:[ and ~@[ can be used for NIL/non-NIL test, but I would like to wrap ~{ so that it will not error on non-list e.g. in (format t "~{~s~}" 4)
17:07:52
Fare
quickref.quicklisp.org fails the usual way with uiop: it only looks at the first package, uiop/package.
17:08:23
sjl
I wish these autogenerated doc systems had a way to link to the actual docs, for people like me who take the time to write them
17:10:55
jackdaniel
sjl: I think it links whole README.md toplevel file – that might be a good place to point all the pointers
17:10:58
sjl
because if someone finds these "docs" for my stuff and thinks that's all there is, they're going to be disappointed https://i.imgur.com/5gebjQF.png
17:12:05
sjl
jackdaniel: it includes the raw README.markdown, but hilariously it strips out the documentation link in it: https://simple-monosnap.s3.amazonaws.com/The_beast_Reference_Manual_2017-12-13_17-11-17.png
17:16:49
pjb
TMA: you can add a parameter: (format t "…" (listp foo) foo) and then dispatch on it with ~:[
17:17:27
TMA
Bike: in my special case I have either a number or a list that gets printed via "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" -- the list prints fine, the number errors out. I would like to print the number with some other string (say "~S")
17:17:46
beach
sjl: I totally agree with you. I take the time to write the documentation, and this system ignores it. On top of that, it documents implementation details such as slots.
17:19:23
Shinmera
sjl: Another problem with any system other than Staple is that it won't support custom definitions.
17:19:42
TMA
adding (listp ...) there is not an option, so the only thing is a custom format specifier
17:20:25
Shinmera
Staple has a specific extension mechanism so your system can define additional constructs like Radiance's routes: https://shirakumo.github.io/radiance/#ROUTE%20RADIANCE-CORE%3ADOMAIN
17:21:15
sjl
honestly I feel like autogenerating html pages from docstrings is the least important part of documenting a system, but the part that people spend most of their effort on
17:22:06
sjl
I'd rather read a usage guide that outlines the high-level design/API written on a napkin and scanned in as a jpeg than a fancy HTML page that just formats docstrings nicely
17:22:47
Shinmera
That's fine for you, but I frequently use the symbol index, and also refer other people to specific definitions in case questions come up.
17:22:52
pjb
TMA: yes, in that case your only choice is a specific format specifier. You can write it like ~? so that it takes "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" as parameter!
17:24:26
sjl
pjb: I already have tools for parsing and instrospecting systems. Parsing is done by my Lisp implementation, and instrospecting via docstring lookup and jump-to-def in my editor.
17:24:29
pjb
TMA: Something like: (format t "~@{ … ~/fmt:list-or-atom/ …~}" "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" "atom: ~S" list-containing-everything-including-list-or-atom)
17:24:58
sjl
what I *want* from authors is the high-level lay of the land. What are the user-facing parts of the system? How am I intended to interact with them?
17:25:01
pjb
sjl: then once you have that you need to decide on a generated format. Keep in mind pandoc to convert to other formats.
17:26:16
sjl
pjb: I'm saying that I don't care very much if authors generate some formatted output for their docstrings at all. I can look up the docstrings (or code) in my editor.
17:26:40
sjl
I would much rather them spend time giving me a view into the design of the system in their brain
17:29:30
_death
sjl: right, it reminds me of the "any idiot can code" remark by Moon on the runtime experts panel.. but then, the authors of the doc tools aren't going to write the documentation for these 3K libraries, so they write a tool to help a little
17:29:37
pjb
TMA: I'm afraid you will have to make your format specifier very specific, by embedding the formats "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" and "~S" in it.
17:30:07
pjb
TMA: since you want to use it in a loop, you cannot pass those format strings as parameters using ~V,V/list-or-atom/
17:31:09
sjl
_death: the problem is that now we have a broken version of my docs competing with my actual docs in the google results :\
17:31:49
TMA
pjb: It will do with a specific formatter. It would be more elegant to be more general, but the specific will be fine.
17:32:40
pjb
There's no way to take multiple arguments for a custom format specifier, contrarily to ~? which takes a format string, and any number of argument it needs for it.
17:32:41
_death
sjl: right, maybe it'd be a good idea to have an asdf property linking to the official documentation, and such systems can take it into account
17:33:12
sjl
_death: yeah, it would be nice if ASDF had a `:documentation` property next to `:homepage`, `:bug-tracker`, etc
17:33:26
sjl
and if these autodoc systems would use that to just link to the real docs when they exist
17:34:56
sjl
catting out all the markdown files my documentation directory into a giant `:long-description` seems subpar
17:38:17
_death
the quickref thingy also doesn't support package-inferred-systems style very well, for now
17:39:13
_death
(and maybe quicklisp projects are the right place for such tags, not asdf systems..)
17:40:24
sjl
_death: I mean, ASDF already has :bug-tracker. :documentation seems to be roughly the same kind of thing.
17:52:41
_death
maybe the asdf mailing list (which I'm not currently reading..) is a good place for discussing such properties
17:54:31
_death
Shinmera: I think sjl came from the opposite site.. the one with people who document..
17:56:18
sjl
I used to do a lot of Python (especially Django) which has a pretty good documentation culture, yeah
17:57:11
_death
I don't document my public libraries.. my excuse is that they're not expressly intended for public use..
18:08:11
Xach
Hmm! I have a warning condition that is being signaled by someone else's code. Is there a nice way, without wrapping calls that might signal the warning, to neuter the warning by e.g. redefining the condition?
18:11:18
jmercouris
what does it mean to "advise" a function, and how is it implemented in practice?
18:11:38
Xach
jmercouris: it is a little like clos before/after/around methods, and it is implemented via indirection of some sort.
18:12:32
Xach
jmercouris: when you trace a function, it is a specific case of advising something to show output before and after it is called.
18:13:18
Xach
Edi Weitz's regex coach app used LispWorks advice to build an app accessing the internals of the library without modifying the library. It looked like a cool example to me.
18:13:20
jmercouris
I see, is there built in support for this, or does every piece of software have to implement its own advice pattern?
18:13:34
Xach
jmercouris: it is an implementation-level feature. sbcl does not have it. many others do.
18:13:56
Xach
it is not standard and required. the interfaces vary from implementation to implementation.
18:14:16
Shinmera
You can write your own advice facility, but that will lose most of the point of it (being able to advise arbitrary functions)
18:14:45
jmercouris
in which case, your own platform functions are arbitrary functions for those are on your platform, and the point is still kept
18:15:13
Xach
I wish sbcl had some of the traditional bells and whistles like advice and stepping. (Maybe it has stepping now? I haven't checked.)
18:15:34
Xach
jmercouris: if you're designing an interactive or extensible system, i think it would be interesting to study hooks and advice and such.
18:16:22
Shinmera
I've used it a couple of times, but usually it's cumbersome because it's too fine-grained.
18:16:35
sjl
SBCL has a bunch of extensions to CL:TRACE as well http://www.sbcl.org/manual/#Function-Tracing
18:18:03
u0_a166
in your function definitions you could have a slot for prolog and epilog hooks and a global flag for if inside a hook
18:18:28
Fare
Xach: hash-tables with systems as keys are this-a-way. subclasses of system are that-a-way.
18:18:40
_death
I suppose you could set trace output or whatever to a broadcast in before, and restore it in after
18:19:23
u0_a166
that way when your function dispatcher dalls a function it could check hooks before calling, set the flag to not recurse infnitely, cal hook when needed...
18:19:56
Fare
and the properties are deprecated but still haven't been removed yet, for backward compatibility
18:21:50
_death
jmercouris: because that's the design.. there was a Lisp that took a CLOS-like system more pervasively called GOO.. maybe they have slots there
18:22:48
_death
jmercouris: for Common Lisp, the purpose was that you could have a CLOS-less subset of it and still be able to claim with a straight face that it's a Common Lisp
18:23:07
Xach
Fare: When PRIMARY-SYSTEM-NAME moved from ASDF/FIND-SYSTEM to ASDF/SYSTEM, it broke mgl-pax and part of named-readtables.
18:25:11
Xach
Fare: you mean that without loading from fasl, there is a symbol asdf/find-system:primary-system-name?
18:26:04
Xach
The code in mgl-pax has a reference to asdf/find-system:primary-system-name. I don't think that exists in ASDF 3.3.1 any more.
18:26:17
Fare
I mean that it's bad if a new ASDF breaks old mgl-pax fasls, but it's worse if mgl-pax can't load at all
18:26:58
Xach
I don't think mgl-pax can load in sbcl 1.4.2 with asdf 3.3.1 under any circumstance outside of changing its code.
18:27:18
Fare
BTW, I sent PRs to melisgl early this year to fix some of his packages, but I don't think any were merged.
18:27:53
Shinmera
Fare: So in qt-lib-generator when it needs to download the archives, it has to optionally load drakma and zip. I can't make these hard-dependencies because that would force them to be unnecessarily installed on many setups. However, since qt-libs needs to ensure the libraries are ready after it's been loaded, this optional loading of drakma might happen during a current load-op. Any advice on how to circumvent
18:31:18
Shinmera
It seems to currently work on my system if I do a manual ql-dist:install of the dependency tree of the systems and then just asdf:load-system.
18:31:43
Fare
Typically things like loading are done outside of ASDF, in a setup script, or using Quicklisp or some such.
18:33:46
Fare
if you fork, please also fork madeira-port by Nikodemus, who also won't reply to probing regarding https://github.com/nikodemus/madeira-port/pull/6
18:39:17
Fare
I'm grateful to CL and the its community for all they brought to me, but I want things that can't reasonably be done in CL. I'm already enjoying (and cursing) actor programming in Gerbil, for instance. Or its module system.
18:39:32
Xach
Fare: What induces the package variance errors in http://report.quicklisp.org/2017-12-13/failure-report/cl-influxdb.html#cl-influxdb.examples and http://report.quicklisp.org/2017-12-13/failure-report/cl-portaudio.html#cl-portaudio-tests ?
18:41:00
u0_a166
jmercouris, all communities have elders whether actually old or not. i don't know everyone either
18:42:28
Fare
what is interesting is that the error wouldn't appear if you only loaded that code once, but something about the system causes it to be loaded twice
18:42:40
Fare
"WARNING: Computing just-done stamp in plan NIL for action (ASDF/LISP-ACTION:PREPARE-OP "cl-portaudio-tests"), but dependency (ASDF/LISP-ACTION:LOAD-OP "cl-portaudio") wasn't done yet!"
18:55:42
Fare
I sent this PR https://github.com/filonenko-mikhail/cl-portaudio/pull/4 but it doesn't explain the WARNING above. Or if it does, that's surprising to me.
18:59:26
beach
jmercouris: I suggest you read the Common Lisp HyperSpec entry for "object". Not everything is an object, but probably more than you think.
19:02:09
Fare
I don't get this WARNING or what looks like your loading the asd file three times, when I run on ASDF 3.3.1
19:04:34
beach
_death: Oh, many things. For example comments in source code, or the indentation of the lines in the source code of a function.
19:04:46
Fare
Xach: in any case, whatever is causing this loading of portaudio.asd 4 times (there was another time below the first build) and then triggering the WARNING about just-done is triggering an error latent in cl-portaudio-tests.
19:05:21
Fare
My PR fixes the latent error, but not the underlying issue (maybe something in your quicklisp test infrastructure?)
19:06:14
beach
_death: When people are questioned about the "everything" in "everything is an object", it always boils down to "every object is an object".
19:07:16
Fare
a place? it's not an object. A type? It's not an object. A continuation? What are you talking about?
19:07:24
beach
_death: Exactly, and "object" is defined to be a Lisp datum, so again we have "every object is an object".
19:07:50
Bike
well actually, if you look at the original etymology, a number of page faults is definitely something the icelandic parliament could talk about, so it's a thing. [nods sagely]
19:08:41
jmercouris
If anyone wants to answer this brief survey: how long have you been programming in common-lisp?
19:09:08
Fare
jmercouris, thing is the judiciary council of free men judging a case. By extension, the case is the thing, or any potential topic for a case.
19:09:55
beach
Bike: Indeed. And I have been to thingvedlir (or however it would be spelled in English).
19:11:47
Fare
jmercouris, my first "real" code in CL was probably my patches to cliki and araneida. Or maybe fare-matcher. Some time in 2004 or before for sure.
19:12:15
Bike
Is that where the althing used to be, or the modern government structure? I guess the former is probably lost
19:13:18
Bike
jmercouris: the word "thing". it originally meant a kind of judicial council in germanic cultures. the icelandic parliament is still called the "Althing".
19:13:34
Fare
Bike: David D. Friedman wrote neat things about the Icelandic saga-era judicial system. And he recently published a book about judicial systems very different from ours.
19:14:56
Bike
and yeah, i've read a lot of the old icelandic sagas. pretty weird structure. horse-eating.
19:20:32
Fare
Xach: Could the multiple loading of cl-portaudio.asd be caused by the quicklisp restarts? That would explain it. I don't have a model though for this WARNING about just-done. Maybe along those restarts ASDF gets confused in the multi-stage session support?
20:02:20
Xach
Fare: the session that produced that log does not use Quicklisp. it has an asdf search function that makes every project visible to asdf, but generally nothing else too unusual.
20:10:44
jmercouris
It seems that (ps:regex) does not actually eval it's arg, it can only handle strings
20:12:46
Bike
not that i'm ultra familiar with javascript, but i'm going to guess that ps:regex is duplicating javascript regex literals, rather than the regular constructor, which can hopefully be referred to like any other function call
20:14:36
jmercouris
Kind of dumb that it doesn't eval the arg, it totally should, and then convert that to a literal
20:23:02
Fare
Xach: well -- how do you iterate over systems? Are you invoking asdf once or multiple times? Any nested invocation?
20:28:04
Fare
I find the multiple loading of the asd file weird. It ought to be loaded only once in the lisp image, unless it or a defssystem-dependency was modified.
20:32:54
Xach
Fare: i start a fresh session for each system. i work alphabetically by project and then alphabetically by system within that project. i don't clear fasl caches between systems but no two systems are loaded in the same session.
20:41:15
pjb
_death: there are no non-object in lisp: all lisp data is first class lisp object, and each data has a class.
20:42:47
pjb
_death: (mapcar 'class-of '(nil 1 "foo" #(bar baz))) #| --> (#<built-in-class null> #<built-in-class fixnum> #<built-in-class simple-base-string> #<built-in-class simple-vector>) |#
20:52:07
_death
and if you want to represent Lisp source text, or running time, or number of page faults, then these would be objects as well
20:53:08
_death
since Lisp data is the universe of discourse when the question is asked: is everything an object?
21:13:52
Fare
Xach: for this log, did you concatenate multiple sessions? One to discover all the systems defined in that file, then one for each system?
21:22:31
flip214
Who could help me get more information about ELS 2018? Our HR needs some informations that are not on the website yet (don't know which ones, though); who could I send the questions to?
21:24:10
flip214
Shinmera: okay, thanks a lot... can you tell me the fees of 2017? I guess that's the data they want to know.
21:35:56
Younder
flip214, Ahh, I was looking for the one doing lisp calculations. Anyhow is krystof still here?
22:06:56
ealfonso
is there a way to get rid of the surrounding |? (intern (format nil "xdotool-type-~A" "name")) => |xdotool-type-name|
22:09:10
ahungry
you are interning a lowercase, but the only way to tell the program its 'this' is |this| otherwise this = THIS
22:11:27
ahungry
(setq |a| 1) (setq a 2) (symbol-value (intern "a")) => 1, (symbol-value (intern "A")) => 2
22:14:48
aeth
What I do for things like this is #.(symbol-name '#:whatever-the-prefix-is-) because technically you can change how the reader case works to not upcase things. So this makes it into an upper case string at read time through the otherwise not very useful #. read eval feature
22:17:20
Fare
Xach: OK, I believe the build of influxdb is confused because cl-graph declares an absent file index.md, and this causes ASDF to think its build is incomplete
22:20:10
aeth
#.(symbol-name '#:whatever-the-prefix-is-) => "WHATEVER-THE-PREFIX-IS-" or "whatever-the-prefix-is-" depending on the readtable case
22:20:57
aeth
e.g. (let ((*readtable* (copy-readtable *readtable*))) (setf (readtable-case *readtable*) :preserve) (format t "~A~%" (read-from-string "hello")))
22:22:09
aeth
although, actually, that wouldn't help if they rebind the readtable like in that example, it would have to happen before the file is read, afaik
22:31:27
pjb
ealfonso: you may also try :INVERT instead of :PRESERVE, but it works only for symbols not having mixed case characters.
23:22:55
Fare
Xach: it looks like badly named secondary systems for in defsystem-connection might be to blame.