libera/commonlisp - IRC Chatlog
Search
9:24:37
pve
mzan: I understand what you mean, but "decades after CL" is probably not an accurate statement
9:24:39
mzan
Josh_2: I made some toy projects in CL. Now I'm writing a live environment for a Knowledge-Base language, and maybe in future, assuming I will finish the first part, also for a compiler for a language based on attribute grammars
9:26:24
mzan
mariari: yes, static typing is useful, but it limits freedom. Sometime, you need freedom for expressing powerful things. I hope that with the serapeum approach, one can have both freedom and some safety. I will study it better.
9:27:54
mariari
if you look at my alucard codebase: https://github.com/anoma/juvix-circuits/tree/main/src you'll see most code written in this style, mostly purely functional with some mutation to get things done at the top and to setup the mixing of languages
9:28:12
mzan
Josh_2: the code is not packaged using ASDF, but this toy project https://gitlab.com/massimo-zaniboni/snow-assembler
9:28:29
mariari
but checkout the intermediate folder for the data layout and the pass folder for the various compiler passes, you simply can not do this style of development in ML, I'd argue this style is much safer than the ML approach as well
9:28:52
mzan
Josh_2: and these toys programs for benchmarking CL https://aoc-benchmarks.dokmelody.org/linux/overview.php
9:29:19
mzan
this code https://aoc-benchmarks.dokmelody.org/linux/program.php?test=aoc2021_day03b&lang=lisp&id=3
9:39:18
mzan
mariari: BTW, it is written in Scheme, but it can be ported to CL for sure. One of the best framework for specifying compilers is Nanopass. This an example of code: https://github.com/nanopass/nanopass-framework-scheme/blob/main/tests/compiler.ss
9:39:40
mzan
If you read the define-language parts, you see algebraic data types, and they are better than in Haskell, regarding the domain of PL.
9:40:43
mariari
the problem with the ML style of design is the typing makes them lose sight of the problem at hand, often you'll find giant passes as the rigidness of ML ADT's are simply too inflexible for real compiler work, and the approaches out of it (Tagless final, trees that grow, etc etc) are too hacky
9:41:33
mariari
yeah I've read their paper before it looks neat, never played with it personally, but I'm with them on smaller style of passes as they become more trivial to reason about, and prove if you really wanted to
9:45:35
mariari
the thing about lisps is that you have the freedom to define your own static analysis tools, as you have readily more access to the format of data if you so desire, writing tools in Generic in Haskell is a pain and encures some runtime costs, and since you can't augment the system you are stuck with what you are given
9:46:11
mzan
One minor detail of Nanopass, but that is wonderful, is that like in math/CS, you can specify new intermediate languages (IR) specifying only the differences respect the previous IR. It is a very compact notation. A lot better than Haskell notation, for this domain. Lisp is fun!
9:48:04
mariari
mzan: I don't use this in the code I sent since serapeum's default checker does not work with it, but you can do something similar with deftype (deftype modified-thing () `(or if (not cond) ast-with-cond))
9:48:31
mariari
mzan: I don't use this in the code I sent since serapeum's default checker does not work with it, but you can do something similar with deftype (deftype modified-thing () `(or if (and (not cond) ast-with-cond))) might need an and there
11:54:42
lisp123
mariari, I hate this ongoing perpetuation that CL is not functional - it is multi paradigm and generic functions are a way to merge an OO approach with the functional underpinnings of lisp
11:55:37
lisp123
The syntax of CL encourages a largely functional style as side-effects are isolated within functions
12:05:28
mariari
the funny thing about generic functions is that they would feel at home for those who come Haskell and its derivatives (they would call them type classes). But yeah I largely agree with your sentiment. The compilers nicely support the functional style speed wise as well
12:10:38
mariari
the only things that I've noticed lacking is that object equality I have to derive myself typically. Grabbing FSET is not a big deal in most circumstances when I want functional data structures
12:16:23
random-nick
the lack of a generic object equality test was an intentional choice, see https://www.nhplace.com/kent/PS/EQUAL.html
12:16:41
Equill
mzan: It looks like we have some interests in common beyond Lisp. This knowledge-base language: is it for automated reasoning/ML, or for human interaction?
12:17:22
mariari
yeah I've read about that before when I've brought up this, though I do have one issue with my equality strategy. Is there a generic way to grab the fields of structs I know c2mop can do it but that is undefined behavior
12:18:57
mzan
Equill: it is far for being publishable, so I don't like to discuss details. But I can listen you ;-) BTW, it is for human interaction, and it is a simplified version of RDF, OWL, Datalog and so on. You use it only for specifying basic relationships between chunk of data. All other functionalities had to be in ad-hoc systems.
12:21:35
Equill
mzan: We should take this into #lisp-cafe, but we definitely have a shared interest there. My IT-infrastructure management thing turned into a KMS engine that happens to be useful for managing IT infrastructure :)
12:34:28
mzan
random-nick: regarding https://www.nhplace.com/kent/PS/EQUAL.html nice lecture, but I note that objective-C and other similar OOP languages solved this problem better. They have weak and strong references. If you copy/clone an object, you copy the weak references
12:34:49
mzan
(i.e. they remain reference to the same object), while you copy/clone the strong references
12:35:15
mzan
If you compare two objects they are the same if they share the same exact weak references
12:38:01
_death
the point of that article is that equality and copying are context dependent.. if you pick some definition without consideration of context it may appear arbitrary and unsuitable.. you're just saying they picked one
12:38:53
mzan
annotating strong and weak references in an OOP hierarchy, can solve this problem, or it can help a lot. But I'm sure that or I can extend CLOS with this functionality, or there is already a library doing this, or maybe it is already part of the standard
12:40:13
_death
again, it does not solve the problem, unless you also provide a context (the article uses the term "intent")
12:42:21
_death
I've not heard of it (in those terms).. to me strong and weak references are related to garbage collection
13:14:58
_death
anyway, it's easy to imagine that there could be some language to define such semantics, like say (define-copy-semantics my-context (another-context) :deep ((class1 slot1)) :shallow ((class1 slot2))) or something.. but then it may be easier (and more general) just to the define the specific operation procedurally
13:57:15
mzan
_death: you are right. Nowdays weak reference means usually a garbage collectable reference. Deep and shallow are better terms. In a GUI toolkit, a reference is deep if the slot point to an object owned by a container. It is shallow if it is a link to an external object. So a Document object owns its paragraphs, but it can have links to the author, and to the page format.
13:57:38
mzan
If you clone/copy the document, you deep clone the paragraphs but not the autor or page format descritpion.
13:59:14
mzan
If you model some OOP hiearchy with these annotations, it is easier to reason about what is copy and what is equal. Maybe not in all cases, but in a lot of them. For CL lists, hash-tables and other data structures, the problem remain.
14:04:28
mzan
It is a part <--> owner relationship. The author of a document is not a part of a document, while a paragraph is a part of a document.
14:06:46
_death
possibly a frame representation language can provide more hints about the context, since it can support more relations than is-a/has-a
14:08:52
_death
but ideally a context can be supplied ad hoc, if a general mechanism of copy/equal is assumed
15:43:42
kakuhen
Your multiple threads might be ran on distinct cores, or they won't. It depends what your OS scheduler does
19:05:03
nij-
kakuhen hmmm but there are some languages that do not run on multiple cores, if I understand correctly (e.g. python)
19:08:56
mfiano
That effectively means one OS thread can only be executing something at any given time
19:15:41
mfiano
A lot of Python people tend to just FFI out to C for that sort of heavy lifting, or compute with multiple OS processes with some stdlib API. It's literally been about 20 years since I used Python, and it hasn't changed much since then, relatively speaking.
19:19:38
Fade
when I was still a python programmer, the GIL caused my general interest in message passing architectures.
19:21:56
mfiano
Which is why it would have made more sense, with it adopting the actor paradigm from what I remember.
19:23:17
nij-
"That effectively means one OS thread can only be executing something at any given time"
19:23:18
mfiano
I saw Fare reply to my message in here just the other day, so I know he still comes around.
19:26:29
Bike
most lisps do more compilation than interpretation, so you're not gonna have a grand interpreter lock or whatever it is GIL stands for
19:29:07
mfiano
I don't know how it works, but it sounded like some kind of mutex that prevents only 1 thread from entering the runtime to give results and receive more work, or something like that.
19:30:23
mfiano
It's the subject of a lot of controversy, but the CMUCL Python is a better topic anyway.
19:37:08
mfiano
Oh, by the way, in case it wasn't clear from not being in the other Lisp channels I frequent, as of yesterday, I'm back to making libraries in CL. I cannot consider Julia as a serious language anymore, for it has deceived me after 7 years of research.
19:41:49
Fade
from my memory, the interpreter runs in one system process, and all threading inside that process is scheduled by the python interpreter as 'green' threads.
19:42:06
Fade
this may have changed in the past ten years, because it was a pain point even ten years ago.
19:42:54
mfiano
I want to say that it is too pragmatic, but that sounds wrong. Basically, it took shortcuts, and the memory model of the host leaks in, in very unexpected and surprising ways. The most surprising part though, is only after 7 years of following Julia's evoluation, did I just learn that the core team has generally agreed to follow C++'s memory model. To use Julia effectively, you not only have to
19:42:55
mfiano
know Julia, but how the different passes of the Julia compiler work, the semantics of the C++ memory model, particularly the undefined behavior, and the behavior employed by LLVM, which is surprising even for undefined.
19:45:02
Fade
I'm glad you're back, mfiano. sorry for all the tooling entropy you seem to have been experiencing.
19:46:31
mfiano
That is true. I am disabled and a hobbyist programmer. So I have time to learn new things.
19:47:20
mfiano
It is disappointing, yes, but I do enjoy CL, with its many warts and all, so I am not as disappointed as I am glad to be back.
19:49:59
mfiano
The truth is, I needed new scenery, both on the computer and IRL, due to trying to manage some mental health issues. But that seems to be under control now.
19:51:35
mfiano
Said issues probably resulted in a very bleak image painted of CL in my recent blog article. I apologize for that.
19:54:20
mfiano
Now that I got that situation under control that was really affecting my life and making it hard to think clearly, I actually enjoy programming. I feel like I got a ton of code written for a new CL project today, with 130 tests passing. Something I would have struggled with a couple months to a couple years ago.
19:56:45
mfiano
It's a secret experiment. I don't even know if it will work out as a cohesive whole yet, so I'm not going to talk about it. It's just a bunch of sketches in my notebook and a fragment of code at this point.
20:29:25
nij-
I wonder are there JS code that are hard to be written from parenscript (up to semantic equivalence)?
20:30:01
Josh_2
is it es6 idk but the shorthand for things like promises doesn't exist which is very annoying
20:49:42
varjag
when using SORT on a list, there's no guarantee in the language that it's going to do that by rplacd'ing around the same cons cells, right?
20:58:33
NotThatRPG
Does anyone have a recommendation for a portable CL random number generator? It doesn't have to be brilliant, but I want something that will let me have replicable results across implementations when I supply a seed -- otherwise I need to write different tests for different implementations, which is painful
20:59:46
NotThatRPG
I suppose I could just make a mock RNG for use in testing, but without something like a portable ADVISE that seems strictly harder than finding a portable random library.
21:05:55
NotThatRPG
Thanks! I had used cl-random before, but would prefer something that is maintained.