libera/#commonlisp - IRC Chatlog
Search
12:30:54
flip214
pve: what happens on (generate-alliteration pattern 'adjective 'adjective '("Alice") '("Bertrand"))?
12:32:28
splittist
I have a function that acts on a THING. Often, the callers of this function actually have a PART (of which the THING is a component) or a DOCUMENT (of which the PART is a component). Should I turn the function into a (generic) function accepting a DOCUMENT, PART or THING? Or should I leave it to the callers to extract the THING as necessary? Please dicuss. (:
12:34:52
pve
flip214: Tbh I didn't give much thought to what it should do in that case, so I figured just signal an error for now.
12:34:57
flip214
splittist: I've had that last weekend in one of my projects, and ended up with a few DEFMETHODs - this way there's an interface (sorry)
12:40:39
splittist
flip214: yeah. In fact, this is a bit of a common pattern, so I'm also thinking of a macro DEFINE-ROOT-FUNCTION that would define the generic function and the three methods.
12:42:21
splittist
Now - do these methods just wrap one another, or should they be a series of before methods, or am I missing some (other) obvious method-combination?
12:44:18
flip214
splittist: I played around a bit - a DEFUN that SETFs its argument bit by bit via a few (WHEN (TYPEP ...)), DEFMETHODs, and a DEFUN that used LABELS recursively depending on type.
12:45:51
splittist
yeah - I think I was hallucinating an object relationship that didn't exist, channeling my inner ChatGPT
12:46:05
jackdaniel
we are bike shedding, right? so I'll add my own 2gr -- if I have a generic function #'SEAT-POSITION, and I have a car that does not have a position, but its seat has one
12:46:31
jackdaniel
then I'd consider gross to have a SEAT-POSITION specialization on the car that trampolines to its seat
12:47:50
jackdaniel
last time I've tried to rewind the stream more than one character after reading I had some problems, so smh
12:53:07
splittist
jackdaniel: agreed. But I think I'm ok in at least some of the cases I'm considering. It makes sense to ask ALL-FOOTNOTES about a DOCUMENT, a MAIN-DOCUMENT-PART, and a ROOT, since the only places in a document footnotes can appear is in the main-document-part, which has a root. Many of the callers of all-footnotes will be in a context where they have a root rather than one of the enclosing structures, but not all.
13:34:35
hayley
It is very funny to suffix a predicate which also performs mutation with ‽, but I have yet to find a style guide which is good enough to recommend such a suffix.
13:34:52
jackdaniel
mi6x3m: most people should be fine with ? and ! (the rule of the thumb is to use the style estabilished in the codebase you modify)
13:36:03
hayley
(This arises, for example, when checking if a least-recently-used cache contains a value.)
13:37:55
beach
There are several examples in the standard where p or -p is used, like for instance SUPPLIED-P-PARAMETER in lambda lists.
13:54:00
flip214
beach: yeah, but neither pop nor pprint-pop match that convention. neither is "n" (like "nreverse") a good idea.
13:54:02
NotThatRPG
Anyone have any advice for someone trying to use CFFI on a Mac? I'm having trouble where CFFI-grovel is ignoring my environment variable bindings of CC and LD_LIBRARY_PATH and insisting on using a C compiler that is not the one I want.
13:54:39
flip214
so I'm tending to use bool? and change-object! because they're non-alpha, like with +constant+ and *special*.
14:04:02
jackdaniel
using -p is like using "thou" instead of "you" - certainly a dignified thing to do ;) (and yes, I'm exaggerating)
15:01:55
beach
mi6x3m: No, there is a separate chapter on characters, and a separate chapter on numbers (of which bytes are a subset).
15:03:52
mi6x3m
I am asking prior to informing myself because USUALLY languages speak of strings but mean byte sequences
15:05:48
beach
mi6x3m: In Common Lisp, a string is a vector with element type character (or some subset thereof). A character is an entirely different object. And a byte in Common Lisp is just an integer that can be of any precision. And integers are not characters either.
15:14:47
splittist
A lisp character is a lisp character. What the Unicode Standard means by 'character' is, as I understand it, studiedly vague/ambiguous: "Character. (1) The smallest component of written language that has semantic value; refers to the abstract meaning and/or shape, rather than a specific shape (see also glyph), though in code tables some form of visual representation is essential for the reader’s understanding. (2) Synonym for
15:14:47
splittist
abstract character. (3) The basic unit of encoding for the Unicode character encoding. (4) The English name for the ideographic written elements of Chinese origin."
15:19:23
Nilby
Unfortunately what people think of as a character isn't really the unicode code point which is likely your CL character, but rather graphemes as delivered by say sb-unicode:graphemes.
15:20:57
splittist
Many of the popular lisp compilers provide a way to associate characters with Unicode code points, and therefore ways for library authors to associate the information provided by Unicode data tables, and perform Unicode algorithms, on characters. But as Nilby says, anything one instinctively thinks about characters is probably wrong for some set of situations.
15:23:22
jackdaniel
if I had an euro for each time I had a bad thought about unicode, then I could buy a coffee
15:23:37
Nilby
even disregarding input and output, code point comparison is troublesome without normalization
15:25:20
jackdaniel
I would not be surprised if someone had proven that one of uax implies turing-completness of the unicode
15:35:05
NotThatRPG
On SBCL, when we use CFFI to link new C code, do we need to use the same C compiler that was used to build SBCL? Asking because SBCL is built with default (Apple) cc on my laptop, but I *think* I need to use the brew gcc to link in libuv (which comes from brew). Do I need to rebuild SBCL with brew's gcc for that?
15:42:40
yitzi
NotThatRPG: cffi is generally not linking to sbcl. It is loading shared libraries and calling functions in them. Along with marshalling, etc
15:50:02
NotThatRPG
My problem is that CFFI-grovel isn't finding the right includes or libraries and there doesn't seem to be anything I can do to fix that.
15:50:19
NotThatRPG
It's configuring itself and there are not obvious hooks to override that configuration.
15:51:33
NotThatRPG
I was hoping that using a different value for `cffi-toolchain:*cc*` would help (because the other gcc knows the right include and lib directories) but I seem unable to change the value of `*cc*` in a way that sticks, or set flag variables.
15:55:55
NotThatRPG
_death: OK, but that requires me to break the abstraction of the `cl-async` library, which seems wrong. Shouldn't the configuration of the local C compiler be kept out of the grovel file?
15:56:44
NotThatRPG
It seems like a mistake that the person who writes the grovel file has to know everything about where header and library files are stored on all possible platforms.
15:58:36
yitzi
NotThatRPG: CFFI has some issues with respecting CFLAGS that are unresolved. https://github.com/cffi/cffi/pull/146
16:00:06
NotThatRPG
Seems like somehow CFFI-Grovel (or the ASDF interface thereto) is resetting a lot of the cffi-toolchain config, too.
19:36:56
nij-
jackdaniel What's the backend of petalisp? Is it powered by lower-level libs like blas or lapack, or anything similar?
21:19:21
NotThatRPG
petalisp looks really cool, but the license is problematic. It would be nice if we could build images using it that are not also licensed under AGPL, but that seems impossible. I like the idea of making it available in a copy-left way, but the idea that any code calling petalisp must also be copyleft is more restrictive than I can live with :-(