freenode/#lisp - IRC Chatlog
Search
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.
7:10:23
shka__
AFAIK there was even implementation of the said algorithm in the sbcl as a proof of concept
7:10:41
lukego
Edi to the rescue! "It is important that the closing "~:>" directive contains the colon as shown because otherwise this means something completely different (justification) which doesn't mix with pretty-printing." (p261)
7:10:47
dialectic
I should compile a comparison of all the different multimethod dispatch implementations in the wild.
7:11:32
lukego
So it could be that I have an accurate mental model of the pretty-printer but am just a n00b with the format-string directives and maybe should stick with long form (pprint-newline) etc first.
7:12:25
shka__
I have been programing in lisp for years and yet i still don't quite know how to do stuff with format
7:13:54
_death
lukego: long form is best.. otherwise it leads to having to manually decode the control string as in https://adeht.org/casts/new-project.html
7:14:52
dialectic
format is one of those things that when you first learn about you scorn but grows on you over time.
7:15:28
beach
dialectic: My paper takes into account the specific situation of Common Lisp where the classes can be redefined at run time.
7:15:29
dialectic
I like loop. I ended up preferring iterate, once I learned that. But loop is, still, good.
7:16:00
dialectic
Haha. One of these days I will come up with a good use for metaclasses. Actually, I probably never will.
7:19:27
_death
lukego: though I guess there could be a format-explain operator that automatically decodes it.. hmm
7:19:39
beach
shka__: Because they require memory accesses, which are an order of magnitude (or more) slower than register operations.
7:19:55
no-defun-allowed
Still reading, but the table could get big quickly with multiple-inheritance.
7:21:14
beach
shka__: Yes. My technique is based on a small number of comparisons with small constants, so it can be done by register operations.
7:21:15
_death
dialectic: I don't recall strong opinions towards this person from another.. in any case, it's the same Drew that wrote a bunch of Lisp papers, books, software
7:28:44
saturn2
i'm working on a web project that involves multiple similar but different sites, i used metaclasses to allow site objects to inherit things other than just slots and methods
7:29:14
fiddlerwoaroof
dialectic: if youre interested, I have an unoptimized implementation of multiple dispatch inJavascript, that I hope to eventually polish for use in "real" projects
7:31:14
fiddlerwoaroof
I've always foubd Clojure's multimethods disappointing: they're more like filtered dispatch than what CLOS has
7:35:08
beach
In fact, drmeister seems to be attempting the use of my technique for C++, instead of the usual, vtable-based technique used by most C++ compilers.
7:36:25
beach
shka__: Sure, I know many people get really excited about C++. I personally don't, but hey.
7:37:21
ggole
vtables are very much an implementation detail, but all the compilers do it that way afaik
7:37:30
shka__
beach: nah, now i am wondering what's going on, you have opened my eyes for some things that should have been obvious to me
7:38:31
beach
I am wondering about C++, because the main difficulty in designing my technique was to deal with obsolete instances, but C++ doesn't have that problem, so I am surprised nobody has come up with a technique based on inline caches the way mine is.
7:38:40
dialectic
beach: I haven't read this paper but are you saying that a generic function using your implementation should be faster than a table of function pointers?
7:39:21
ggole
It's possible to defunctionalise, and some C++ compilers are starting to do that (they call it devirtualisation)
7:40:42
beach
dialectic: C++ can probably be faster when the index of the table entry is known at compile time, but I am interested in dynamic languages like Common Lisp.
7:41:07
lukego
beach: My hot take on fast dispatching - which I realize nobody solicited :-) - is that the big win would be to make it play nice with the CPU branch predictor so that method bodies can be executed speculatively without waiting for loads. Seems like your approach should work really well in that sense based on a quick skim.
7:42:18
ggole
lukego: you want to change the table into a decision tree that branches directly to concrete implementations?
7:43:23
lukego
LuaJIT basically transforms all the data-dependencies into control-dependencies and then outsources the problem to Intel's billions of dollars of work on branch prediction.
7:43:24
ggole
There are a number of whole program compilers (for static languages, mostly) that work that way.
7:53:42
shka__
lukego: actually beach algorithm looks like very friendly approach to the branch prediction to me
7:53:53
lukego
ggole: Could also be that you don't need to go that far and CPUs can predict indirect branches well too, I don't have much experience with that. Generally I am just in awe of how well branch prediction works in practice.
7:56:42
ggole
Mmm. There are advantages beyond just removing indirect branches, though, since you can inline the now direct calls and get the usual benefits.
7:57:26
ggole
The usual disadvantage is that defunctionalisation is a whole program transformation, but dynamic compilers don't really suffer from that.
7:58:12
aeth
This article talks about some advanced branch prediction. And it points out that it's not even the best known methodology! https://fuse.wikichip.org/news/2458/a-look-at-the-amd-zen-2-core/
7:59:43
ggole
If you compile strictly AOT, then yes. However a JIT compiler can record which classes/values actually arrive during execution, avoiding that problem.
8:05:20
dialectic
ggole: What do you mean "defunctionalization is a WPO, but dynamic compilers don't really suffer from that"?
8:06:18
ggole
A dynamic compiler is presented with all of the code at runtime (although not necessarily all at once). Thus there's no issue of separate compilation.
8:07:48
dialectic
seok: I haven't used it but isn't this what you're asking for? https://github.com/fukamachi/caveman/blob/master/README.markdown#structured-querypost-parameters
8:09:13
dialectic
In other frameworks the body isn't always parsed until you ask it to be parsed. I wonder if there's a way to do trigger that in caveman2.
8:13:44
dialectic
seok: No, you're supposed to use (defroute ("/login" :method :POST) (&key _parsed) and then get the values out of _parsed.
8:14:18
no-defun-allowed
dialectic: The predictor isn't that dense, just one perceptron per register. I think Zen 1 had something like that too.
8:16:03
dialectic
seok: You can tell from the rest of the documentation that the macro uses specific symbols to bind specific features. _splat is another example in the docs.
8:17:01
aeth
dialectic: I guess the next step in advanced compiler writing is reverse engineering exactly how Zen 2's branch prediction works and optimizing for it. (Or deoptimizing it with pathalogical cases if you're writing Intel C's compiler.)
8:17:29
no-defun-allowed
dialectic: Seems this paper was presented to the IEEE in 2001 if it matters. I wouldn't be scared.
8:17:30
dialectic
You're welcome. I remember you asking that question yesterday (or the day before) and felt bad when you asked it again
8:17:59
no-defun-allowed
And well, there's only so much you can do by increasing clock rate. I think CPU manufacturers learnt that at the end of the 00's.
8:18:28
aeth
no-defun-allowed: A lot of Intel marketing right now is just a giant "5" and then a smaller ".0 GHz"
8:19:31
no-defun-allowed
aeth: Don't forget the 1HP portable air conditioner used to get the processor to that speed.
8:21:05
no-defun-allowed
Apparently perceptrons were used for prediction as early as Piledriver (in 2012).
8:21:33
shka__
no-defun-allowed: 5GHz on silicon translates to 120W of TDP which is a practical limit of air cooling
8:22:50
no-defun-allowed
shka__: I was referring to a demonstration Intel did where they literally used an air conditioner to cool their processor.
8:24:20
no-defun-allowed
https://i.redd.it/hqlqm3jkfn211.png is the last I'll say about perceptrons and processor cooling, though I want to write a perceptron now.
8:26:18
shka__
it is probabbly the simplest ML algorithm possible, but i wonder how they put it on the silicon
8:30:44
aeth
an impractical gimmick is exactly the sort of thing we might see in parts that are stereotyped toward impractical gamers, though
8:31:09
seok
no-defun-allowed: you are right the docs say "it should not be used in code where performance is important"
8:32:37
seok
shka__: haha, for at least early stages of development I will try this out. I don't imagine accessing slot values will ever be a bottleneck in my web application
8:32:46
no-defun-allowed
Also I can't tell if it handles multi-dimensional arrays, which is a shame because you don't see them in many languages and I like to brag.
8:33:44
aeth
shka__: Fortunately, even though the important computers are cloud servers, they're not too different from desktop CPUs with lower clock speeds, especially these days with the core wars going on.
9:35:18
jackdaniel
there is also #clschool if you have numerous basic questions due to learning the language
9:35:32
Filystyn
ok. I have this first question. defvar *db* nil <--- I have this example but the clisp complained and I had to remove nil
9:36:09
Filystyn
I do not knwo which questions are basic in my opinion #languageNOOBS channels are useless and have little support
9:37:18
jackdaniel
#languageNOOBS channels are for populated by people who are interested in giving advise. some people hang on irc to spend time with fellow lispers
9:37:30
jackdaniel
that said it is unlikely that clisp responded to (defvar *db* nil) with a warning
9:41:02
minion
Filystyn: direct your attention towards pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
10:07:19
no-defun-allowed
You can write that into file.lisp, then any references to +var+ will be replaced with that "something".
10:16:54
no-defun-allowed
If you want that symbol to alias *winedb*, you should use define-symbol-macro then.
10:23:17
_death
(defun evil-load (file &optional alist) (with-open-file (stream file :direction :input) (loop for form = (read stream nil stream) until (eq form stream) do (eval (sublis alist form)))))
10:25:17
no-defun-allowed
_death: didn't know about sublis and always wrote it myself, thanks for pointing it out
10:57:39
jackdaniel
there is another question, is the thing you want really the thing you want, or these are just misdirected means to an end we do not know about
10:58:50
jackdaniel
I'm saying that only because I was scolded once in the past for verbatim answering the question instead of hinting the solution, justfully so ,)
12:36:47
ochkep
There is now a way for foreigners to donate to MoveOn PAC without being detected and to help defeat Donald Trump in 2020. We have set up accounts that will take your donation and peg it to the name of someone who hasn't donated the maximum yet. Best of all, this is 100% legal! Help preserve human rights and global governance; donate to MoveOn. “When a community starts to listen to each other, pull together, and work towards
12:36:47
ochkep
URI: bitcoin:bc1qyv7kug65090hq8yhzp76q2kvujt69p9pdxrjd7?amount=0.03000000&label=MoveOn&message=MoveOn%202020