freenode/#lisp - IRC Chatlog
Search
19:18:11
Josh_2
Although I thought there was a way with closer-mop (i think) that you can actually list the slots in a class
19:32:20
shka_
define generic function that will return list of slot names when called with the class name
19:35:56
Josh_2
I have my version of (with-accessors ..) and I defparamed a var which contains the the accessor names as symbols
19:47:15
shka_
if anyone is interested, that's how i do it https://github.com/sirherrbatka/cl-data-structures/blob/0e5df4640ade420305f2535453848a2bd67a5545/src/utils/macros.lisp#L318
19:50:11
saturn2
i don't see the problem with eval-always-ing your class definition if you want to use it at compile time
19:51:59
shka_
it wanted to call it lol (let over let) but in reality it is usually over lambda so it is let over let over lambda
20:03:52
ck_
A higher amount than usual of lisp on hacker news at the moment. Have I missed some anniversary?
20:05:02
aeth
ck_: I think people are just seeing what's getting karma and reposting old things for karma
20:06:23
aeth
Repost this one, "Beautiful Online SICP" (762 points in 2017): https://news.ycombinator.com/item?id=13918465
20:08:44
aeth
Mezzano was posted 19 days ago so that is probably too soon. Some others here could think of something, I'm sure, though.
20:09:31
aeth
borodust: You could try doing a Show HN of trivial-gamekit since HN's hivemind is filling its front page with Lisp articles right now. i.e. https://borodust.org/projects/trivial-gamekit/
20:31:09
Josh_2
hmm, so I can't use (setf (funcall accessor instance) "abc") :( Is there a way I can get around this?
20:42:31
aeth
borodust: ck_ is right, the front page is currently full of Lisp stuff for some reason. https://news.ycombinator.com/news
20:51:31
_death
it will only work if there's a function called (setf accessor) and the two last arguments transposed, assuming "abc" is the new value
20:51:35
dialectic
However you're passing accessor in, pass this instead: (cons #'accessor #'(setf accessor))
20:58:42
Josh_2
Okay that worked, but my logic was broken anyways. Thanks _death I'll fix when I get back
21:09:19
_death
Josh_2: in this case it may be enough just to read a list of initargs and (apply #'make-instance 'data-entry initargs)
21:16:05
dialectic
#| stuff |# is also used for (nestable) comments, so careful with that too if you're making a dispatch character.
21:19:51
MichaelRaskin
Well, borderline: they use that it looks || in code and ignore the fact that it has empty name
21:21:33
stacksmith
Yeah... It's kind of hard to enter it any other way than ||, so as much as I want to object to it, I can't find a good reason... I suppose (find-symbol "") to get '|| may be a little confusing.
21:43:23
fiddlerwoaroof
By the way, shka__, data-lens now has "real" Van Laarhoven lenses: https://github.com/fiddlerwoaroof/data-lens/blob/master/lens.lisp#L83-L127
21:45:44
fiddlerwoaroof
This, so far, is the public interface: https://fiddlerwoaroof.github.io/data-lens/The-data_002dlens_003cdot_003elenses-package.html#The-data_002dlens_003cdot_003elenses-package
21:48:04
fiddlerwoaroof
The advantage of this is that you don't need to depend on a specific lens library to provide lenses: a lens is just a function that works in a certain way and any such function will be compatible with DATA-LENS.LENSES:VIEW, DATA-LENS.LENSES:SET, and DATA-LENS.LENSES:OVER
21:48:29
fiddlerwoaroof
Also, these functions use the "traditional" names for the lens operations, so they'll be more familiar to people coming from other languages.
22:26:31
dialectic
lenses seem vaguely inappropriate for a language like common lisp where I can iterate over slot values or use symbols to set arbitrary slots.
22:33:51
saturn2
common lisp doesn't come with a convenient built-in way to make modified copies of arbitrary objects without mutation
22:34:38
oni-on-ion
R and Julia have things called 'DataFrame' which is kind of like a lense into arbitrarily large data sets, but less about code and more about data (afaik)
22:38:12
dialectic
saturn2: I mean, sure. But how is that any worse or better than a "lens"? You could use one macro, for all cases.
22:38:35
dialectic
Admittedly my functional-fu is weak in this area. I know this won't work for the "applicative" pattern.
22:48:02
fiddlerwoaroof
Lenses are really nice, because if you have two lenses, simple function composition composes the "pointers"
22:49:18
fiddlerwoaroof
And, thy are just "values", so you can pass them around, allowing you to separate "what" a function operates on from the operation applied.
22:50:11
fiddlerwoaroof
Accessors, etc. are handy and, to some degree, overlap with lenses but a significant difference is that setting a lens copies the underlying object, while setfing an accessor mutates it: both have their place, but lenses preserve encapsulation a bit better
0:26:35
vsync
is there anything already to simplify the situation where one wishes to define a protocol and specify methods which may be readers but without imposing a slot requirement?
0:26:54
vsync
this may go into the question of protocol declaration which I'm sure has been discussed before
1:11:05
Ankhers
Hey, I'm just getting started with lisp. Can anyone suggest some books, blog articles, whatever else that they consider to be essential learning materials?
1:11:27
vsync
pjb: naturally but wondering if there is a nicer way that allows for writers and for grouping with protocol (classes)
1:12:14
pjb
vsync: there are various macros to deal with the problem of interfaces, with various features, in systems such as asdf and others.
1:12:28
vsync
something like (defclass foo () ((bar :allocation nil))) modulo of course the redundancy of slot-/accessor-name
1:12:50
vsync
though I'm realizing this may encompass a larger question so I may write and post that
1:13:18
vsync
pjb: naturally, more curious if there is such a thing intended generically, or a convention
1:13:45
pjb
vsync: notably, there you assume a CLOS class. But a protocol can be implemented with different kinds of objects. (structures, vectors, database backends, etc).
1:16:11
vsync
thought I ran into something about protocols some time ago that thought the way I thought about them... and certainly kicked it around here before
1:23:33
Josh_2
phoe was talking about it a few weeks back, I'm will ask him when it is a reasonable time
1:29:15
Josh_2
although I'm pretty sure he mentioned something about having to actually write the sql statements and not using a dsl
1:45:22
aeth
Someone should write some multithreaded CL benchmarks so we can compare CPUs and implementations. (Maybe those already exist?)
1:48:52
oni-on-ion
there always seems to be something about benchmarks they are either not specific enough or too specific
2:31:03
vsync
I'm trying to (re-)grok the rationale for having both a protocol class and a predicate
2:53:36
stacksmith
vsync: keep in mind that generic functions do not require classes... So you can define a 'protocol' as a set of generic functions that do different things depending on type, class, or a check for some parameter being equal to something else...
3:00:57
stacksmith
I find CLIM somewhat complicated. There is probably a good reason for things to be complicated, but I always curse and look for something less complicated before I get to understanding why.
6:03:54
beach
vsync: "filter" is really bad (for a different reason), because it doesn't tell whether it blocks the objects being filtered, or whether those are the objects that are retained.
6:04:33
beach
vsync: So how can you tell whether the argument is a value or a predicate, especially since predicates are values too?
6:11:23
no-defun-allowed
If they're rewriting something like remove/remove-if, I would expect it's an abstraction for a sequence containing elements of some specific type.
6:30:08
no-defun-allowed
My expectation is that they won't have any values that would look like predicates (so, not symbols or functions).
6:38:17
jackdaniel
CLIM specification is complicated because it describes at least three things: window manager abstraction, barebones I/O toolkit and CLIM itself
6:45:54
lukego
I'm coming to the pretty-printer late in life. I have a really newbie question. How come this errors in SBCL? (format nil "~<x~_y~>"). I've looked in the debugging and I see that ~_ is not allowed inside ~<~> but I don't get why not? I thought this would straightforwardly mean "put a newline between "x" and "y" if we don't have space on the line for both."
6:51:44
lukego
Maybe I am confused and need to read the Waters paper on XP again from the top. I'm hoping that it's only minor confusion.
6:52:59
lukego
beach: right but I want a conditional newline only if output is pushing close to the right margin, which is why I'm trying to use ~_ in place of ~%
6:53:29
lukego
and I'm expecting that ~<...~> will keep everything left-aligned in case the newline is needed.
6:53:58
lukego
Maybe I should just assume "deep" confusion and read the docs again from the start :).
6:54:21
beach
Yeah. I personally find the description of the pretty printer quite hard to understand.
6:55:00
lukego
I thought it made sense when I read it but I haven't actually been able to write working code based on my "understanding" yet so I may be deluding myself :)
7:02:30
lukego
dialectic: The three best resources I have on the pretty printer are 1989 documentation by Richard Waters (https://dspace.mit.edu/bitstream/handle/1721.1/6503/AIM-1102.pdf), a paper by Waters on printing Lisp with Pascal syntax (https://3e8.org/pub/scheme/doc/lisp-pointers/v5i2/p27-waters.pdf), and Peter Norvig's pretty-printer-driven transpiler from CL to Dylan (https://github.com/dylan-lang/lisp-to-dylan).
7:08:01
dialectic
While I have people's attention, does anyone have any resources for fast and space efficient multimethod dispatching? I've got the following two papers queued up already:
7:08:39
dialectic
https://hal.inria.fr/inria-00073721/document (compressed tables) and http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.45.7589&rep=rep1&type=pdf (automata)
7:09:07
dialectic
But I also was interested in implementation details for Lisp and SBCL specifically.