freenode/#lisp - IRC Chatlog
Search
4:02:19
benjamin-l
I'm trying to make a class that extends the built-in array class like this: (defclass map-array (array) ())
4:02:48
benjamin-l
sbcl doesn't like this, and says that the metaclasses for common-lisp:built-in-class and common-lisp:standard-class are incompatible
4:04:07
no-defun-allowed
The CLHS page for BUILT-IN-CLASS explains why this is not possible in portable Common Lisp: "A built-in class is a class whose instances have [...] special representations."
4:09:27
aeth
There's probably a portability library that can implement extensible sequences on any implementation. You would just need to import those sequence functions instead of CL and extend a class other than sequence outside of implementations that don't permit extensible sequences.
4:09:42
aeth
But then the user would also have to do so, and it won't work for free with every sequence-generic function in every library
4:13:10
Bike
yes, shinmera wrote it https://github.com/Shinmera/trivial-extensible-sequences/tree/master
4:15:18
aeth
benjamin-l: you'll want to use the library Bike linked to instead of directly using SBCL's API
6:11:28
nwoob
do you people here recommend going through SICP if I have almost none mathematical background?
6:23:27
aeth
okay, you don't have the majority, but you may have the plurality, but https://portability.cl/ is probably a biased sample
6:26:11
aeth
If you mean missing altogether, the most noticably missing thing is no portability layer over sb-unicode afaik, so no portable unicode-enabled alternative to sb-unicode:whitespace-p among other, harder-to-implement things like sb-unicode:casefold
6:27:20
Shinmera
There is cl-unicode, though it's not as fast as sb-unicode and is missing a bunch of stuff.
6:28:18
aeth
It doesn't look like it has either of my examples (whitespace or casefold/foldcase). It's in my history, but that might be one reason why I don't use it.
6:29:36
beach
nwoob: It depends on your objectives. If you want to write pragmatic Common Lisp code as opposed to understanding the basic ideas of recursion, encapsulation, etc. you are probably better off with PCL.
6:58:16
pjb
nwoob: I would advise to acquire some mathematical background, this would help a lot to be a programmer, and anything else too, nowadays…
9:13:44
White_Flame
hmm, so if I have a lexer/parser that takes a character stream, how best to integrate it into the lisp reader for a non-string sublanguage?
9:16:28
flip214
Is there an easy way to compare two hash-table trees for EQUALity? Apart from using ALEXANDRIA:HASH-TABLE-ALIST recursively, then sorting, or so?
9:20:11
aeth
the only potentially tricky part is that you need to know if you didn't cover any values in the hash table not being mapped over
9:21:16
aeth
The laziest programmer way to avoid this issue is to have a counter since you can easily take the size of a hash table at the end. Or even just do a size comparison first. If the sizes aren't equal, they can't be equal.
9:25:30
heisig
Or you could use WITH-HASH-TABLE-ITERATOR, if you want your program to be particularly ugly :)
9:28:47
White_Flame
I made do-plist, do-alist, do-hash specifically with a surrounding (block nil ...) exactly for that
9:30:24
White_Flame
I use them surprisingly often, even though it's not that big of a deal, it feels nice
9:32:26
heisig
I prefer non-nil block names. I tend to forget which macros add an implicit block named nil, so an occurring RETURN can be quite confusing.
9:35:52
no-defun-allowed
I still need to think of a better name than DECENTRALISE-STANDARD-SYSTEM:UPDATE-SYSTEM-FOR-NEW-INTERESTING-OBJECT-PREDICATE
9:37:32
White_Flame
if I need to return deeper (which is exremely rarely; plain early exit is rare enough), then I'll manually use a lbock
9:39:16
no-defun-allowed
White_Flame: Then I get lazy and write d-s-s:u-s-f and SLIME gets confused as it doesn't like expanding both sides of a package :
9:40:02
aeth
Oh no, Gitlab has a new "smart" editor for its snippits that messes up the indentation.
9:40:36
no-defun-allowed
Someone would probably tell me decentralise-standard-system is too short and ambiguous.
9:42:42
no-defun-allowed
To be safe, I should use reverse domain name notation and call it org.cooperative-of-applied-language.decentralise2.standard-system:update-system-for-new-interesting-object-predicate
9:47:02
aeth
Well, I hope I didn't mess this up when I manually indented the code like... well, I don't think I've ever manually indented Common Lisp before. https://gitlab.com/snippets/1964967
9:47:27
aeth
Thanks for messing up your simple pastebin functionality by making your editor "smart", Gitlab.
9:53:47
aeth
But I generally disable JavaScript through umatrix because far too many things break without it running entirely
9:54:06
aeth
umatrix defaults to enabling first party JS, which works for pretty much every site that isn't a news site
9:55:29
aeth
You can whitelist more than just first party, but "everybody uses cloudflare" is part of what I mean by "except for news sites"
9:58:30
aeth
but anyway, my points are (1) wow that was unexpectedly hard because hash tables are kind of the worst case for this sort of thing (maybe I should put it in my util library) and (2) the last thing that needs a "smart" JS editor that messes with indentation is a pastebin for source code
10:34:37
flip214
aeth: I've got hashtables with string keys, so I resorted to providing a "readable" (ha!) representation, and then do (equalp) of both.
11:36:09
flip214
can a macro see the "original" form that it resulted from that was given to the compiler before any macroexpansions started?
11:37:41
MichaelRaskin
macros are processed top-down, if that's what you mean — internal macro invocations are not expanded
11:38:56
phoe
flip214: there's no way to do that unless your outer macros explicitly communicate with the inner ones in some way. see https://etc.ruricolist.com/2020/03/15/the-symbol-macrolet-trick/
11:46:02
White_Flame
if I read flip214's question correctly, in your (defmacro foo (params) ...) the params will already be the original pre-macroexpansion form, if it contains any
11:46:41
flip214
White_Flame: I'd like to annotate source forms for debugging purposes... so the macroexpanded things don't help that much
11:52:49
flip214
I've got comments that I want to associate to the forms after them. but if a macro expands into some code, the CONSes or form tree won't match what I'm seeing at the form of the comment.
11:54:34
Shinmera
(defmacro with-comment (comment &body stuff) #| stash the stuff and comment somewhere to look up later #| `(progn ,@stuff))
11:59:14
White_Flame
if it's data, unevaluated, your macro won't run. if it's evaluated, the "form" is now in a compiled form and you don't have a reference to its bit in the machine code
11:59:36
flip214
White_Flame: some things have a compiler-macro that has "&whole form" to reference back into a hash-table for the comment
12:34:14
moewe
When I'm inside a package -> (in-package), I obviously can't access outside symbols, especially (true). I can't find how to access that inside a package? I also tried to simply exit the package namespace and execute it there, but the internet said to simply use the lisp namespace. But at least in sbcl it doesn't exist.
12:36:36
moewe
I wanted to just let the script wait forever, so I did (sleep (true)), but apparently sbcl just crashed at that moment, and that doesnt even exist
12:37:11
moewe
Is there a way to not let a script exit on the end? I need to keep it alive so a thread can continue working
12:49:19
no-defun-allowed
"arithmetic error FLOATING-POINT-INVALID-OPERATION signalled" time to report this bug in SBCL /s
12:51:36
moewe
I actually just sent you an E-Mail for inclusion about that :D I try to create a telegram bot, and that creates a thread in the background to listen for messages, so that thread never finishes
12:52:34
_death
maybe it would be a good idea to have a way to signal the thread that it needs to die
12:53:45
moewe
but since I want to liberate it as soon as it is, I need to rework that as later on ^^"
13:32:00
francogrex
Hi, does anyone know how to make a pointer executable in memory, using sb-posix? (sbcl)?
13:34:35
francogrex
on windows I used something like that (cffi:with-foreign-object (oldprotect 'dword) (VIRTUAL-PROTECT pointer 8 #x40 oldprotect))
15:12:09
flip214
when using MACROEXPAND(-ALL), can I tell sbcl to use the environment it's currently running the form in, so that the currently active bindings are seen by the macros?
15:29:25
flip214
I tried to copy CAPTURE-ENV from the SBCL tests... but it seems to capture only local functions, and not special variables
15:33:22
pjb
(defmacro expand (&environment env expression) (macroexpand expression env)) (macrolet ((moo (x) `'(in moo ,x))) (expand (moo 42))) #| --> (in moo 42) |#
15:54:42
flip214
yeah, right, I could try to expand in a macro and return the expansion from it... does that match my needs?
15:57:14
beach
flip214: Have you explained what it is you are trying to accomplish? I must have missed it. But it sounds like you need some other tools.