freenode/#lisp - IRC Chatlog
Search
5:09:56
mfiano
Hello all. If I want to sort a list of symbols such that they are sorted lexicographically and ascendingly on both PACKAGE-NAME and SYMBOL-NAME, is it enough to treat the elements as string designators using (sort some-list #'string<), or must I write my own predicate?
5:12:41
mfiano
Just to elaborate, the question is moreso about how a symbol is converted to a string designator, since I want '(mypkg::foo mypkg::bar cl-user::foo cl-user::bar) to be sorted as (cl-user::bar cl-user::foo mypkg::bar mypkg::foo)
5:16:17
White_Flame
but to sort by package, the :key would have to be (lambda (sym) (package-name (symbol-package sym)))
5:18:48
mfiano
I see. Thanks for the suggestion. I was about to resort to that, but was hesitant as while this doesn't occur frequently, when it is, it is being used in the context of a performance-sensitive event loop.
7:46:11
flip214
mfiano: group the symbols by package, then sort the packages and the symbols (per package) separately
10:45:05
ldb
is there any reason most programming langauges treats (expt x 0) const one rather than raise div by 0 error when x is 0?
10:49:51
jackdaniel
in algebra 0^0 usually is treated as 1, often it is left as undefined expression, but I've never heard an interpretation that it is division by 0
10:50:44
jackdaniel
here is even a section about software https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero
10:51:55
jackdaniel
(and, from cl perspective, the answer would be: because it is specified to return 1)
11:03:35
jackdaniel
I mean, that I would find more inuitive that arithmetic-error is signalled, but not necessarily division-by-zero
11:04:23
jackdaniel
or rather, from the specification it seems to be, that division-by-zero shoudl be signalled
11:12:41
galex-713
Beside being older, more used, a lisp-2 (actually lisp-n, afaiu), not having continuation but having goto, and empty list/falsity equivalence, what are the other differences between common lisp and scheme?
11:13:54
jackdaniel
galex-713: common lisp has more predefined functions, longer standard which addresses many practical issues (which are undefined in scheme) and it is a language used by most people here ;)
11:14:52
galex-713
for me that comes with “older”, sorry, I should have been more precise: what are *fundamental* differences, preventing of implementing one in the other fully and respectingly
11:15:29
jackdaniel
galex-713: common lisp is actually "younger" than scheme, however it has lineage which dates before scheme was introduced
11:15:46
galex-713
White_Flame: as of macros, I just consider cl is lower level, I heard you can implement hygienism with defmacro, and can see how, and I saw several scheme implementation providing defmacro-likes
11:16:01
sm2n
I believe someone was talking about their scheme implementation in cl here just yesterday
11:16:52
jackdaniel
'hygiene' suggests something good, but I (as a common lisp programmer) consider it bad, so 'sterile'
11:17:14
galex-713
sm2n: because of lisp-1 that would require redefining eval, and then also compile, at least… so it wouldn’t be the same thing… common lisp just looks lower level
11:17:26
galex-713
I’ve also a friend who says continuation are terrible, in terms of general performance
11:17:50
jackdaniel
having some tool at your disposal does not mean that you have to use it, so it is not a problem that scheme has them
11:18:05
jackdaniel
one thing, which is not guaranteed by cl standard, but is guaranteed by scheme standard, is tail recursion
11:18:36
jackdaniel
otoh common lisp programs usually use iteration, not recursion (maybe because of that, but also iterative style is more plain imo)
11:18:55
galex-713
jackdaniel: to me it looks like a children toy, or a rounded knife for children, like it’s made so that you can cut yourself with it, which may be handy if you’re clumpsy, but you can do less with it
11:20:24
galex-713
jackdaniel: maybe iteration is also more culturally anchored… proper tail-recursion, if instead of reusing the name of current lambda function used something more akin to “return” but call “recurse” (or “repeat”) it would really look like a pascal/cobol/fortran (forgot which of those have that) “do … repeat”
11:20:26
sm2n
huh, I did not know that, I've never run into a stack overflow from writing tail recursive functions
11:20:59
jackdaniel
galex-713: continuations (and delimited continuations) are actually very cool concept, and the latter is quite practical and may be implemented efficiently
11:21:15
contrapunctus
Oh, speaking of recursion...is there a standard way or a library for named let in CL?
11:21:31
White_Flame
unless you can have 'repeat' in the middle of lexical bodies, and change a set of parameters inline with it
11:22:40
sm2n
though the latest iteration of continuation abstractions is effect handlers, which are quite cool and can be optimized away in certain cases
11:23:03
galex-713
White_Flame: well tco implies it’s somewhat near the end, so for variable binding/changing/conditions, I guess you can manage to do something which looks “almost the same”
11:23:47
galex-713
but to me it would then look uglier, and also it looks harder to modelize mathematically to prove stuff to me (but I’m not a math guy, many math stuff looks complicated too me, including formalizing behavior of an imperative loop)
11:24:23
contrapunctus
galex-713: I'm not sure you understand what I want...I'm asking, if I want to use named let for recursion, does the CL standard have that? Or maybe there's a library for it? (Of course I can write it myself with a macro, but I want to be aware of prior art.)
11:24:54
galex-713
White_Flame: yes but within do .. repeat you have some sort of return/continue (then it’s the same) or test guard right? you could use just the same stuff to define a variable “continue” which will affect that…
11:25:46
galex-713
though scheme appears to keep trying to reimplement all of cl, changing some names
11:26:01
ldb
sm2n: i mean, with out cps, a compiler can still implement effect handler, by embedding the right equational rules
11:26:23
galex-713
I know, but I don’t know how much the standard diverge, and it seems many people based on it for their implementation, at least at first
11:26:29
jackdaniel
galex-713: you may read the standard here: http://www.lispworks.com/documentation/HyperSpec/Front/index.htm
11:26:36
minion
galex-713: look at 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).
11:26:39
White_Flame
yeah, it took me a while to figure out what "named let" is, since CL LET obviously creates named bindings. LET is never anonymous
11:27:32
jackdaniel
it does not list changes from cltl2, but it has plenty of content which is not covered by cltl2
11:27:34
galex-713
jackdaniel: CLtL2 is a thousand page… reading all of it again is… well… especially for me it’s easier on paper, as I distract easily…
11:27:55
jackdaniel
http://web.archive.org/web/20130807175341/http://bc.tech.coop/cltl2-ansi.htm here you may see some comparison
11:28:39
ldb
sm2n: equational logic, an implementation is OBJ3 (written in CL) and its succesor Maude
11:28:40
galex-713
before buying CLtL2, I searched for a printed version of the standard, like hyperspec but paper, and didn’t find anything :c
11:29:22
contrapunctus
White_Flame: named let is Scheme's syntactic sugar for recursive functions - (let foo ((a 0) (b 1)) ... (foo 1 2) ...) (the next time, a and b will be bound to 1 and 2)
11:32:14
jackdaniel
galex-713: print this https://web.archive.org/web/20180811021738/http://cvberry.com/downloads/ansi_cl_standard_draft_nice.pdf
11:35:09
ldb
galex-713: there's a nice PDF version of CLtL2, under https://github.com/daly/axiom/blob/master/zips/clm.pdf
11:36:36
galex-713
ldb: I’ve the sources from steele’s website, as for CLtL2, I just can’t get the index to compile correctly
11:37:15
jackdaniel
I think that while cltl2 is nicely written, learning from it will do you no good, because it is a *different* language than Common Lisp
11:38:16
jackdaniel
it worked for me, cvberry.com website went blank some time ago, that's why I've linked the archive copy
11:38:50
easye
jackdaniel: RE: cltl2: slightly disagree, the style (Steele!) is excellent, and can help with some points. One does has to check the CLHS for exact differences, of course.
11:39:06
galex-713
ldb: I also have a compiled version with hyperlinks, but it’s more cool to have sources, to reprint and correct it if one day I feel it is needed
11:39:30
dra
galex-713: https://franz.com/support/documentation/cl-ansi-standard-draft-w-sidebar.pdf
11:41:09
galex-713
jackdaniel: I read the diff you gave, to me it looks small or superficial, I disagree, I hoped bigger change (like the series, CLOS or condition system added as annexes in second edition of CLtL… though I know CLOS description is not complete and doesn’t describe MOP, I didn’t find where to get anything about that, and thought I could complete with ANSI Common Lisp from Graham
11:42:04
jackdaniel
easye: it is a nice reading, but learning about cltl2 to understand common lisp is not a sound idea in my eyes, precisely because of these small differences
11:45:12
galex-713
I wished there were a fusion of CLtL2 and that draft, in some format such as texinfo, that could convert to both a readable TeX book and to an html hyperspec
11:46:43
galex-713
jackdaniel: I started with elisp, learnt scheme by reading r5rs, some r4,6,7rs and srfi, and wanted my knowledge to be exhaustive, I was especially excited about type declarations, but this doesn’t seem to have changed
11:48:30
galex-713
jackdaniel: dra: also, was cl only standardised by ANSI? wasn’t it also by ISO, IEEE, or something alike, outside of US?
11:49:37
ldb
galex-713: Anatomy of Lisp teaches the LISP family of languages via the formal semantics
11:51:01
jackdaniel
islisp has iso standard, eulisp was being standardized in Europe (but only drafts are available, it was never finished)
11:52:48
galex-713
anyway, I think if any foreign org should have done that, they should have just dubbed the ansi one
11:56:22
galex-713
jackdaniel: buy from ANSI? that’s possible? I’m in Europe and only european also. And why terrible? why a waste? what’s dpans3?
11:57:49
jackdaniel
ansi sells documents with standards, but they charge (afair) $20 per copy, which is an ugly scan of a printed document
11:58:40
galex-713
contrapunctus: indeed labels in the best bet to build named let on it, but beware without syntactic sugar, you will have to write program body before init vars, like with map
11:58:40
jackdaniel
if you want to compile latex yourself, dpans3 sources are available i.e in this repository: https://gitlab.com/vancan1ty/clstandard_build.git
11:59:11
galex-713
ldb: oooh, so it’s not about lisp, it’s about computer science, but uses lisp is it?
12:00:33
ldb
galex-713: noo, it's all about lisp, how to implement lisp, the meaning of the primitives. it is just not about a specific kinds of lisp
12:01:04
galex-713
ldb: does it also speaks about history? like lisp 1, 1.5, maclisp and maybe interlisp?
12:02:35
ldb
galex-713: it is using essential the same notation from McCarthy, but also talked about lexical scoping.
12:11:15
jackdaniel
galex-713: let me help you: https://duckduckgo.com/?t=canonical&q=dpans+lisp&ia=web
12:26:42
galex-713
(I feel also like other people are also just better than me, they adapted to the noise, and I don’t, it drains my energy out)
12:27:29
galex-713
well for instance I searched “dpans3” on google and first 5 results didn’t tell me anything about what I wanted
12:28:04
galex-713
and I have a randomly-strong adhd (but trying some medicine now, maybe it helps, who knows)
12:28:30
galex-713
I also happened to find interesting programs on github, apparently proprietary, yet useful
12:28:50
phoe
I usually add more keywords to searches, I guess that "dpans3 lisp" works somewhat better
12:31:07
galex-713
I usually add the least, as long as it’s unambiguous (then go back if it’s apparently not), so I don’t get unrelated answers that could be unrelated (or even not containing) the keywords that really interested me
12:32:18
galex-713
phoe: antoszka doesn’t include a readme and I don’t know which of these dozens of file research for the meaning of what “dp” stands for
12:32:38
ldb
intead, you should looking in books' reference/bibliography section for relatex information
12:34:27
jackdaniel
the first rule of steering through noise is to not generate it ;) discussing ddg vs google is not this channel topic
12:34:55
galex-713
also a horrible thing is then google makes so relevant bubble about people you ask for help, that you can’t get help from them because “google it it’s obvious”, and if trying ddg or other, you don’t get the answer…
12:35:53
galex-713
jackdaniel: you are right, thank you (through irrelevance can be sometimes relevant, especially as some people are sometimes more relevant than other, especially here ;) so each channel ought to have a -offtopic counterpart)
12:36:43
jackdaniel
this channel has one, it is called #lispcafe -- a preemtive answer: some people are not on #lispcafe because they are _not_ interested in offtopic
12:38:00
galex-713
jackdaniel: “[14:22:08] <dra> 20 years ago it was way easier to find useful information on the net.” was brought here by someone not on the offtopic channel, and I found that interesting, I think I should have answered privately then maybe, thank you anyway
12:40:47
jackdaniel
there you go sunshine, I'm afk for a while (to avoid complaints for changing the topic)
12:48:46
galex-713
So let me resume: beside being older, hence more used, with special variables, being a lisp-2 (actually lisp-n, afaiu), not having continuation but having goto+return, and empty list/falsity equivalence, one of scheme or cl could be implemented in terms of the other?
12:49:24
galex-713
like having a small kernel implementing all these, and configurabilility about what to do about booleans and namespaces
12:50:08
galex-713
are there also pecularities to typing? or is just cl superior to scheme in this respect (which restricts itself to a few standard disjoint datatypes)?
12:50:27
phoe
kinda sorta - I think the most painful thing is the ability to express continuations in CL and (I guess?) implementing on Scheme-side the possibility of doing external non-local returns in CL
12:56:10
beach
galex-713: Both languages are Turning complete, so you can always implement one in terms of the other. The only question is what technique you then use, and how painful it is.
13:44:32
galex-713
beach: some features are more low level than others. I’m pretty sure we can implement gotos in terms of lambda, but it looks extremely wrong to me, and I would never want to do that
13:45:07
beach
So then the question is what you want, and that is a very tough question to answer, because there are so many different options.
13:45:15
galex-713
so, let me try that: except continuations, all of scheme is expressible in terms of cl
13:46:08
galex-713
beach: I’d like to take any implementation and make it pyramidally built upon a small lower level kernel
13:47:17
galex-713
I think it’d need to be a lisp-n (in a configurable way: let n be any number, possibly as much as the number of types), have both continuations and gotos, configurable scope, and configurable conditionals
13:48:00
jdz
galex-713: Even Scheme people don't think full-blown continuations are a good idea — they don't mix with dynamic (special) variables very well.
13:48:56
galex-713
phoe: I’d like to help a friend do something useful and amusing to more people from his thesis work
13:50:05
phoe
the former is a general Lisp discussion channel, where the latter (here) is strictly CL-related
13:52:03
galex-713
but anyway my base question was on cl, and scheme, and I asked on both channels, and got non-overlapping relevant answers
14:03:55
beach
galex-713: As it turns out, that technique of implementing a language (i.e., growing it from something lower level) is not necessarily a good idea, as you would see if you followed my presentations for the online Lisp meeting.
14:17:36
phoe
my thought/experience/conclusion on which topic in particular? I'm just a Lisp hacker/programmer
14:22:19
phoe
all talks that I've streamed so far as a part of the OLM initiative are on this channel
14:24:17
minion
galex-713: SICL: SICL is a (perhaps futile) attempt to re-implement Common Lisp from scratch, hopefully using improved programming and bootstrapping techniques. See https://github.com/robert-strandh/SICL
14:25:25
phoe
basically, SICL is an attempt to write a CL implementation 1) in a fully modular way, 2) in portable Common Lisp without parts in any foreign languages
14:25:49
phoe
1) makes its modules usable and useful in other implementations and just in general as libraries
14:26:53
phoe
2) is the craziest idea ever since it means that you can write all of CL in CL without any kind of intermediate core written in C or what else and without issues of "we can't use defclass because we don't have defclass yet"
14:29:12
galex-713
beach: thank you, I read several pages on that then :) so the new thing is you use the whole high level common lisp to implement it right? or some new features too?
14:29:43
jackdaniel
the idea is not crazy, C is bootstrapped using "full" C; it is just not very common among existing common lisp implementations
14:30:25
phoe
jackdaniel: ebrasca: I meant what jackdaniel mentioned - it's not what existing implementations do. Mezzano and SICL are unique in the matter
14:30:35
galex-713
jackdaniel: it is not very common among high-level languages implementations, I only know C, C++, rust, haskell and OCaml who do that
14:30:57
phoe
galex-713: the SBCL compiler is written in CL, the C core is usually used for interfacing with the OS and for garbage collection
14:31:59
galex-713
modules which could dynamically load libc themselves, and/or base themselves on some kernel API, isn’t it?
14:32:53
beach
galex-713: Not so much, no. Most of the code is tied to SBCL itself. And the SBCL compiler is written in a subset of Common Lisp that does not include CLOS.
14:33:34
galex-713
I’ve seen that in guile too, lisp implementors keep implementing it in non-portable way, this is sad :c
14:33:53
galex-713
and it’s bad, because the more important is something, the more readable it should be
14:34:41
phoe
there's SB-INT and SB-C and SB-IMPL and SB-VM and SB-GRAY and SB-WHATEVER splattered all over SBCL source code: compiler, reader, FORMAT, LOOP, everything
14:35:00
beach
galex-713: CLOS is part of the Common Lisp standard. So it all has to be implemented in a conforming Common Lisp implementation.
14:36:07
galex-713
jackdaniel: REALLY??? even the VM? but how is it natively compiled? I thought there was only gcj which did that, and it was abandoned…
14:36:29
jackdaniel
there are multiple compilers (the standard java compiler is written in java), but this is offtopic
14:36:53
beach
galex-713: In other words, there is no "order" between modules. It is not the case that one module is written in a subset defined by modules that have been created previously.
14:36:59
galex-713
I dislike OOP, but your talk should be interesting, but it lacks subtitles and spoken english drains my energy if it’s not with a friend :c
14:38:15
beach
I am sorry to hear that you dislike object-oriented programming. That dislike is probably due to your not having been exposed to CLOS.
14:39:46
galex-713
it would have changed my way to see english, if a native french speaker had a so good accent that it made me tired
14:39:47
phoe
(defclass frenchman-for-all-practical-purposes () ()) (defclass frenchman (frenchman-for-all-practical-purposes) ())
14:42:09
beach
galex-713: So to summarize, "growing" a language implementation is not such a great idea, because it requires the person implementing and maintaining a module to know precisely what subset of the language is allowed.
14:43:44
galex-713
personally I like reductionism (“growing a language” out of low-level) because it helps learning the whole system working going down, and also because it means you don’t have to know everything to read anything
14:47:56
galex-713
or is it about using it and doing fun or unheard or not-known-enough stuff with it?
14:48:35
phoe
it's about constructing it from scratch two times in a row in different ways, and then discussing its uses and traits and quirks and fun purposes
14:49:41
ldb
actually most programming languages are suspicious to all kinds of exception handling like things
14:52:02
galex-713
phoe: no no, you don’t understand, in my case it’s an issue, I don’t write anything T-T
15:01:13
MetaYan
dra: continued from #sbcl - I just happened to have read the errata a couple of days ago, so the form rang a bell. Not familiar with the details yet.
15:07:01
dra
MetaYan: Yeah. I just noticed that SBCL spits out a few warnings and COMPILE-FILE sets FAILURE-P. Loading the FASL works and even the continuations work. But by now I'm convinced that Weitz must have DEFVAR'd the symbol before (setq foo 13). See 12m54s at https://www.youtube.com/watch?v=EyhL1DNrSME.
15:10:39
_death
dra: it's an old habit to setq like that.. the standards committee decided to not define the consequences of doing it, and some implementations (e.g., sbcl) decided to be strict and signal a warning
15:25:55
galex-713
phoe: I guess your book and what’s in it won’t be under a free licence…? :/ do you know how much it will cost btw?
15:26:53
phoe
also, nope, I expect coin to flow through them to me if you get the book in a legitimate way
15:29:33
phoe
beach: I still don't know, I'll know when it comes out of production and we have a chance to implement our last fixes there
15:30:10
phoe
I... honestly don't know, because I don't know what kind of page size and font they'll use
15:38:24
phoe
galex-713: yes, CLtL2 (AFAIK) doesn't teach how the condition system works internally or how one can construct it from scratch
15:42:19
galex-713
phoe: just that? so I could read that in another implementation and it would be “just” more difficult and likely uglier (since I guess it’s must be beautiful to be published)?
15:43:29
phoe
same way you can "just" read the Portable Common Loops sources in SBCL and it would be "just" more difficult and likely uglier than reading AMOP
15:45:56
galex-713
does Sonya’s book describe MOP too? what do you think of it if you have read it at least skimming?
15:46:38
phoe
MOP is a means of implementing and programming CLOS; I don't think Sony--- thanks xristos
15:47:21
xristos
the sonya book is nice but i'm not sure i'd spend the money for it if i had another chance (i bought both)
15:47:34
phoe
I can't say if my book is worth buying because that'll be up for the reviewers to decide
15:48:15
galex-713
phoe: for now it looks promising :) you you implemented conditions twice and are proud enough to put that on paper, that inspires trust
15:48:41
phoe
galex-713: I didn't really do that from scratch once, I based the implementation on an earlier one
15:49:38
galex-713
if you found something beautiful and even a little improved it and explained it, it’s cool
15:50:23
phoe
obviously not, that implementation was from 1990s and didn't even compile cleanly anymore
15:50:51
phoe
it seems that PCL is built atop MOP, at least judging from https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/oop/clos/pcl/ code
15:52:13
galex-713
but I knew a bit of smalltalk, and it seemed stupid and beautiful at the same time, I liked it somewhat
15:52:37
galex-713
I had a course on it, never did anything because the implementation taught was proprietary
15:53:07
phoe
#lispcafe would say that Pharo is a good modern free smalltalk implementation, but that's already #lispcafe material
15:54:19
dra
galex-713: I found phoe's comments very thorough and insightful in the book announcement thread on Hacker News: https://news.ycombinator.com/item?id=23843525
15:57:52
phoe
;; so this kinda teaches me that the traveling salesman problem is not a problem when you're the salesman and you travel to HN to show your wares