libera/#commonlisp - IRC Chatlog
Search
10:26:50
AadVersteden[m]
I have an itch which I don't intend to act on, yet still: does SBCL have a fast way of doing matrix multiplication of numbers?
10:28:27
jackdaniel
I don't think that there is anything bultin. there are libraries for that though - magicl is one, another is 3d-matrices (I think); there's also petalisp if you feel like getting adventurous
10:28:53
AadVersteden[m]
I think it'll be two two-dimensional bit-vectors so in reality I can do a bitwise and.
10:29:30
AadVersteden[m]
jackdaniel: thank you, I'll read the readme and that should be enough to get this out of my head :D
14:56:44
mariari
what should I read to learn more about funcallable-standard-class and stadnard-generic-function?
14:58:56
mariari
Yeah I've read through and started to implement the AMOP book in factor, but didn't get as far as funcallable-standard-class
14:59:19
jackdaniel
there isn't much to funcallable-standard-class - your class needs to have a metaclass funcallable-standard-class and then you set the function of an instance with set-funcallable-instance-function
14:59:36
jackdaniel
other than that funcallables are instances like any other - you may add slots with accessors etc
14:59:54
jackdaniel
to associate such funcallable with a symbol simply do (setf (fdefinition 'funciton) #<my-instance>)
15:00:46
beach
mariari: Funcallable instances are more like generalized functions where you can store things in slots as jackdaniel points out.
15:00:53
jackdaniel
you could use it for that I guess. another use case would be for example associating argument parsers with the function
15:03:17
mariari
beach: that does sound neat, I think an issue I had in the past was making languages I created interoperate with CL, I think the redefinition issue was on the CL side rather than the language side. But I can imagine using this for some things
15:03:45
mariari
jackdaniel: that does seem like a good use for that, is there good uses for this in the wild, just saw it in my nyxt code, while writing an email responding to someone
15:25:12
beach
I think jackdaniel hinted about associating a parser with the function. CLIM does this for commands, so that would be one use for funcallable standard objects.
15:25:56
jackdaniel
currently we keep parsers in hash tables, but switching commands to be funcallable-standard-instances would be nice
15:26:51
beach
And I use host funcallable standard objects to hold SICL generic functions during bootstrapping.
15:29:02
scymtym
context for the CLIM related idea: https://irclog.tymoon.eu/libera/%23clim?around=1625838614
15:30:58
beach
scymtym: I would even argue that its the only right way to do it. Then the hash table wouldn't have to be weak, for instance.
15:32:39
scymtym
beach: the thing i liked most about implementing commands as funcallable instances was replacing the huge generated parser functions
15:33:05
jackdaniel
so if the command is removed from the command table then parsers are also removed (i.e there is no need for weak keys or values)
15:34:00
jackdaniel
generally what scymtym says, that would reduce complexity (at the expense of slightly violating the specification)
15:44:11
scymtym
beach: the funcallable object can store data about the parameters and interpret that data when parsing. i suppose this would work with regular functions as well but less conveniently. for example, if you want to reuse the same function for all commands, you cannot close over the parameter data. to be honest, i don't have this fresh in my mind since i implemented it some time ago
17:17:12
NotThatRPG
Lazy programmer question: Anyone have a comparison function for sorting s-expressions roughly lexicographically? I can definitely write one myself, but if someone's done it, I'd love to save myself the trouble
18:06:48
NotThatRPG
I was thinking this would involve some fussy choices about when to use string-< and when < since the latter doesn't generalize over strings, and thinking about what to do when comparing lists and atoms (I'd prefer the latter come first). Not so?
18:07:14
NotThatRPG
ACTION suspects he actually wrote this at least once, but doesn't have it any more
18:10:47
Bike
i don't think there's any obviously right way to compare a string and a number, or what have you. depends on what you need for your application
18:37:58
NotThatRPG
Bike: I am just looking for something that is lexicographic-ish -- I'd like to make a list of s-expressions easier for a human (particularly a debugger) to read, so it would be nice to make it something like library order, but it's not hugely important.
18:39:25
NotThatRPG
It would probably be enough to have numbers all come before symbols, strings or lists, symbols and strings sorted with string-<= , lists last, and sorted recursively.