libera/commonlisp - IRC Chatlog
Search
22:23:11
pjb
skeemer: have a look at Casting Spels in Lisp Conrad Barski, M.D. http://www.lisperati.com/casting.html
23:22:52
mzan
Lisp syntax is "uniformly ugly" so you can add to it various macro and DSL without thinking too much.
23:23:26
mzan
On the contrary it is more difficult to extend a language with an infix syntax like C, C++ in good way.
23:24:19
mzan
On other words: every DSL in Lisp seems native, while on other languages maybe not, because you had to extend the syntax in a nice way.
23:40:29
stacksmith
mzan: many people find Lisp syntax "uniformly beautiful". It's nice for macros the same way gloves are nice for human hands - Lisp syntax is what it is primarily to allow macros to manipulate forms, don't you think?
1:36:23
copec
For probably the best case comparison https://docs.julialang.org/en/v1/manual/metaprogramming/
3:01:56
beach
asarch: Assuming by "native language", you mean the literal meaning, i.e., the one I was born into, then it is Swedish. But my "primary" language is English.
3:06:10
beach
Person P lives in country C doesn't automatically imply that P speaks the official language of C.
3:10:42
beach
Either way, it's off topic. Now, my primary (but not "native") programming language is Common Lisp.
3:11:59
beach
asarch: Also, you should turn on your spell checker. It would have caught your typos in two of the languages you listed.
3:13:04
beach
asarch: I have been exposed to quite a few, but whether I still "know" them, is a different story. Not important either way.
3:14:43
beach
I have been using Common Lisp almost exclusively for more than 2 decades, and the languages I used before that have evolved.
3:33:48
Spawns_Carpeting
are there are "must have" cl libraries for basic things like strings, lists, file handling, etc? I am thinking something like dash and s for elisp for example
3:34:27
Spawns_Carpeting
elisp actually doesn't make a terrible general purpose language using those libs and cl-lib
3:35:46
beach
Spawns_Carpeting: If, instead of referring to Emacs Lisp, you describe what it is you want, you might get better answers. That said, Alexandria is a general-purpose library for many things that are useful additions to basic Common Lisp.
3:36:29
beach
Spawns_Carpeting: I am not going to read up on dash and s to answer your question, is what I am trying to say.
3:40:23
beach
Spawns_Carpeting: Emacs Lisp is not a "programming language" in my vocabulary, but a "programming system". For something to be considered a "programming language" I require it to have a specification established by an "organization" that is separate from any of the suppliers of implementations of that language.
3:41:36
beach
Spawns_Carpeting: This features is essential for industrial use, because there must be some kind of guarantee that the interface does not change arbitrarily over time, thereby requiring clients to catch up with changes to the programming system.
3:42:23
Spawns_Carpeting
right beach I understand. dash is a library that adds many highly useful utility functions for lists. Examples are map, filter, remove, take, slice, reduce, min, max, some, any, split
3:42:25
beach
Spawns_Carpeting: That's why, in my talks to industry, I emphasize the importance of choosing languages with an independent standard, published by some credible standards organization, like ISO, ANSI, IEEE, etc.
3:43:03
beach
Spawns_Carpeting: All those are in standard Common Lisp, or can be had with a small amount of code.
3:44:39
Spawns_Carpeting
there are probably 100s of functions that dash provides but those are just the ones I could think of. s is basically the same idea but for strings. common lisps string handling felt a little weak when I used it
3:46:06
White_Flame
Spawns_Carpeting: everything in the sequences dictionary in the spec also applies to strings
3:46:45
Spawns_Carpeting
how can you check if a string only contains uppercase letters in cl? or what about checking if it starts or ends with a given substring?
3:48:23
hayley
(notany #'lower-case-p string) ; assuming you're okay with non-alphabetic characters too
3:50:25
Spawns_Carpeting
yeah alexandria sounds like what I am talking about. also uiop gives many helpful functions
3:50:28
beach
Spawns_Carpeting: This looks like an exercise it trying to find a function that Common Lisp doesn't have but that exists i s.
3:51:23
Spawns_Carpeting
my only point was that cl's built in string handling is a tad weaker than what you would get with say... python
3:52:15
White_Flame
and yes, people tend to make their own library of one-liners for stuff like this, tuned to whatever they happen to need for their project
3:53:15
White_Flame
you'll also find CL to have more of a mindfulness to using fewer resources, so for instance splitting & rejoining many temporary substrings isn't something normally done in the standard stuff
3:56:32
Spawns_Carpeting
fwiw I like lisp and moreso common lisp a lot. I don't want to be banished to elisp forever! lol
4:00:00
Spawns_Carpeting
i doubt that lisp libraries are an extremely common source of malware but you never know
4:01:26
White_Flame
I believe the only testing that is done is that all tests it includes must pass, and combinations of loads must work
4:02:45
White_Flame
however, CL in general is distributed in source form, and I haven't seen any obfuscated stuff in the wild. So it relies by default on openness in this security regard
4:07:00
jcowan
beach: It's not clear to me that C# is significantly less risky than Java, even though C# has a standard (ISO 23270) and Java does not.
4:08:52
beach
jcowan: In case it wasn't clear, I meant that a standard is a necessary (but not sufficient) condition.
4:10:22
White_Flame
well, a standard can't really do anything about library ecosystem malware anyway
4:10:38
hayley
I'd have to check the overlap between Java specifiers and Java implementors, but I suspect there is no overlap in people (but there would be an overlap in Sun/Oracle funding both).
4:12:21
beach
hayley: But by having the specification owned by a company means that they can attempt to sue people who use it in ways they don't like, as Google has experienced.
4:12:41
hayley
The Java 17 specification has James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Alex Buckley, Daniel Smith and Gavin Bierman. I know the first four wouldn't have touched JVM source - yes, true.
4:13:17
Spawns_Carpeting
I am actually not a huge fan of official standards wrt programming languages. I do think it's useful for truly industrial software though
4:13:38
beach
hayley: Of course if you are Google, you have enough means to fight it, but if you are a small company or an individual, there is no hope.
4:15:49
hayley
I think there is a catch-22 though; how do you get users, if the language should not be used until it is standardised? I assume that you won't bother standardising untill you have users.
4:17:45
waleee
by the amount of cash ISO et al wants for a copy of a standard I assume you also dont bother because of financial reasons
4:18:47
Spawns_Carpeting
that's one of the reasons I am not a fan of standardizing languages waleee. it also makes it much more difficult for common people to actually contribute to the standard
4:20:00
beach
Spawns_Carpeting: Oh, but you don't want "common people" to contribute to a language definition. They just don't have the knowledge of language design or compiler technology to understand the consequences of their "contributions".
4:20:46
beach
Spawns_Carpeting: We see attempts here pretty much every week of "common people" wanting to revise the Common Lisp standard, and often in ways that would then make it impossible for the compiler to generate efficient code.
4:20:50
hayley
Having some kinds of contributions, no matter the experience of the author, is still in conflict with having a standard which doesn't change.
4:21:22
jcowan
ISLisp, ST, and some other languages solved that problem by producing a pre-standard in the public domain
4:21:23
beach
Spawns_Carpeting: Maybe your projects are just a hobby, but Common Lisp is designed to be industrially viable.
4:22:24
Spawns_Carpeting
yeah I do see your point beach, but I am not advocating for introducing every random idea that a person comes up with either! I am a fan of how python handles this with "PEPs"
4:22:31
beach
waleee: I mean, what is the purpose of this tendency? Just to have an independent organization in charge of the language specification?
4:23:08
White_Flame
as long as there is a cut & published standard, as opposed to an arbirarily changing webpage, a spec is a spec
4:23:20
beach
Spawns_Carpeting: You just gave a fantastic example of a language that basically can't have a compiler that generates efficient code. I would definitely not want that for Common Lisp.
4:23:22
Spawns_Carpeting
there must be some minimum level of quality no matter what the case is, otherwise it's going to become a joke really fast
4:23:54
Spawns_Carpeting
yeah but I don't think that's because of it not having an official standard beach
4:25:15
Spawns_Carpeting
I hate to be the rust dude, but rust has a similar system where people can create rfcs on github, and the team decides whether they are worth considering or not
4:25:17
beach
Spawns_Carpeting: Sure it is. The official standard would preferably be established by a bunch of people who have knowledge and experience in language design and compiler technology. When you have "common people" establishing a specification, that's when you get aberrations like Python.
4:25:32
waleee
in the case of the rust foundation it seems unclear, they (by comments of different core developer groups) apparently isn't directly involved in the work
4:27:01
Spawns_Carpeting
the language devs and maintainers are still the "gatekeepers" in regards to quality, they just aren't "official" like legal standards committees are
4:27:10
White_Flame
Spawns_Carpeting: one unique thing about CL is that libraries can fundamentally change the language, without needing extra support from standard implementations for those features
4:27:13
beach
Spawns_Carpeting: The problem here is selecting the people who are capable of screening proposals. Apparently, for Python this is not done in a way that would be acceptable to Common Lisp, since they accept design that is impossible to implement efficiently.
4:28:15
Spawns_Carpeting
yup I agree 100% beach, screening is good, but I am not sure ISO standard committees are the best method of screening for talent
4:28:16
hayley
waleee: I recall Steve Klabnik found an article claiming that Rust followed principles used at Amazon, said that was definitely not the case, then some time later, he decided to ditch his book-writing efforts.
4:29:16
hayley
So I'm...not comfortable with the idea of having a group of large companies fund a language any more than I'd be with just one company. Though the funding isn't supposed to affect language decisions on paper.
4:29:20
beach
Spawns_Carpeting: I think you have an incorrect idea of how ISO (or ANSI) standard committees are created.
4:29:53
Spawns_Carpeting
I know it costs a non-trivial amount of money which is a non-starter for a large amount of the world
4:30:06
jcowan
It's only a historical accident that CL has a stable standard: most standards have a definite lifecycle
4:30:07
waleee
hayley: yeah, I saw that debacle, but there was some other rust teams that claimed that this wasn't the case, with varying degrees of plausability
4:30:50
Spawns_Carpeting
though participation I guess doesn't cost (or does it?), but I imagine it still requires traveling which is also not possible for everyone. I could be wrong about these things though and am welcome to being corrected :)
4:30:51
beach
jcowan: I am extremely grateful for that historical accident, and it is a large part of the reason it is my preferred language.
5:24:13
akater[m]
beach: Is there a collection of examples of Python features that prevent compiling it to efficient code, preferably with explanations? A blog entry, a book, an article, anything?
5:24:48
beach
I don't know. But I know that the one that allows you to add a slot to an instance is very problematic.
5:34:01
beach
I haven't looked at Python for a while, but as I recall, their "list" data type allows for insertion and deletion of elements at arbitrary positions, thereby changing the number of elements. Not sure if they introduced a more low-level sequence type since then.
5:35:36
beach
But that kind of "feature" makes the complexity of element access at least O(log n) worst-case.
5:48:18
beach
Or, rather, either the insert/delete operations take O(n) time in which case access can be O(1), or insert/delete/access all take O(log n) at least.
6:03:22
hayley
I remember the lecturer thought a Python list was a linked list and said "Ah, it's like Lisp..."
6:03:43
Spawns_Carpeting
don't all vectors allow for insertion into arbitrary locations? that would be weird to not support
6:04:20
Spawns_Carpeting
ofc you have to shift elements to insert like that, but that's just how vectors work
6:06:34
Alfr
Spawns_Carpeting, is it possible? Certainly, you just described how, but worst case it costs O(n^2) to insert n elements.
6:07:43
akater[m]
I don't get this example. Lisp lists also allow arbitrary insertion and deletion, and random access is expensive. So this doesn't explain how Lisp design was better than that of Python's.
6:57:08
akater[m]
Alfr: I know ≈nothing about Python. Only wrote a single Python script in my life. I was just wondering about language design principles.
6:57:08
akater[m]
I know it has explicit return, distinguishes between statements and expressions, makes it hard to write lambdas, one guy can change something in it in a breaking way, and it's extremely popular. In other words, I only know very bad things about it so I'm biased. Oh, and during my system updates, Python is the only source of trouble.
7:00:06
lisp123
Spawns* (can't get an automcomplete) - Check out Cl-PPCRE: CL-PPCRE is a high-performance regular expression library written on COMMON LISP. Benchmarks suggest that for most regular expressions CL-PPCRE is roughly twice as fast as Perl, often much faster. And Perl has one of the fastest non-lisp regular expression engines around: a highly optimised engine written in C. How is this possible? Surely Perl's low-level implementation should have
7:00:26
lisp123
How's that possible? Time to Learn Lisp ;) Ref: https://letoverlambda.com/textmode.cl/guest/chap4.html
7:08:01
hayley
lisp123: The answer is "compilation"; olde PCRE would interpret something to do with the regular expression, but CL-PPCRE would "compile" it to a chain of closures. It works okay, but now new PCRE with its own compiler is faster.
7:08:32
hayley
lisp123: I am biased, having written it, but https://github.com/telekons/one-more-re-nightmare is, as the name suggests, the second RE nightmare for Common Lisp.
7:11:27
hayley
As the README suggests, it can be up to 28× as fast on SBCL, and even up to 202× as fast on ECL (as it doesn't seem to do fast function calls, but the C compiler loves DFAs).
7:14:59
hayley
Sort of. Each pair of <regular expression × string type> has to be compiled, but it's cached. And, if runtime speed is less important than compile-time speed, I plan on implementing a "interpreter" which should still be faster than walking an NFA as CL-PPCRE does.
7:15:38
jackdaniel
high level languages may easily outperform low level ones when the task complexity raises -- less high-level code is easier to optimize by the programmer and high level constructs may hold more meaning to the compiler then a long list of separate instructions
7:16:21
jackdaniel
a cute example of that is format ~r, the task of printing numbers as names on some of code golf sites shows taht lisp is very fast with it (because it is part of the standard)
7:16:52
jackdaniel
while solutions written in c or other languages are slower (perhaps they could be on par, but that would require considerable amount of code)
7:17:32
hayley
It's a combination of things. gilberth gave me an algorithm to convert tagged regular expressions to DFAs, I then wrote a code generator, and then tweaked it until the assembly looked better.
7:19:39
hayley
The number of characters for which compilation + runtime of this engine is equal to that of cl-ppcre (assuming cl-ppcre compilation is free, which is approximately true).
7:20:03
hayley
Though I've now implemented the same LOAD-TIME-VALUE trick that CL-PPCRE uses, so it is irrelevant for constant regular expressions.
7:22:53
hayley
lisp123: It's quite simple to make a half-decent compiler for a DFA though; just write a PROG form (also, hence the name), label each state, and have a CASE form which GOes to the next state.
7:24:43
lisp123
hayley: Interesting, thanks for the info. I will dip my toes into learning more on it in due course
7:33:35
hayley
Eventually I want to get a bit more performance by using SIMD instructions for constant strings, and heisig has kindly added the necessary functions to SB-SIMD to make that work.
7:34:22
beach
akater[m]: The more "primitive" type in Common Lisp would be a vector. And in Common Lisp you can obviously easily use built-in functions to extend the size of a vector and move elements around.
7:38:24
beach
My point is that the programming language should contain implementations of the primitive types and then different libraries can make different compromises with respect to complexity of operations.
7:38:37
hayley
ACTION has had two kernel panics while trying to send that message, so lisp123 better read it.
7:39:35
beach
It should not be up to the language designer to have opinions on whether access should be O(1) and insertion/deletion O(n), or whether all operations should be O(log n).
7:44:04
hayley
No idea why. I mean, I get crashes every so often, but not two in the space of five minutes.
8:09:47
hayley
(I think I've almost gone full circle, as kingcons's excellent articles on compiling in cl-6502 motivated me to mess around with compiling on the fly, and he starred my repository today.)
8:09:56
hayley
(Maybe full circle would be to compile to 6502 assembly, then compile that to Common Lisp :)
8:35:10
ulfvonbelow
so I know for iterating over an arbitrary sequence (list or vector) I can use (map nil function seq1 ...), is there a standard way to iterate over a particular subsequence? So like (map nil ...) but with :start and :end arguments?
8:49:18
heisig
What is the rationale behind forge? Is it to overcome some problems of ASDF, and if so, which ones?
8:50:38
Shinmera
ASDF doesn't deal with version constraints, is by necessity in-process, can't distribute the build, and can only deal with Lisp, not other languages. It also has some other design problems that I don't like.
8:52:39
heisig
I agree with almost all these points. Except the one that ASDF can only deal with Lisp. I cheerfully build my C libraries with ASDF :)
8:53:42
Shinmera
the design, especially it forcing the cache of operation objects, is just not meant for it
8:54:30
heisig
If Forge is somewhat language agnostic, it would make an excellent replacement for CMake and the like. C++ is in dire need of a non-broken build system.
8:56:00
Shinmera
The lisp language module is about 100 lines at the moment. https://github.com/Shinmera/forge/blob/master/modules/lisp/lisp.lisp
8:57:09
Shinmera
I mean, eventually I'd like it to do everything, but we'll have to first see whether it scales at all
8:58:16
heisig
Ooh, there will be mods? That sounds awesome. Good luck with everything - I hear writing a reasonable build system is a breeze :)
9:05:12
hayley
(By the way, I took another stab at optimizing the table and it's within 15% or so of Java. But one of the things is to declare (safety 0), and I'd rather see what I need to remove from (safety 1) to make it safer.)
9:05:54
hayley
(No, I still don't have a proper way of testing tables, and I think my permission to use university servers is gone.)
9:06:51
hayley
I...have not factored in such a thing, but hypothetically it shouldn't cons unless resizing, and I don't think the benchmark provided with NBHM causes resizes that often?
9:08:54
hayley
Yes, right. And the Java compiler probably is a bit smarter when it warms up. FWIW I had to disable bounds checks on 42nd-at-threadmill, as SBCL didn't spot that (LOGAND INDEX (1- LENGTH)) closes INDEX under LENGTH.
9:09:31
Shinmera
Portacle is a project that has caused me a lot of pain, and I no longer have the mental strength to sustain more of it, so it stands unmaintained.
9:13:42
Qwnavery
I didn't even know you existed until now and your presence in the lisp community is huge. :/
9:15:43
Shinmera
Personally I think that's a far more impressive thing than the stuff I clobber together :)
9:16:42
hayley
Shinmera: From someone who was told not to be so hard on themselves yesterday: don't be so hard on yourself.
9:16:51
jackdaniel
as much as I agree with all the praise Shinmera receives, I feel obligated to remind about the channel topic
9:17:44
heisig
Praising Shinmera is very much on topic for this channel, isn't it? Then again, we can also carry our praises to #shirakumo :)
9:18:20
Shinmera
hayley: Actually I'm fairly certain SBCL does do bounds check elimination in some cases, eg when the vector length and index bounds are known.