freenode/#lisp - IRC Chatlog
Search
16:29:08
phoe
Krystof: that's one idea, I'd need to pass types/validation into the method combination though, somehow
16:54:56
hendursaga
Can anyone recommend a good library for manipulating XML? Not just parsing or processing, but manipulating and then outputting back to XML. Preferably with XPath or DOM/CSS selector support.
16:57:51
hendursaga
So far it seems lquery is my best bet, but I'm not sure how to replace XML with something like S-XML which would then be serialized back to XML.
17:23:20
hendursaga
There's just so many different libraries out there, so many Lisps, so little documentation.
17:59:56
VincentVega
Hi guys. I have stumbled upon this weird compilation vs evaluation deal, not sure what I am doing wrong: https://pastebin.com/J0A2sWYB
18:06:41
phoe
DEFCLASS or ENSURE-FINALIZED is not evaluated in such case because the error happens when macroexpanding the form
18:12:40
VincentVega
It also seems to be the case when quickloading a project. If the file has an error, it's as if no definition before the error ever got evaluated so I have to eval manually till the error. It's a bit annoying. tbh.
18:13:41
phoe
you should be able to click on the line in *slime-compilation-errors* and jump to the file position
18:17:10
VincentVega
Well, it's still weird, because if no changes should take effect, then the second compilation of the progn should yield the same result, shouldn't it?
18:19:32
phoe
the no-class-found error I get is consistent if I answer N to loading the created/broken fasl file
18:34:06
hendursaga
How might I use lquery to, say, append a string to the text of every <p> node? replace-with looks like it might work but I'm new to CL
18:36:29
hendursaga
I've been looking through sample code on Github but I can't see anything that might fit.
18:41:09
hendursaga
Basically, how do I refer to the current set of elements being acted upon inside replace-with?
20:50:12
macoy
Hi, I'm writing a Lisp-like language and was wondering if you guys could help me with a detail: In macro expansion time, does the interpreter basically traverse the entire AST recursively, and evaluate anything which happens to have a macro name by an open paren, regardless of any context? e.g. if I make up a DSL, but it wants to use a name which a macro also has, there's nothing to stop that macro from being expanded?
20:51:24
macoy
(because macro expansion time has no idea we're supposed to be interpreting it as a DSL marker)
20:54:03
phoe
"regardless of any context" is not really true, e.g. (case 42 (defun foo () ...) ...) will not macroexpand DEFUN
20:55:05
phoe
if your DSL performs some sort of code walking, then it can introduce its own macro system when it compiles your DSL down to your Lisp
20:58:16
macoy
phoe: Ah, I think I see what I was misunderstanding: I was imagining macro expansion would happen like function argument evaluation, where if you invoke a macro within another macro's arguments, the invoked macro (deepest) will be expanded first.
20:58:16
macoy
With the case example, it makes sense that macros actually need to be generated immediately once encountered, then that generated code is evaluated for further macro expansion.
20:58:17
macoy
So my DSL won't have problems with macro name collisions because I convert all the DSL symbols into something else (otherwise it wouldn't be a DSL, it'd just be Lisp)
21:02:12
phoe
and the macroexpansion may not even contain the form (BAR (BAZ ...)) or any form like it
21:04:53
macoy
phoe: That makes much, much more sense than what I was thinking. Thanks a lot, you've saved me a lot of heartache had I tried the other approach first! :)
21:12:43
macoy
phoe: That's fair enough. I suppose I didn't do too deep of research (besides using Elisp and SBCL a bit, and generally knowing about tokenizers and parsers). I'm not trying to make a classical Lisp, it's more a Lisp-ish thing that I don't really know how to define. It uses generated C code to do all the actual work, and the only thing I define is macros and generators (generators do nothing but receive tokens and output C/C++ code;
21:12:51
aeth
They're more problematic in Lisp-1s because name conflicts are easier. That and Scheme doesn't namespace symbols like CL does, so name conflicts are easier. (You can actually still get name conflicts in CL, with FLET, since functions/macros aren't usually gensymmed.)
21:14:55
aeth
Lisp-1 means functions and variable share a namespace, if you're wondering. So (let ((list (list 1 2 3))) ...) can really easily mess with macros in the ... that call list. In CL, you generally only gensym the variable namespace, since the function/macro namespace has other protections (and the CL package, containing CL:LISP can be protected from redefine in a DEFUN or FLET)
21:17:07
bitmapper
what to do about this code that expects in-package to make a package if it doesn't exist
21:17:54
aeth
My point is, Lisp-2's like CL don't really worry about non-variable gensyms in macros because (0) you have to modify the function, not variable, namespace (probably locallly with FLET/LABELS), (1) you're probably not USE'ing a package (and it might not be exported; so it's other-package::foo, not foo), (2) if you are using a package and it's CL it's protected from redefinition
21:18:15
aeth
While Lisp-1 macro design in Scheme worries about this sort of thing more and focuses on hygiene.
21:19:30
aeth
but how the language choices affect the preferred macros is more of a topic for ##lisp
21:21:08
macoy
phoe: Yes, C-mera looks exactly like what I'm doing. Too bad I didn't discover it sooner! I want to continue working on my version, but C-mera looks interesting for sure
22:01:28
dra
macoy: Here's a small snippet from an interpreter I wrote some time ago in C++: http://pastie.org/p/3LGO6xC0aQ6wIIBQQ0lUAB
2:15:05
akoana
I'm trying to run an external program on linux in sbcl with (uiop:run-program (list "/usr/bin/mpv" "http://stream.srg-ssr.ch/m/rsj/mp3_128") :output :interactive :input *standard-input*)
2:16:03
akoana
the mpv program accepts 'q' to terminate it, but I can't make that work if I start it in sbcl
2:17:42
akoana
I had that working in clisp with run-program, but sadly - on a raspberry pi clisp crashes with errno = 12 (:ENOMEM): Cannot allocate memory. :(
2:20:41
no-defun-allowed
Somehow I wonder if SBCL is doing something with the input stream, but it shouldn't be.
2:20:46
akoana
yeah, I tried that already, no chance sadly, even tried with "bash -c mpv url", the mpv program starts, but does not accept a keypress
2:21:45
no-defun-allowed
Also, I would not expect only the character q to close it, unless mpv has still set terminal(?) settings to not buffer input.
2:22:24
no-defun-allowed
(And if you use SLIME, :interactive input is the stream connected to *inferior-lisp*)
2:23:08
no-defun-allowed
Hey, (uiop:run-program "mpv foo.mp3" :input :interactive :output :interactive) closes with just q.
2:26:28
akoana
I have been struggling with this for hours - now it works with 1.4.16.debian on my raspi
2:35:31
no-defun-allowed
It also works with the "proper" way to specify the command to run, i.e. '("/usr/bin/mpv" "foo.mp3")
2:37:45
akoana
on my workstation it runs like a charm, but on the raspi I guess I've to install quicklisp ("Package UIOP does not exist".)
2:38:34
no-defun-allowed
I think UIOP comes with ASDF, but you can indeed get both quickly using Quicklisp.
2:39:25
akoana
although i installed the cl-asdf package, but maybe thats for clisp only, hmm, Raspian (Debian10)
2:40:39
no-defun-allowed
Right, I've never used Debian's CL packages, so I can't comment. (But it should be accessible by any implementation?)
2:42:02
akoana
yes, I thoght so, but usually I compile clisp and sbcl myself and don't use the distro packages (only clisp for the initial installation of sbcl)
2:43:54
no-defun-allowed
I would recommend Clozure on the 32-bit Pis (a superset of Pi 2), as it has mostly working threads.
2:44:12
akoana
the mpv thing is part of a small internet radio streaming program, with a small database of station
2:45:27
akoana
I have once compiled ccl on a Pi, and it did work well, but the build process on the Pi takes a long time :)
2:46:02
no-defun-allowed
Yeah, I think I just downloaded a bootstrap image and lived with that out of laziness.
2:53:29
akoana
I've replaced some of my old python and shell scripts with lisp programs, and I'm going to continue that :)
2:57:20
akoana
no-defun-allowed: installed quicklisp on the Pi - now I can listen to the music - wonderful!
3:00:59
akoana
It's a small program with a database of internet radio stations, it lets you select a station or add one on the command line or just lists all available stations (without an argument)