Nilby has quit [Read error: Connection reset by peer]
hiroaki has joined #lisp
EvW has quit [Ping timeout: 260 seconds]
matryoshka has joined #lisp
todun has quit [Quit: todun]
miasuji has quit [Ping timeout: 240 seconds]
todun has joined #lisp
EvW has joined #lisp
defunkydrummer has quit [Quit: Leaving]
parjanya has joined #lisp
zulu-inuoe has quit [Read error: Connection reset by peer]
Oladon has quit [Quit: Leaving.]
skapata has quit [Remote host closed the connection]
todun has quit [Quit: todun]
hiroaki has quit [Ping timeout: 272 seconds]
hendursa1 has joined #lisp
hendursaga has quit [Ping timeout: 240 seconds]
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
igemnace has quit [Remote host closed the connection]
nij has joined #lisp
<nij>
For my need so far, I find DEFSTRUCT nice enough. However, CLOS seems to be the full-fledge + superior stuff one ultimately should use. It is a bit involving though. Would someone explain (just a bit) what I am missing by using DEFSTRUCT but not CLOS?
<no-defun-allowed>
Arguably structure-classes are part of CLOS, as is any other class, but standard-classes allow for multiple inheritance, and the accessor names provided are generic functions.
<Bike>
multiple inheritance, more control over accessor names, ability to extend the object system, uhhhhh what else
<Bike>
yeah generic accessors is a big one
<no-defun-allowed>
You can also subclass standard-class to work with the meta-object protocol, which in the words of Tony Visconti, "fucks with the fabric of time".
hiroaki has joined #lisp
<Bike>
oh and you can redefine classes
<Bike>
that's pretty nice
<no-defun-allowed>
That is also convenient, yes.
igemnace has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
miasuji has joined #lisp
wxie has joined #lisp
jprajzne has quit [Quit: jprajzne]
miasuji has quit [Ping timeout: 260 seconds]
<nij>
wow i have no idea what these means
<nij>
just learned about generic functions, but pretty much it..
<nij>
I mean.. I know what they mean, but I cannot tell why they are good.
<nij>
Perhaps I need to get involved in some projects that naturally require those.
<no-defun-allowed>
You can use generic functions with structure classes, but supposing you have (defstruct thing foo) then THING-FOO is not generic. The THING-FOO generated by (defclass thing () ((foo ... :accessor thing-foo))) is generic.
<oni-on-ion>
however making structs makes classes
<no-defun-allowed>
You also get CHANGE-CLASS with standard instances, which has its uses.
<nij>
I have recorded the buzzwords.. will learn.
<nij>
Sorry folks @@"
lotuseater has joined #lisp
nij has quit [Ping timeout: 268 seconds]
<mfiano>
CLOS is better for prototyping, which falls under just about all of the reasons above
<mfiano>
shared-initialize, and therfor initialize-instance etc and the big ones for me.
troydm has quit [Ping timeout: 246 seconds]
troydm has joined #lisp
jprajzne has joined #lisp
luckless has quit [Remote host closed the connection]
luckless has joined #lisp
rumbler31_ has joined #lisp
jprajzne has quit [Quit: jprajzne]
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 260 seconds]
Lord_of_Life_ is now known as Lord_of_Life
jibanes has quit [Ping timeout: 246 seconds]
jprajzne has joined #lisp
notaname has joined #lisp
jibanes has joined #lisp
rumbler31_ has quit [Ping timeout: 260 seconds]
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
Necktwi has quit [Ping timeout: 246 seconds]
karlosz has joined #lisp
quazimodo has quit [Ping timeout: 264 seconds]
bilegeek has joined #lisp
quazimodo has joined #lisp
EvW has quit [Ping timeout: 268 seconds]
Necktwi has joined #lisp
miasuji has joined #lisp
toorevitimirp has joined #lisp
toorevitimirp has quit [Remote host closed the connection]
toorevitimirp has joined #lisp
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #lisp
jeosol has quit [Remote host closed the connection]
jibanes has quit [Ping timeout: 264 seconds]
jibanes has joined #lisp
jprajzne has quit [Quit: jprajzne]
zstest3[m] has quit [Ping timeout: 268 seconds]
etimmons has quit [Ping timeout: 268 seconds]
santiagopim[m] has quit [Ping timeout: 268 seconds]
solideogloria[m] has quit [Ping timeout: 268 seconds]
katco has quit [Ping timeout: 268 seconds]
solideogloria[m] has joined #lisp
jprajzne has joined #lisp
santiagopim[m] has joined #lisp
katco has joined #lisp
zstest3[m] has joined #lisp
etimmons has joined #lisp
pfdietz has quit [Ping timeout: 245 seconds]
rumbler31_ has joined #lisp
<aeth>
it's for polymorphism
<aeth>
(whatever 42) vs. (foo-whatever 42) and (bar-whatever 42) and (baz-whatever 42)
<aeth>
There are other ways to get what you want, including libraries that implement alternative generic systems, but probably just something like a TYPECASE.
<no-defun-allowed>
You can specialise on structure-classes.
<aeth>
Note, though, that a TYPECASE isn't as flexible since adding to it requires recompiling the function.
notaname has quit [Ping timeout: 260 seconds]
<aeth>
no-defun-allowed: yes, and you can also get foo-whatever, bar-whatever, and baz-whatever through things other than structures
<aeth>
It's harder to get one WHATEVER, though
<aeth>
Without DEFGENERIC/DEFMETHOD, I mean
hendursa1 has joined #lisp
orivej has joined #lisp
hendursaga has quit [Ping timeout: 240 seconds]
<thmprover>
Say, is there any subtleties I should be aware of with ABCL?
surabax has quit [Quit: Leaving]
<thmprover>
I may be forced to use a language targetting the JVM, and I think ABCL may be fun to work with...assuming, y'know, it doesn't have any horrible gotchas.
<no-defun-allowed>
To my knowledge, there aren't any problems with ABCL. On the contrary, it helped me find bugs in my code, as I relied on some behaviour (somewhere in the MOP) that other implementations had.
<srandon111>
no-defun-allowed, don't do that
kaftejiman has quit [Remote host closed the connection]
Misha_B has joined #lisp
<no-defun-allowed>
srandon111: Yes, I try not to do that.
<aeth>
I suppose the main problem with an obscure implementation like ABCL is that by the time you intersect a lot of libraries if you have dozens, even though they all support many implementations, you'll probably wind up with just SBCL and CCL and maybe ECL as supported implementations.
<aeth>
The likelihood of every dependency-of-dependency supporting ABCL (once such a list grows to hundreds) is low
<aeth>
CLISP has similar issues here, even though it was incredibly popular 10 years ago.
<thmprover>
Well, I'm probably going to have to interop with the Java ecosystem; the other guy wants to use Scala, so I'm trying to meet him half way.
<no-defun-allowed>
There aren't that many libraries that don't have a #-(or sbcl clozure) ... if they do implementation-specific stuff.
<aeth>
no-defun-allowed: everything has to *work*, though.
hiroaki has quit [Ping timeout: 268 seconds]
hiroaki has joined #lisp
<aeth>
no-defun-allowed: My game engine's probably one of the worst cases because it has to FFI, but a long time ago I tested it in Roswell on basically every implementation (it doesn't have MKCL and I didn't test the commercial ones) and it only ran in SBCL, CCL, and ECL... and in ECL it ran so slowly that it was a slideshow.
<aeth>
Also, a lot of the time the #-(or sbcl clozure) path isn't just a slow path, it just plain doesn't work.
<aeth>
The most notable is probably bordeaux-threads, whose portable path mostly seems to be implemented as ERRORs, but fortunately that one in particular runs on most implementations.
jibanes has quit [Ping timeout: 260 seconds]
jibanes has joined #lisp
jibanes has quit [Ping timeout: 256 seconds]
Stanley00 has joined #lisp
jibanes has joined #lisp
Oladon has joined #lisp
rumbler31_ has quit [Ping timeout: 268 seconds]
entre-pa` has joined #lisp
entre-parenteses has quit [Ping timeout: 260 seconds]
rumbler31_ has joined #lisp
<moon-child>
aeth: isn't there a portable cffi abstraction thingy?
<aeth>
moon-child: Yes
<aeth>
moon-child: But CFFI itself is rarely the only library used. For instance, while CFFI supports CLISP, static-vectors (a library for an easier way to do foreign arrays with CFFI) does not. That's not the only implementation that it doesn't support, either.
<aeth>
Now intersect the supported implementation of every library that's a dependency (and CFFI stuff just make it more likely for this to be the case) and you'll probably just wind up with SBCL and CCL once you add enough.
jibanes has quit [Ping timeout: 246 seconds]
jprajzne has quit [Quit: jprajzne]
<aeth>
On the one hand, it's unlikely. On the other, if you aren't selective about dependencies-of-dependencies, then you can easily wind up with enough to make the improbable probable.
jibanes has joined #lisp
sharo has joined #lisp
<aeth>
ABCL doesn't seem to be that bad in library support, though. It supports the example library (static-vectors) and it supports package-local-nicknames (which is probably the most likely thing to exclude niche implementations)
jprajzne has joined #lisp
jibanes has quit [Ping timeout: 264 seconds]
jibanes has joined #lisp
<Aurora_v_kosmose>
Any semi-obvious reason uiop:getenv would be unable to get any variables when compiled into an executable?
<Aurora_v_kosmose>
I'm going to assume my copies of asdf/uiop are outdated, sb-ext:posix-getenv works just fine.
<Aurora_v_kosmose>
So much for portable APIs though.
Kaisyu has joined #lisp
flip214 has quit [Ping timeout: 240 seconds]
jprajzne has quit [Quit: jprajzne]
jibanes has quit [Ping timeout: 246 seconds]
sharo has quit [Remote host closed the connection]
flip214 has joined #lisp
Alfr_ has joined #lisp
jibanes has joined #lisp
jprajzne has joined #lisp
Alfr has quit [Ping timeout: 260 seconds]
jprajzne has quit [Quit: jprajzne]
flip214 has quit [Ping timeout: 240 seconds]
flip214 has joined #lisp
Aurora_v_kosmose has left #lisp ["found it, I messed up"]
thmprover has quit [Quit: For He Was Great of Heart]
sharo has joined #lisp
jibanes has quit [Ping timeout: 240 seconds]
jibanes has joined #lisp
jprajzne has joined #lisp
jibanes has quit [Ping timeout: 260 seconds]
jibanes has joined #lisp
beach has joined #lisp
<beach>
Good morning everyone!
jibanes has quit [Ping timeout: 246 seconds]
narimiran has joined #lisp
jibanes has joined #lisp
rumbler31_ has quit [Ping timeout: 260 seconds]
wxie has quit [Ping timeout: 272 seconds]
jibanes has quit [Ping timeout: 240 seconds]
sharo has left #lisp ["ERC (IRC client for Emacs 27.1)"]
notaname has joined #lisp
jibanes has joined #lisp
ex_nihilo has joined #lisp
ldbeth` has joined #lisp
entre-pa` has quit [Quit: ERC (IRC client for Emacs 27.1)]
jprajzne has quit [Quit: jprajzne]
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #lisp
bilegeek has quit [Quit: Leaving]
wxie has joined #lisp
Bike has quit [Quit: Lost terminal]
akoana has left #lisp ["Leaving"]
miasuji has quit [Ping timeout: 260 seconds]
jprajzne has joined #lisp
<srandon111>
Hello beach!!!!
* srandon111
hugs beach!
* srandon111
tells beach to prepare some breakfast
* srandon111
asks where is beach
<beach>
Bordeaux.
<srandon111>
beach, cool!
<srandon111>
beach, let's prepare some breakfast in lisp
<ldbeth`>
good afternnon
<beach>
Hello ldbeth`.
<srandon111>
ldbeth`, where are you ??? afternoon ?
<srandon111>
i was having breakfast with beach
<ldbeth`>
srandon111: GPT+8
<srandon111>
ldbeth`, damn
<srandon111>
japan?
<srandon111>
or something like that
<ldbeth`>
china
<srandon111>
some russian republic ldbeth`
<srandon111>
china?
<srandon111>
that's crazy
bitmapper has quit [Quit: Connection closed for inactivity]
<beach>
srandon111: There are people from all over here. You'll learn after a while who is where.
<srandon111>
ldbeth`, well we were having breakfast, do you want to join ?
* srandon111
offers breakfast to ldbeth` and some jiao zi
<ldbeth`>
sure , why not
<srandon111>
ldbeth`, jiao zi is my favorite food
<beach>
Let's stick to the topic, please.
<srandon111>
beach, wait which topic? we were talking about our breakfast
<srandon111>
no discussion was ongoing
jprajzne has quit [Quit: jprajzne]
<easye>
We try to restrict ourselves to discussing Common Lisp here.
<easye>
We tyr to use #lispcafe for more pure socializing.
<srandon111>
easye, ok thanks for suggestion
jibanes has quit [Ping timeout: 246 seconds]
phoe6_ has joined #lisp
<beach>
So, apparently, I started writing SICL FORMAT some 12 years ago, and I am only now getting prepared to use it as native SICL code. I am looking for an experienced Lisper who might want to extract this module to a separate repository, maintain it, supply the code for the remaining directives, document it, etc.
jprajzne has joined #lisp
<beach>
My coding standard have changed the past 12 years, so there may be some updates as well, even to code that is working.
jibanes has joined #lisp
<beach>
FORMAT was one of the first modules I wrote, I think.
charlie770 has joined #lisp
waleee-cl has quit [Quit: Connection closed for inactivity]
<srandon111>
beach, what's SICL ?
<beach>
minion: Please tell srandon111 about SICL.
<minion>
srandon111: 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
<no-defun-allowed>
minion: tell srandon111 about SICL
<no-defun-allowed>
😳
<srandon111>
thanks minion
<beach>
minion: Thanks!
<minion>
no problem
jprajzne has quit [Quit: jprajzne]
mrcom has quit [Read error: Connection reset by peer]
mrcom has joined #lisp
ramenbytes has joined #lisp
mrcom has quit [Client Quit]
mrcom has joined #lisp
jprajzne has joined #lisp
ramenbytes has quit [Remote host closed the connection]
<beach>
It looks like the entire FORMAT module is around 2kLOC, comments excluded, so it's not very big. But it needs to be split up into smaller files, perhaps one file per directive.
amenbytesr has joined #lisp
ldbeth` has quit [Ping timeout: 265 seconds]
<lotuseater>
beach: did you get the ideas on how to write all SICL code from looking at other implementations? (may be a bit rhetorical question)
<lotuseater>
yes i have format.lisp file open, a big one :)
<beach>
Yeah.
<beach>
lotuseater: Only very briefly. But I knew that my ideas weren't going to be acceptable to maintainers of existing implementations, so there was only one option.
amenbytesr has quit [Remote host closed the connection]
ramenbytes has joined #lisp
<lotuseater>
yes ok, very impressive knowing the whole language in so much depth
<beach>
lotuseater: Even the implementation that is bootstrapped using essentially only an existing Common Lisp implementation, i.e. SBCL, has a compiler that is written without the use of generic functions or standard classes (or so I have been told).
<beach>
And I wanted to use first-class global environments, which is another radical departure from how existing implementations work.
<beach>
lotuseater: Don't think for a second I knew it all when I started. :)
<lotuseater>
ok, so there's still hope for me :)
<beach>
Yes, give it a decade or two.
<lotuseater>
what is this acclimation the sicl-format.asd file states to depend on?
<beach>
It's a little thing that allows you to internationalize things, like error messages, etc.
<lotuseater>
yes and in three decades I can work with you all on the first real AI which then enslaves humanity ^^'
<lotuseater>
ah okay
jprajzne has quit [Quit: jprajzne]
<beach>
I haven't had time to work on it very much, but the ambition is to provide functionality for end-user applications, so that they can just say "present this value as an oven temperature" or "present this value as an ambient temperature", and the library will figure out the unit, and the precision.
Oladon has quit [Quit: Leaving.]
jprajzne has joined #lisp
<beach>
Like you don't want your application to say "Then set your oven to 274.2342355°C"
<beach>
Oven temperature in °C is usually rounded to 5°C, and may 10°F. Ambient temperature to an even number, both for °C and °F.
<beach>
So you can't use the same code for the two kinds of temperature.
<lotuseater>
haha yes our oven just has marked 50 Kelvin steps ^^
<lotuseater>
i see
<ramenbytes>
Isn't that the same as 50 centigrade steps?
<beach>
Same thing for (say) driving distance.
<beach>
lotuseater: It is usually 5° steps for °C.
<lotuseater>
will the sicl format be extensible? or did i miss something?
<beach>
Actually, you are right, maybe it's really 25°C.
<lotuseater>
ramenbytes: yes it is, but Kelvin is basic physical unit :P
<beach>
lotuseater: Oh yes, definitely.
<ramenbytes>
lotuseater: Fair.
jprajzne has quit [Client Quit]
<lotuseater>
that's great, so documentation should state in a reasonable way the interface
jprajzne has joined #lisp
<beach>
lotuseater: Are you talking about FORMAT now?
<beach>
If so, yes, definitely.
<lotuseater>
yes
<lotuseater>
as long as the standard is there as specified nothing stops from extensibility to have
<beach>
This FORMAT module is very likely unique in its implementation, because it uses standard classes and generic functions. Even the PROGN method combination apparently.
<ramenbytes>
beach: What drives that approach?
<beach>
ramenbytes: "drives"?
<ramenbytes>
beach: Sorry, what is the motivation for the unique approach.
<beach>
It seemed like the best way to do it.
<lotuseater>
never used PROGN mc yet, but i think i know how it works
<beach>
ramenbytes: As it turns out, I am unable to keep in mind a subset of Common Lisp to use for each module, so I just decided to make it possible to use the full language for each one.
<ramenbytes>
beach: haha, that certainly wipes out the issue.
<beach>
ramenbytes: It made bootstrapping a bit harder :)
<beach>
But I think I figure that part out.
<ramenbytes>
beach: I guessed as much. What were the sticky parts?
<beach>
Making things like (defclass t () () (:metaclass built-in-class)) operational.
<beach>
But it has already paid off.
<ramenbytes>
That has circularity issues right?
<beach>
Yes, built-in-class is a subclass of class, metaobject, standard-object, and T.
jonatack has quit [Read error: Connection reset by peer]
<beach>
So for built-in-class to exist, T must already exist.
<lotuseater>
and how is the class for T basically defined?
<beach>
I suspect most Common Lisp implementations use (a possibly modified version of) PCL.
<beach>
lotuseater: I just showed you: (defclass t () () (:metaclass built-in-class))
Kaisyu has quit [Quit: Connection closed for inactivity]
<lotuseater>
oh sorry, i was blind
<beach>
And PCL is really kludgey when it comes to bootstrapping and avoiding metacircularity problems. So I wanted something more idiomatic.
<ramenbytes>
lotuseater: I missed that too.
<ramenbytes>
beach: I've heard PCL has some inefficiencies in it. Does that come from the kludges?
<lotuseater>
could you give me a hint what PCL is in this context?
<beach>
ramenbytes: I suspect what you have heard is that the generic dispatch is slow. T
<beach>
That's why I invented a better technique.
<ramenbytes>
lotuseater: Portable Common Loops I think.
<beach>
Yes, "Portable Common Loops"
jonatack has joined #lisp
<lotuseater>
ahhh, now i get it
<beach>
A mostly-portable library that allows a pre-ANSI Common Lisp implementation to "bolt on" CLOS.
charlie770 has quit [Quit: thatsit]
charlie770 has joined #lisp
<ldbeth`>
and Common Loops was one of the popular Object systems pre ANSI
<beach>
But I wanted to start with CLOS so that I could use its features for the rest of the system.
<ramenbytes>
beach: Is your technique detailed in one of the papers from the SICL repo?
<beach>
So that I can write (defclass symbol () ((%name ...) (%package ...)))
vegansbane6 has quit [Ping timeout: 240 seconds]
<beach>
ramenbytes: Yes, the dispatch technique is documented.
<beach>
The bootstrapping technique, not so much (yet).
<ramenbytes>
Cool, I think found the dispatch paper.
<beach>
There is a paper, but I fear it is incomprehensible.
<beach>
[the one about bootstrapping, I mean]
<ramenbytes>
Guess I'll find out.
<ramenbytes>
Ah, I thought you meant the dispatch.
<beach>
No, that one should be straightforward.
<ramenbytes>
Ok, I'll add to my reading list.
<beach>
I presented it at ILC in Montreal, and the chairman (having not read the paper) told me that my technique was "trivail" and merely "an inline cache".
<beach>
But the point of the paper is how to manage the inline cache so that obsolete instances do not have to be tested for explicitly.
<beach>
Unfortunately, I am a slow thinker, so I didn't have the presence to counter something like "did you even read the paper, buddy?"
<ldbeth`>
gg
<ramenbytes>
From a quick scan of the paper, you compare an id number in the instance with the official class id?
<ldbeth`>
with the custom hashtable optimization, with 2 min 238,000 words can be loaded
<ldbeth`>
for the spell checker
<ldbeth`>
i think sxhash might be too slow if only eq comparsion is considered
<beach>
ramenbytes: Yes, and the point is that the class ID is a small constant in compiled code and the instance ID is in a register.
<beach>
ramenbytes: Whereas PCL uses a (specialized) hash table in memory, which was probably fine at the time it was invented.
<ramenbytes>
Hmm, that does sound faster.
aartaka has joined #lisp
<ramenbytes>
The registers I mean.
<beach>
ramenbytes: The thing is that all existing Common Lisp implementations started life many decades ago, and the reality of processor speed vs memory speed has changed since.
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
<ramenbytes>
beach: So it's gone from memory being faster to the processor being faster?
<ldbeth`>
is there a function that can get object id on CCL?
<beach>
I guess at the time, the speed was comparable. Now the difference is a factor 10-100.
<ramenbytes>
I can see why you wanted an alternative.
<beach>
Thanks.
<beach>
So taking an existing Common Lisp implementation and adapting it to the reality of modern processors would be even harder than to start from scratch.
<beach>
Especially given all the other things I wanted to change as well.
jprajzne has quit [Client Quit]
<beach>
First-class global environments, using more generic functions and standard classes, ...
<ramenbytes>
Yeah, lots of neat stuff.
<beach>
Thanks!
srandon111 has quit [Ping timeout: 260 seconds]
<ramenbytes>
Thanks for doing the work on it.
<ramenbytes>
Got to go, thanks for the info.
<beach>
Take care.
<ramenbytes>
You too.
ramenbytes has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 256 seconds]
andreyorst` has joined #lisp
andreyorst` has quit [Remote host closed the connection]
srandon111 has joined #lisp
srandon111 has quit [Client Quit]
saganman has quit [Quit: WeeChat 1.6]
charlie770 has quit [Ping timeout: 256 seconds]
charlie770 has joined #lisp
ldbeth` has quit [Remote host closed the connection]
<lotuseater>
|=
<lotuseater>
oh sry wrong window o.O
aartaka_d has joined #lisp
wxie has quit [Ping timeout: 256 seconds]
aartaka has quit [Ping timeout: 264 seconds]
aartaka_d has quit [Ping timeout: 240 seconds]
frost-lab has joined #lisp
charlie770 has quit [Ping timeout: 268 seconds]
pankajsg has joined #lisp
wxie has joined #lisp
aartaka has joined #lisp
galex-713 has quit [Ping timeout: 272 seconds]
hiroaki has quit [Ping timeout: 268 seconds]
hiroaki has joined #lisp
<lotuseater>
how are your experiences translating c code to CL?
<beach>
Just in order to execute it, or in order to maintain the Common Lisp version?
<beach>
For the former, froggey came up with a solution that is used to execute C code in Mezzano.
<lotuseater>
hm i mean the process of translating
<lotuseater>
let's say the C code doesn't change
<lotuseater>
oh cool
<beach>
lotuseater: Sure, but it depends on whether you want the result to be readable and modifiable.
aartaka_d has joined #lisp
<lotuseater>
yes you're right
<beach>
What froggey did, does not address that point, I think.
aartaka has quit [Ping timeout: 240 seconds]
<lotuseater>
a friend of mine told me yesterday (while we talked about X window managers like xmonad and stumpwm) that actual X support will run out in the future, so i'm peeking into wayland codebase (which seems quite readable) and tried translating some stuff to get a feeling
jeosol has joined #lisp
<lotuseater>
my C knowledge is quite nonexistent but gets better. i mean we there is CLX so it would be nice to have wayland in CL in the future, and it does not seem so heavy
<jackdaniel>
I think that there is a wayland client in cl
<jackdaniel>
but I don't remember details
treflip has joined #lisp
<lotuseater>
ah good to know
<lotuseater>
i was just experimenting :)
<jackdaniel>
also if I were to write a wayland client, I'd look straight into the wire protocol
<jackdaniel>
afair it is quite language agnostic, so you won't be bothered with C-imposed boilerplate
gaqwas has joined #lisp
<lotuseater>
yes you're right ... it's exhausting. had the same some days ago with (horrible written) numerical stuff
<jackdaniel>
the only non-portable part I think was opening the unix socket, but that's covered by usocket (via implementation-specific extensions)
random-nick has joined #lisp
<jackdaniel>
binary-types would come handy I suppose (to define "packets"/"messages" or whatever they call them)
* jackdaniel
goes afk
<lotuseater>
okay thx, see ya
<splittist>
Wayland string primitives seem to have a length prefix and a NUL terminator...
<lotuseater>
and is that good or bad?
<splittist>
Just a thing. I guess it's indicative of the C-ness of the modern world. X had symbols and was very lispy (for obvious reasons).
vegansbane6 has joined #lisp
aartaka has joined #lisp
aartaka_d has quit [Ping timeout: 264 seconds]
flip214 has quit [Read error: Connection reset by peer]
imode has quit [Quit: Bats are people too!]
flip214 has joined #lisp
nostoi has joined #lisp
skapata has joined #lisp
phireh has joined #lisp
shka_ has joined #lisp
liberliver has joined #lisp
jello_pudding has quit [Ping timeout: 272 seconds]
atomik_dog has joined #lisp
Guest6090 has quit [Ping timeout: 260 seconds]
mathrick has quit [Ping timeout: 240 seconds]
mbomba has joined #lisp
jello_pudding has joined #lisp
rgherdt has joined #lisp
nij has joined #lisp
<nij>
Nontechnical question.. I'm obviously stepping toward the cult of lisp (if it is). Are there any articles that delicately argue why lisp is not as good?
<phireh>
It wouldn't be hard to find some complaining about the syntax
<nij>
They are not using the correct IDE, which AFAIK is probably why lisp is not popular.
<no-defun-allowed>
The History of Smalltalk mentions that Lisp (and Smalltalk for some reason) "eat their young", by making you sometimes stick with an old paradigm because it's sufficiently powerful, instead of making a new paradigm which explains it better.
<no-defun-allowed>
moon-child: I think it's a very bad problem that fragmentation is seen as a problem, when it is all but necessary to actually get anywhere; and that it is seen (particularly by Winestock) as preventing cooperation or communication.
nij has quit [Remote host closed the connection]
<nij>
moon-child: Does this praise lisp in another way, and explain its unpopularity?
<phoe>
good morning
<no-defun-allowed>
nij: No, and no.
nij has joined #lisp
<moon-child>
no-defun-allowed: fragmentation may not be an intrinsic problem, but it is, at least in part, responsible for some of lisp's lack of popularity
<moon-child>
no-defun-allowed: nij missed your message
<no-defun-allowed>
I tried my best to throw it into a metaphorical woodchipper with the better part of one chapter of the book I'm writing.
<nij>
errghhh diss my router :(
<no-defun-allowed>
moon-child: The alternative is stagnation, and if that's what we get, then I don't want to write Lisp anymore.
<nij>
@@ so is there any nice complaints
<nij>
(I want to say there's NONE.. cuz I cannot find one.)
<no-defun-allowed>
I can come up with a few complaints, but that is not out of the ordinary for programming languages.
jprajzne has joined #lisp
<phireh>
There are some outdated complaints out there
<no-defun-allowed>
The argument in my book basically goes: Suppose you have a group of people who want to implement something. They have some options, and they have no a priori reason to believe one option is better than the other. Would it be better to pick one option and have everyone work on it to completion, or have everyone prototype implementations of all options, test them, then decide on which was the best?
<phireh>
Like, I found this old paper talking about how CL was too big to have a good implementation but we have a few nowadays
pve has joined #lisp
<no-defun-allowed>
The former case looks good, because hey everyone's working together and they have a complete library. But if there's N options, then there's a N/(N+1) probability they didn't pick the best one, so they likely have to convene to pick another option and try again.
<moon-child>
phireh: cl remains very difficult to implement and very, and that's a valid consideration for some use cases
<nij>
yeah T_T we all know why lisp is not so popular.. sigh
<nij>
and i think that's well captured in /the curse of lisp/
<moon-child>
One of the reasons the c committee chose to reject some features (forget which) was that it would make it harder to implement compilers. No biggy for gcc/clang/msvc (eqv. sbcl/ccl/lispworks), but problematic for small embedded c compiler vendors
<nij>
too powerful -> less popular
villanella has joined #lisp
<no-defun-allowed>
At a wider scale, the latter case is much better, because you get a better idea of the design space. The problem is rounding up all the people, because odds are they don't know each other. But at least, you find that of all the options, most people pick very few options, so it's really not a problem anyway.
<nij>
phireh: oh interesting.
<nij>
that used to be a legit claim?
<phireh>
I mean, it is still a legit claim as moon-child said.
<no-defun-allowed>
It was. I think there was a fear that some features were still tricky to implement on stock hardware without a "sufficiently smart compiler", too.
<phireh>
It's a paper from '84 called A Critique of Common Lisp
<moon-child>
no-defun-allowed: funny it was the hardware, rather than the compilers, that proved that wrong
<moon-child>
(though ofc compilers have improved)
<phireh>
Anyhow the language is massive and has tons of redundancy, so it's intimidating at first glance for sure
<no-defun-allowed>
nij: I didn't quite get all of the quote in the book, but "man, your head is haunted; you have bats in your belfry! You’re imagining big things and painting for yourself a whole world of gods that is there for you, a haunted realm to which you are called, an ideal that beckons to you. You have a fixed idea!"
<beach>
I for one think that nij has very strange questions, indicating some worry that I can't figure out what it is.
<no-defun-allowed>
As opposed to minimalist language, I appreciate the redundancy, and sometimes I wish they went further. It would have been amusing to put all of Alexandria in the COMMON-LISP package, but it would be a pain for standardisation.
<phireh>
beach: He probably just doesn't want to look like an evangelist to his programmer friends or something?
<beach>
phireh: Maybe so, but my advice is to avoid trying to push a language to others. Especially if you don't know the language very well yourself, and even more so if the others very likely don't want to hear it.
<phoe>
I think the best way to not look like an evangelist is not to evangelize
<no-defun-allowed>
Easy enough, don't evangelise. To some extent, you can "let the code speak for itself", and what you gain and lose will be apparent.
<no-defun-allowed>
As phoe and beach said.
<beach>
Exactly.
<beach>
It is much more preferable to do good work that then others might become curious about.
<beach>
Heh, what no-defun-allowed said.
<phireh>
Yea but if someone asks you about a language you use you should warn them about the sharp corners, no?
<phireh>
Anyhow I can get behind the no-evangelizing
<phoe>
sure, but at that point it's answering questions
<phoe>
which is not really preaching
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<beach>
phireh: It is very likely they will give you a blank stare and now know what you are talking about.
<nij>
beach: I'd like to understand a thing by checking all aspects of it. But with Lisp, ho ho ho there's none I found so far.
nij has quit [Remote host closed the connection]
<no-defun-allowed>
In my opinion, it is also important to note what you can't seem to express well in the language, and think about how you could make it work. But Lisp is a good building material, and if you find a very compelling reason to write a new language, then you may still find yourself at SLIME (or equivalent) meddling with the bootstrap compiler.
<phoe>
if anything: get to know the language, figure out what's good in it, what's missing, make something useful in it that makes use of the good to fill the missing
<phoe>
nij: none of what you found so far?
nij has joined #lisp
<nij>
oh shoot did I got logged out again..
<nij>
damn ==
<phoe>
nij: none of what you found so far?
villanella has quit [Ping timeout: 240 seconds]
<beach>
phireh: And given the knowledge about programming and programming languages that nij has displayed so far, if the surrounding people are similar, they definitely won't understand.
<nij>
there's no legit complaints so far..
<phoe>
complaints about Lisp?
<nij>
beach: uh no. I learn programming completely by myself and that's why I look stupider. I would only talk to friends about this if they are at least "well" trained.
<no-defun-allowed>
beach: May I ask, as you've been around the Common Lisp community for much longer than myself, do you think there is really a problem with, I suppose "organising" projects? It seems a bit overblown to me, but things may have changed recently.
<beach>
no-defun-allowed: Tough question. Compared to with other languages, you mean?
<phoe>
one complaint I've heard it has old and weird and ancient and duplicated operator names for backwards compatibility with languages that are no longer even alive: rplaca, rplacd, nreconc, revappend, pairlis, nsubstitute-if-not and what else
<nij>
Quoted from /curse of lisp/: "[..] even if Lisp is the most expressive language ever, such that it is theoretically impossible to make a more expressive language [..]"
<no-defun-allowed>
beach: I suppose so.
<nij>
How is it theoretically proven? I thought expressiveness isn't a well defined term..
<beach>
no-defun-allowed: I have seen no evidence of any more difficulty with Common Lisp than with other languages.
Cymew has joined #lisp
<phoe>
another complaint coming from low-level language folk: you have no control over the memory layout whatsoever. you need to the trust implementation about that, or go into the C world.
<nij>
phoe: they can change the name if they like.. it's more like a social issue again @@
<nij>
phoe: this one is legit :D! But why don't they write assembly instead?
<no-defun-allowed>
I'm sure it's not. At the least, constraint solving and that kinda backtracking is really something you have to write a "compiler" for, as it doesn't fit into an imperative model so well.
<phireh>
phoe: I think you can disable the GC in some implementations, no?
hendursaga has joined #lisp
<phoe>
phireh: I think so, but this doesn't solve the memory layout problem
<phireh>
phoe: Oh, you mean things like optimizing for cache lines?
<no-defun-allowed>
The problem is more that, say, you couldn't have a structure "in" another structure, and you would have a structure with a reference to another structure. It's very nice to have that kind of reference semantics, but annoying for micro-optimisations.
<beach>
Indeed. Common Lisp dictates sane semantics, but it comes at a "small-ish" cost.
hendursa1 has quit [Ping timeout: 240 seconds]
* no-defun-allowed
has been beginning to think that the real curse is everyone supposing there is a curse (or "social problem", whatever you want to call it) to begin with.
<beach>
Also, it is not really relevant to compare language only with respect to micro optimizations. The question of programmer productivity and safety of the end result must be taken into account.
<phoe>
no-defun-allowed: that's what I hear jackdaniel saying yesterday
<phoe>
and what I kinda agree with
<beach>
And I think those aspects are more and more important these days.
<phoe>
also what beach said is super important
<no-defun-allowed>
I think the examples given would happen again in other languages. I mean, what stops a group from making N duplicated functions or classes or so on, if they are able to make N domain specific languages or something?
<phireh>
I think Baggers managed to poke into the internals of SBCL to optimize low level graphics code, at least there were videos on it
<phoe>
inside Little Bits of Lisp?
nij has quit [Quit: ERC (IRC client for Emacs 27.1)]
<phireh>
A pile of parens I think he called it
<no-defun-allowed>
Some people write custom VOPs (think: assembler snippets) to micro-optimise on SBCL.
<beach>
And that's a much more sane approach than abandoning all safety by using an intrinsically unsafe language for everything.
nij has joined #lisp
<phoe>
oooh, via VOPs - I see
mbomba has quit [Quit: WeeChat 3.0]
<phireh>
I don't know if this is the best place to ask, but anyhow: how would you go around about creating and showing (maybe even editing) .svg files in Common Lisp? I thought about using cl-allegro2 with something like qtools.
<nij>
Any symbolic calculator written in common lisp that deals with algebraic numbers and field of rational functions over them?
<no-defun-allowed>
If your question was just the first seven words, I would say Maxima. But I don't know what the rest of the words mean off the top of my head.
<nij>
Oh maxima is in cl? I will check it out!
<lotuseater>
yes it's the port of macsyma
andreyorst` has joined #lisp
ebrasca has joined #lisp
<nij>
Oh.. I asked the wrong question. Indeed, maxima is built on top of cl, but the language is specified. I was thinking of a full-fledge calculator that let me builds on top of it using cl.
<no-defun-allowed>
You can write Maxima functions in Lisp, but it's not really how you're supposed to use Maxima.
<nij>
I get that implementing DSL is useful in many cases. But what prevents people to invent their DSLs in a more lispy way @@?
<phoe>
syntax
<phoe>
or personal preferences regarding it
<treflip>
nij: bld-maxima can call Maxima from CL
<nij>
Maybe that's a "bad point" of lisp, in the sense that many purposed cannot be easily written in it?
<no-defun-allowed>
There isn't a "Lispy way" except for what you make of it.
<phoe>
some people claim LOOP isn't lispy because it doesn't have many parens
<nij>
phoe: isn't that legit?
<phoe>
some people claim LOOP is the most lispy because it is an exhibition that Lisp allows you to write arbitrary DSLs that don't have parens
<phoe>
or DSLs that have parens, too
<phoe>
that's why we also have ITERATE
<phoe>
isn't what legit
<phoe>
lisp allows you to easily customize your DSL syntax, that's the whole point
<nij>
I mean.. we clearly need parens.. no? if the goal is not of popularity.
<phoe>
need parens, what for?
<no-defun-allowed>
Today I used fake "infix" operators in a macro.
<phoe>
iteration? not really, as demonstrated by loop
<phoe>
for an overly dramatic example, (loop for x in list-1 for y in list-2 if y collect y else collect x)
<phoe>
it's not entirely in good style but it's not meant to be
<phoe>
it's meant to show that parens aren't a strict requirement for meaningful iteration in LOOP
<phoe>
again, what do you think we need parens for?
<nij>
I think the question "need parens, what for?" is indeed the one that I try to answer upon entering the Lisp world. I still don't have a good answer.
<phoe>
when you are writing Lisp, the answer for that question is obvious - because the core language syntax requires parentheses
<nij>
So far I can only say that the parens are good for clarity.
<no-defun-allowed>
It's equally as valid as any other notation.
kaftejiman has joined #lisp
hiroaki has quit [Ping timeout: 256 seconds]
<phoe>
you can't access a slot, bind a variable, or even call a function without parens
<no-defun-allowed>
Gerald Sussman threw that complaint upside down in one presentation, showing how mathematical notation is an absolute lie, but I forgot the name.
<nij>
You break your expression in terms of lots of paren'd forms, which are broken into many paren'd subforms.
<phoe>
but when you write a DSL, you're the regent of your syntax now
<no-defun-allowed>
nij: It's loosely about the many forms of abuse that mathematical notation inflicts on the reader.
<lotuseater>
sussman has no fez on his hat :/
<nij>
phoe: without parens .. not so much clarity
<phoe>
nij: that's a matter of taste. if you prefer your iteration with parens, (ql:quickload :iterate)
<nij>
no-defun-allowed: oh yeah there are too many. One of the main reason is that the best IDE among mathematicians are..
<phoe>
otherwise, stick with loop
<no-defun-allowed>
He goes to call one author "a son of a bitch", for telling the reader that they have not done much to make the book any more readable.
<nij>
papers and pencils.
<nij>
lolll!
<nij>
no-defun-allowed: Sure. I'd used to have that complaint as well, until I started writing my paper.
<nij>
It's very EXPENSIVE to write well in mathematics.
<no-defun-allowed>
The earliest example Sussman gave is cos^2 x = (cos x)^2, but cos^-1 x ≠ (cos x)^-1
<lotuseater>
nij: how do you mean expensive?
<phoe>
you could have your DSL written as #æ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. and that's Turing complete and everything without a single parens. (nitpick: there are brackets.)
<phoe>
and that could be valid Lisp, too, as long as you define a proper dispatch macro for #æ
<lotuseater>
no-defun-allowed: i don't like people writing "ln(x)" instead "log(x)"
hjudt has quit [Ping timeout: 272 seconds]
<nij>
no-defun-allowed: Here's an even simpler one: 2*3+7
<phoe>
but I don't know what we are discussing now - the importance of parentheses in general for clarity of written mathematics?
<nij>
phoe: no that's another issue..
<phoe>
Lisp doesn't have problems with operator precedence because it doesn't have operator precedence
<nij>
phoe: I would say you then embed your new language in lisp. But that's not lisp anymore.
<phoe>
yes, it's no longer strictly Lisp at that point
<phoe>
it has its own syntax
<nij>
(ok.. forget about the math stuff, that's another issue. I will still answer them though.)
<phoe>
doesn't matter if it's LOOP, or FORMAT, or the Brainfæck example I posted up above
<no-defun-allowed>
There are a lot of things with Lisp syntax which I couldn't call Lisp with a straight face.
<nij>
phoe: That's my problem with it. I believe lisp syntax is more superior, so why not writing ones DSL in lisp syntax?
<phoe>
that's a domain-specific language, with the "language" bit implying that it has its own syntax.
<nij>
Is it because it takes more work? Or it's not possible.
<phoe>
nij: mostly because some people disagree with your belief that parens are superior everywhere.
quazimodo has quit [Ping timeout: 272 seconds]
<phoe>
and write their DSLs in a way that they believe is superior for the task at hand.
<no-defun-allowed>
Well, is (moooo-nad (x <- (read ...)) (write x) (return (+ x 2))) Lisp syntax?
<nij>
lotuseater: in number theory, people usually need to write log(log(log(log|x|))). It's nicer to write ln i guess, as papers and pencils are the best IDE for mathematicians so far.
<nij>
lotuseater: Also, "log" has ambiguity.. you need to specify the base. ln = log_{e} for short.
<phoe>
also lispers are kinda spoiled when looking from the broader point of view
<nij>
phoe: Hmm.. I wouldn't disagree with you on that, as I haven't found a legit reason why I feel it's more superior.
<phoe>
"should I have a DSL with parens or without parens" is a luxury compared to "can I have a DSL at all" that some popular programming languages constantly tend to have
<phoe>
nij: figure that out then. you'll find your answers.
<nij>
Take loop for example. (loop for x in list-1 collect x)
<lotuseater>
nij: hm yes, but actually no ;) there is just one logarithm
<phoe>
that's the loop example written without DSLs
charlie770 has joined #lisp
<beach>
nij: Common Lisp is not about strictly imposing a style on its users. It is about making life as convenient as possible for them.
nij` has joined #lisp
<nij`>
Ohh shoooot :(
<beach>
nij: And LOOP makes many things VERY convenient.
<no-defun-allowed>
Exactly what beach said.
<nij`>
I'm very interested in this. So if someone thinks there's a point, would you please pastebin?
<nij`>
To argue why parens are superior is really one of the main motivation I was here.
<beach>
nij`: Sorry to disappoint you.
<nij`>
See, I was involved in pure math not b/c of math.. but b/c of the language they use seem to have more power.
<nij`>
beach: It's ok.
nij has quit [Ping timeout: 268 seconds]
<lotuseater>
it's about building the right tool for your problem and not having to go by the tools you have
<nij`>
And I really appreciate that you can make some comments.
<phoe>
in other programming languages you usually try to bend the problem you have to try and express it in your language
<no-defun-allowed>
Traditional mathematical notation is frequently more ambiguous than Lisp notation. Occasionally Lisp notation is ambiguous, like how we handle some parts of fancy LOOP, but you have to look hard for it.
<phoe>
in Lisp you often do less of that, and you usually bend the language itself to be able to express the original problem better
<nij`>
phoe: Yes that's because lisp syntax is more expressive.
<phoe>
let's forget about "expressive" for a moment
<nij`>
I'm thinking maybe we can bring this to the next level.
<beach>
nij`: Another piece of evidence for what I am saying is the Common Lisp supports several programming paradigms, like imperative, functional, and, let's call it "generic-function oriented".
<nij`>
So that your DSL is also lispy, which makes it more expressive, on which you can build more again.
<phoe>
Lisp allows you to manipulate the meaning of things that form language syntax; that's not common in other languages
<no-defun-allowed>
phoe: The Early History contradicts that to a bit, saying that if you have such powerful paradigms, you would have problems trying to find where you need to invent a new paradigm.
<phoe>
they are slowwwwwwly catching up with their macro systems, but that's not all that convenient to use when you lack homoiconicity in your language.
<phoe>
no-defun-allowed: what do you mean?
<no-defun-allowed>
I suppose that's either a good or bad thing, depending on if you, the outsider, would think the new paradigm would be easier to use.
<phoe>
what's The Early History?
<no-defun-allowed>
The Early History of Smalltalk <http://worrydream.com/EarlyHistoryOfSmalltalk/>, which mentions the "Let's Burn Our Disk Packs" break the Smalltalk research team took in 1976.
<nij`>
phoe: I can try to make my point by using maxima as an example.
<nij`>
See.. now I want a lispy symbolic calculator and there seems to be little.. if maxima has written in lisp, then I don't have to worry.
<nij`>
Why would I need a lispy maxima? Well, because I need to make use of lisp's expressiveness to build my project.
<nij`>
Maxima does solve a lower level problem. Indeed, they found the right language just to get their stuff done. But how about future development?
<no-defun-allowed>
"... inadequate tools and environments still reshape our thinking in spite of their problems, in part, because we want paradigms to guide our goals. Strong paradigms like LISP and Smalltalk are so compelling that they eat their young: when you look at an application in either of these two systems, they resemble the systems themselves, not a new idea."
<nij`>
This happens especially in math, where the process of abstractions do not end.
<nij`>
So yes, LOOP is very useful, I get it. And if to achieve level-0 loops is the main goal, I'd have nothing to complain.
ljavorsk has joined #lisp
<nij`>
But who knows if someone wants to build something on top of LOOP? Wouldn't it be nice if it's lispy and thus more expressive?
<no-defun-allowed>
I don't see what's not Lispy or expressive about LOOP, other than it's not extensible by the user.
<phoe>
or just build in some extension mechanisms into it.
* nij`
is in his constant fear that he is logged out again, when it's too quiet.
<nij`>
phoe: yeah that's maybe what I will do.
<phoe>
going by your definition, SETF is very much not lispy; what if someone wants to build something on top of it?
<nij`>
So my complaint is: why haven't the developer done it ;)?
<phoe>
and the only way of extending it that you have is SETF expansions
<nij`>
(I'm just lazy lol)
<beach>
nij`: They have.
<phoe>
^
<nij`>
phoe: I understand. But we keep the amount of those special ones minimal.
hjudt has joined #lisp
<beach>
Oh, you are the "minimal" person. Now I remember.
<phoe>
remember not to fall into the trap of making everything infinitely extensible and generic
<no-defun-allowed>
I don't remember the "minimal person"; but at this rate I think I have enough context.
<phoe>
because at that point your code will be unusable
* nij`
was caught.
<nij`>
beach: "They have" <== for what?!
<phoe>
the LOOP implementation used in the majority of modern Lisp implementations is extensible
<beach>
made it extensible.
<phoe>
this functionality just isn't really used.
<pve>
no-defun-allowed: That "Smalltalk and Children" section is great. I kind of admire that they tried to teach it to children.
<no-defun-allowed>
pve: Yes, that was the original intention of Smalltalk, to be taught to children like Logo(?)
nostoi has quit [Quit: Verlassend]
<nij`>
phoe: ?!?! Would you mind providing some pointers?
<pve>
no-defun-allowed: I had read that whole thing before, but completely forgot about it. Thanks for the reminder :)
<ldb>
if i want to assign each object of a class a unique integer id, and can "free" objects explicitly, how can I keep the largest unique id minimum? (i.e when I traverse those objects, there're no id between 0 and the largest id unused
<phoe>
ldb: is the order between IDs important?
<ldb>
phoe: no
<phoe>
what other parts of the system use these IDs? are they cacheable somewhere else?
<jackdaniel>
must the id be a number?
<jackdaniel>
if not, then (gensym "ID") -- and when "deallocating" setf the slot to nil
Alfr_ has quit [Quit: Leaving]
<jackdaniel>
to not retain the symbol
<ldb>
I want to finally make a compact vector to store those objects, indexed by their ids
<jackdaniel>
(but since you talk about 'largest' it's probably a number)
EvW has quit [Client Quit]
<phoe>
uh, do you need an index?
<phoe>
I think you do, yes
<phoe>
you can vector-push-extend new instances into the vector just fine
<phoe>
but then you need its index to remove it from the vector in O(1) time
<jackdaniel>
then store them on a list (then removal from the middle is cheap), and in the end serialize to a vector
<phoe>
jackdaniel: there's also a trick where if you have to remove the third element from the vector, copy the last element into the third position, setf the ID of that element to 3, and decf the fill pointer
<jackdaniel>
sure
<jackdaniel>
makes sense
<jackdaniel>
given you may change ids of existing objects
<ldb>
i need the vector to be indexed by ids bcs i need to quickly identify if there's an eq object already in the vector
<splittist>
ldb: if you can free arbitrarily, how can there not be arbitrary gaps? Unless you periodically renumber. Then you've reinvented garbage collection
<phoe>
splittist: you can avoid gaps if each free reorders elements in the vector
<jackdaniel>
won't eq hash table do?
<jackdaniel>
or eql for immediate objects
Bike has joined #lisp
<phoe>
^
<ldb>
i think i can store in eq hash table, then maphash
<nij>
I am testing out 'make-load-form-saving-slots..
<phoe>
"make-load-form-saving-slots works for any instance of standard-object or structure-object."
<nij>
Yeah I was mumbling that repeatedly.
<phoe>
where is that standard-object or structure-object in (list 1 2 3)?
<ldb>
well make-load-form is overkill
<ldb>
you can try immitate the Emacs's init.el behavior by load the history file into a gap buffer and do text insertion
<nij>
I thought (list 1 2 3) itself returns a standard object.
<phoe>
nope, it returns a cons cell
<phoe>
which is not a standard object
<phoe>
a standard object is something that is generally created by MAKE-INSTANCE
<ldb>
but something of a builtin-class
<nij>
From CLHS: Description: The class standard-object is an instance of standard-class and is a superclass of every class that is an instance of standard-class except itself.
<phoe>
yes
<phoe>
and instances of standard-class are generally created using DEFCLASS
<Nilby>
ldb: what implementation and processor are you running on? Your code ran for me about 1000x quicker.
<jackdaniel>
intel celeron II :)
<ldb>
Nilby: Intel Core i7, 2.2GHZ, Clozure CL on macOS
wsinatra has joined #lisp
<nij>
phoe: how did you know? CLHS doesn't say it right? I was trying to search.
<ldb>
SBCL might be slower due to hash table performance on custom test functions
<nij>
What a typical instance of the class standard-object is?
<phoe>
(defclass foo () ()) (make-instance 'foo)
<phoe>
(typep (make-instance 'foo) 'standard-object) ;=> T
<nij>
Oh, by experience.
amk has quit [Read error: Connection reset by peer]
amk has joined #lisp
<ldb>
Nilby: and forgot to mention, the input file has to be sorted
<ldb>
otherwise it goes wrong
EvW has joined #lisp
<Nilby>
Hmmm... still about 1000x faster, on a similar cpu and ccl, but on linux, but now I run out of stack on a 500k file, but it still works on a 100k file.
<Nilby>
It took 0.5 sec for a 100k file on ccl on a i7.
<Nilby>
Maybe you have a much more interesting data?
<nij>
For my current purpose serialization seems ok. Or I can just push vectors..
<Nilby>
ldb: my code is too slow on ccl too
treflip has quit [Ping timeout: 246 seconds]
Alfr has joined #lisp
* ldb
trys to figue out why he doesn't like SBCL
treflip has joined #lisp
treflip has quit [Client Quit]
<nij>
I store a function like this: (defun f (n) n) (cl-store:store #'f "~/temp.txt")
<nij>
But cannot successfully call it back..
<nij>
Both (apply #'(cl-store:restore "~/see.txt") 3) and ((cl-store:restore "~/see.txt") 3) fail..
<Bike>
according to the project page, when you serialize a function it just uses the function name
<nij>
s/temp/see/
<Bike>
well that's just a syntax error
<Bike>
you want (funcall (restore ...) 3) i would guess
<nij>
Oh indeed @@!
<Bike>
doesn't the error message say something like, malformed lambda expression?
<nij>
yes i tried to fix @@..
ldb has quit [Quit: ERC (IRC client for Emacs 26.1)]
<nij>
In general, if I want to get a form that clearly presents my object, I should write my own function/macro..
waleee-cl has joined #lisp
karlosz has quit [Quit: karlosz]
karlosz has joined #lisp
karlosz has quit [Client Quit]
karlosz has joined #lisp
nij has quit [Read error: Connection reset by peer]
nij has joined #lisp
zulu-inuoe has joined #lisp
milanj_ has joined #lisp
milanj has quit [Ping timeout: 268 seconds]
charlie770 has joined #lisp
cosimone has quit [Read error: Connection reset by peer]
cosimone has joined #lisp
villanella has joined #lisp
norserob has quit [Quit: leaving]
norserob has joined #lisp
wigust has quit [Remote host closed the connection]
wigust has joined #lisp
noobineer has quit [Quit: Leaving]
sjl has joined #lisp
EvW has quit [Ping timeout: 268 seconds]
karlosz has quit [Quit: karlosz]
nij has quit [Read error: Connection reset by peer]
karlosz has joined #lisp
ex_nihilo has quit [Quit: Leaving]
saganman has joined #lisp
hiroaki has quit [Ping timeout: 264 seconds]
notaname has quit [Quit: WeeChat 2.3]
lalilulelo has joined #lisp
galex-713_ has joined #lisp
galex-713 has quit [Ping timeout: 272 seconds]
hiroaki has joined #lisp
milanj_ has quit [Quit: Leaving]
milanj has joined #lisp
galex-713_ has quit [Ping timeout: 268 seconds]
entre-parenteses has joined #lisp
galex-713 has joined #lisp
infra_red[m] has quit [Quit: Idle for 30+ days]
toorevitimirp has quit [Remote host closed the connection]
Steeve has joined #lisp
__jrjsmrtn__ has quit [Ping timeout: 246 seconds]
tlaxkit has joined #lisp
Qudit314159 has quit [Read error: Connection reset by peer]
__jrjsmrtn__ has joined #lisp
blackwolf has joined #lisp
blackwolf has quit [Client Quit]
blackwolf has joined #lisp
blackwolf has quit [Client Quit]
mathrick has joined #lisp
galex-713 has quit [Quit: No Ping reply in 180 seconds.]
jibanes has quit [Ping timeout: 240 seconds]
flazh has quit [Quit: flazh]
Cymew has quit [Ping timeout: 264 seconds]
jibanes has joined #lisp
jibanes_ has joined #lisp
jibanes_ has quit [Ping timeout: 272 seconds]
charlie770 has quit [Ping timeout: 268 seconds]
andreyorst` has quit [Quit: andreyorst`]
andreyorst has joined #lisp
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #lisp
galex-713 has joined #lisp
kenran has joined #lisp
santiagopim[m] has quit [Ping timeout: 260 seconds]
solideogloria[m] has quit [Ping timeout: 260 seconds]
solideogloria[m] has joined #lisp
santiagopim[m] has joined #lisp
ebrasca has quit [Remote host closed the connection]
milanj_ has joined #lisp
Steeve has quit [Ping timeout: 264 seconds]
milanj has quit [Ping timeout: 256 seconds]
charlie770 has joined #lisp
flazh has joined #lisp
jibanes has quit [Ping timeout: 240 seconds]
davros has quit [Ping timeout: 265 seconds]
jibanes has joined #lisp
<solideogloria[m]>
<pyc "hey sjl. would you please share "> vlime is as simple as just adding it in your vim plugin managers
<solideogloria[m]>
*plugin manager
<mfiano>
I was using a derivative of sjl's vlime config for a couple years just to see if I could live doing CL away from Emacs, and the answer was a big NOPE.
<mfiano>
There were many issues, but one of the big ones is the fact that vlime doesn't indent custom macros according to the lambda list. The vim way is to maintain a flat file with the indentation metadata for every symbol of every custom macro you write, or use from some library. This is mostly a vim limitation, though.
jibanes has quit [Ping timeout: 246 seconds]
jibanes has joined #lisp
gabot has quit [Ping timeout: 265 seconds]
<sjl>
In practice, this means I need to edit my .lispwords file every few weeks.
<mfiano>
I write a lot of DSLs that need to be indented correctly or my teammates yell at me :)
<mfiano>
Also I just can't live without Sly stickers, copy-to-mrepl, and a lot of other features missing from SLIME, and therefor vlime.
<sjl>
Vlime also supports Swank's indentation -- the reason I don't use it is because it was slow when indenting large chunks of code ~3 years ago. No idea if that's still the case.
<mfiano>
And I guess finally, parentheses management is ungodly slow and error prone with the any of the array of vim plugins for doing so
<sjl>
paredit.vim has always worked great for me
<sjl>
But yeah, if you're willing to dump the required time into emacs, it'll be a better fit in the end
<mfiano>
It has many bugs if you used the advanced manipulation features like vonsolute and raise-killing-backward, etc...often leaving unbalanced parens
<mfiano>
But, it's just slow on older hardware compared to Emacs paren management
<sjl>
I have no idea what the word "vonsolute" could possibly mean, so I'm out.
<mfiano>
err convolute that was supposed to read
Steeve has joined #lisp
<entre-parenteses>
mfiano: Speaking of Sly, I noticed you have/had a Spacemacs layer for using that over SLIME. I was just curious if you might share why you archived it?
ezekielwordswort has joined #lisp
<ezekielwordswort>
is programming language development possible in common lisp?
<mfiano>
Because Spacemacs is a moving target. I haven't used that junk in years
<beach>
ezekielwordswort: What do you mean?
<entre-parenteses>
Ah, fair enough. :D
<beach>
ezekielwordswort: Like creating your own language and implementing it in Common Lisp?
<ezekielwordswort>
yeah
<beach>
ezekielwordswort: Common Lisp is an excellent choice for that.
<ezekielwordswort>
nice
<ezekielwordswort>
thanks for the information
<ezekielwordswort>
i shall go now
ezekielwordswort has quit [Client Quit]
<beach>
Wow.
<Alfr>
That was strange.
<beach>
Yeah.
EvW has joined #lisp
gaqwas has joined #lisp
gaqwas has joined #lisp
jibanes has quit [Ping timeout: 268 seconds]
nij has joined #lisp
jibanes has joined #lisp
gabot has joined #lisp
nij has quit [Client Quit]
jibanes has quit [Ping timeout: 265 seconds]
jibanes has joined #lisp
galex-713 has quit [Ping timeout: 272 seconds]
gproto23 has joined #lisp
gproto23 has quit [Remote host closed the connection]
saganman has quit [Ping timeout: 246 seconds]
<andreyorst>
maybe not the place to ask, but given that Emacs lisp is similar to Common in a sense that it is also Lisp2, maybe someone will be able to help me. I can't find an explanation on how I could return a lambda from a function, and store it in a varialbe that can later be called directly as a function without funcall. In Lisp1 it is pretty straightforward, in Lisp2 I'm not sure how one does this. Any hints?
<andreyorst>
ah, it seems `fset` is the way to go
<Nilby>
One way is: (setf (symbol-function 'foo) (lambda (x) ...))
galex-713 has joined #lisp
<Nilby>
There's no fset in CL
<jackdaniel>
better to always use fdefinition
<Nilby>
^ yes, sorry, also that's for CL not elisp
notzmv has quit [Ping timeout: 260 seconds]
jibanes has quit [Ping timeout: 268 seconds]
<andreyorst>
yeah, np :)
<Nilby>
Nilby's WAaaS - Wrong answer as a service "The fastest way to get the right answer"
charlie770 has quit [Ping timeout: 268 seconds]
jibanes has joined #lisp
zacts has joined #lisp
susam has quit [Ping timeout: 268 seconds]
<pyc>
solideogloria[m]: i know. but doing that simple setup gives a very limited vlime. vlime does not have a fully interactive repl like slimv.
<Cthulhux>
i'd use that
zacts has quit [Client Quit]
hnOsmium0001 has joined #lisp
pankajsg has quit [Ping timeout: 240 seconds]
parjanya has quit [Ping timeout: 260 seconds]
Steeve has quit [Quit: end]
oxum has quit [Quit: Leaving...]
pankajsg has joined #lisp
<fiddlerwoaroof>
I use/used slimv for a while
<fiddlerwoaroof>
evil-mode (without all the spacemacs baggage) eventually converted me
<fiddlerwoaroof>
Anyways, after upgrading to 11.1, sbcl works through Rosetta 2
<fiddlerwoaroof>
*macOS
<fiddlerwoaroof>
My dev environment is coming back together
nij has joined #lisp
milanj_ has quit [Quit: Leaving]
cosimone_ has joined #lisp
cosimone has quit [Ping timeout: 264 seconds]
cosimone_ is now known as cosimone
jibanes has quit [Ping timeout: 268 seconds]
<entre-parenteses>
fiddlerwoaroof: Not sure if that was to me, or not, but I'm curious. Are you saying that, now, you just use evil-mode with a regular Emacs install?
<entre-parenteses>
I got started with Spacemacs almost as soon as moving back to Emacs (from Vim) because I had gotten used to, and really like, the Vim key-bindings more, anyways.
jibanes has joined #lisp
<Cthulhux>
i find vim keybindings annoying.
<Cthulhux>
i want to INSERT TEXT in an editor window
<Cthulhux>
not tell it to insert first
<Cthulhux>
bah
<entre-parenteses>
I just didn't like my wrists hurting after long periods of using the Emacs bindings. I can, however, see the appeal of not having to know in which mode you're working, etc. :)
<entre-parenteses>
I guess it just became second-nature for me.
<entre-parenteses>
Not trying to start an editor war, though. Just curious how other people efficiently get stuff done.
<Cthulhux>
i use adme.
<Cthulhux>
acme.
<Cthulhux>
;o)
<entre-parenteses>
Oh, never heard of that! I'll have to check it out.
<Cthulhux>
(the latter has a better way to change your font.. ;-))
<Fade>
do you use it on plan9, or just in userspace?
<Cthulhux>
i'm afraid i am too lazy to use plan 9 for more than just some toyin' around
<Cthulhux>
so plan9port, it is.
<Cthulhux>
on windows and macos.
<Fade>
I admire plan9.
<Cthulhux>
9front has a netsurf port these days.
<Fade>
but I generally prefer the lisp way.
<Cthulhux>
makes it less uninteresting.
<jackdaniel>
isn't it going the other way than lisp? i.e it is more unix-y than unix? :)
<Cthulhux>
yes, it is
<Cthulhux>
everything is a file - including your cpi.
<Cthulhux>
cpu.
<Fade>
acme is too maus driven. :)
* jackdaniel
prefers "everything is a standard-object"
<Cthulhux>
fade: i thought so as well, but it really is nice
<jackdaniel>
including your cpu ,)
* Fade
touches his nose and points at jackdaniel
<Cthulhux>
vim is modal (commands are behind <esc>) and acme is modal (commands are behind the mouse)
<Cthulhux>
:p
<Cthulhux>
vim users should love it!
jibanes has joined #lisp
<Nilby>
vim is great if you have one finger, acme is great if you have an eyeball mouse and a foot clicker, emacs is great if you move the control and meta keys and a 30k init.el
<Cthulhux>
my init.el is smaller :(
nij has quit [Quit: ERC (IRC client for Emacs 27.1)]
zacts has joined #lisp
EvW has quit [Ping timeout: 268 seconds]
zacts has quit [Client Quit]
Inline has joined #lisp
luckless has quit [Remote host closed the connection]
jibanes has quit [Ping timeout: 240 seconds]
luckless has joined #lisp
hendursaga has quit [Ping timeout: 240 seconds]
jibanes has joined #lisp
kam1 has joined #lisp
hendursaga has joined #lisp
kevingal has quit [Ping timeout: 260 seconds]
<Fade>
I guess with plumber it would be trivial to tie acme into a lisp process.
<Nilby>
I'm imagining writing a filter that that takes the mouse position and the lisp file and outputs it with an ascii arrow around the matching paren, sleeps, then output the orginal file.
jibanes has quit [Ping timeout: 240 seconds]
jibanes has joined #lisp
rumbler31_ has joined #lisp
jibanes has quit [Ping timeout: 272 seconds]
jibanes has joined #lisp
X-Scale` has joined #lisp
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale` is now known as X-Scale
jibanes has quit [Ping timeout: 260 seconds]
jibanes has joined #lisp
rogersm has quit [Quit: Leaving...]
EvW has joined #lisp
oxum has joined #lisp
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #lisp
jibanes has quit [Ping timeout: 256 seconds]
kam1 has joined #lisp
kam1 has quit [Read error: Connection reset by peer]
jibanes has joined #lisp
bqv has quit [Quit: WeeChat 2.9]
jibanes has quit [Ping timeout: 264 seconds]
jibanes has joined #lisp
Alfr has quit [Quit: Leaving]
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #lisp
cosimone has joined #lisp
EvW1 has joined #lisp
EvW has quit [Ping timeout: 260 seconds]
EvW1 is now known as EvW
edgar-rft has quit [Quit: Leaving]
edgar-rft has joined #lisp
narimiran has quit [Ping timeout: 268 seconds]
rpg has joined #lisp
aorst has joined #lisp
gxt has joined #lisp
Inline has quit [Ping timeout: 272 seconds]
hiroaki has quit [Ping timeout: 265 seconds]
mbomba has joined #lisp
tlaxkit has quit [Ping timeout: 268 seconds]
villanella has quit [Remote host closed the connection]
villanella has joined #lisp
fanta1 has quit [Remote host closed the connection]
aorst has quit [Quit: WeeChat 3.0]
aorst has joined #lisp
aartaka has quit [Read error: Connection reset by peer]
jw4 has quit [Read error: Connection reset by peer]
aartaka has joined #lisp
hiroaki has joined #lisp
jw4 has joined #lisp
andreyorst has quit [Ping timeout: 272 seconds]
tlaxkit has joined #lisp
tlaxkit has quit [Client Quit]
jibanes has quit [Ping timeout: 268 seconds]
jibanes has joined #lisp
shka_ has quit [Ping timeout: 264 seconds]
rumbler31_ has quit [Ping timeout: 268 seconds]
miasuji has joined #lisp
pfdietz has quit [Ping timeout: 245 seconds]
aorst has quit [Remote host closed the connection]
galex-713 has quit [Ping timeout: 268 seconds]
galex-713 has joined #lisp
aartaka has quit [Ping timeout: 256 seconds]
rumbler31_ has joined #lisp
andreyorst has joined #lisp
izh_ has joined #lisp
galex-713_ has joined #lisp
galex-713 has quit [Ping timeout: 268 seconds]
jibanes has quit [Ping timeout: 268 seconds]
jibanes has joined #lisp
nij has joined #lisp
jibanes has quit [Ping timeout: 256 seconds]
<nij>
Spent a day. Finally got what people say this very early morning: Use lisp to build the right language to attack the specific problem.
jibanes has joined #lisp
<nij>
I thought it is better to make DSL lispier.. but the language of some problem is hard to made lispy. It's possible theoretically, but the syntax will be huge.
<nij>
This makes me wonder (another impractical stupd question), what DSLs look pretty lispy?
wsinatra has quit [Ping timeout: 240 seconds]
jibanes has quit [Ping timeout: 268 seconds]
jibanes has joined #lisp
jeosol has quit [Remote host closed the connection]
EvW has quit [Ping timeout: 268 seconds]
imode has joined #lisp
<no-defun-allowed>
I mustn't have made the point that any DSL in Lisp is "Lispy" to the author.
EvW has joined #lisp
<Xach>
mfiano: it looks like origin is broken?
* Xach
checks github
<aeth>
nij: The go-to example is HTML and/or CSS. There are quite a few of those. Also several SQL, including one that's specifically just for PostgreSQL
<aeth>
Most of these just generate strings. There are some for GLSL, a GPU shader language, too. In theory, you can generate other things, e.g. SPIR-V for GPU shaders or WASM for web browsers.
<nij>
Right.
<aeth>
Oh, I should say that most of these generate strings, and most of the rest generate Lisp code, either compiling-to-Lisp or compiling-to-an-s-expression-interpreter (or both, I guess)
<aeth>
But "generating Lisp code" makes it hard to really call a DSL vs just a regular macro. I guess LOOP counts, but it's not very Lispy vs. e.g. ITERATE
curiouscain has quit [Ping timeout: 265 seconds]
<nij>
I figure out that Lisp is so great because it is closer to human thoughts, which have many structures. Any language that achieves this seems to must have many parentheses.
* Xach
reports a bug
<nij>
But when a specific problem is too machine-like (e.g. a computer algebra system), the best language deviates from being alike to human thoughts. And that's when it starts to be less lispier.
jibanes has quit [Ping timeout: 240 seconds]
curiouscain has joined #lisp
<nij>
So in conclusion, for each specific problem, we need to design the right language for it, using lisp.
<aeth>
nij: I mean, there are three main ways (and, really, infinite ways since reader macros are a thing) to go about doing a DSL... a string (e.g. cl-ppcre or FORMAT), a pseudo-algol macro language (basically just LOOP), or a macro language with many parentheses.
<aeth>
What I mean by LOOP is, it's basically just parsing a bunch of arbitrary things that are pre-tokenized into space-separated tokens and that's about it.
<aeth>
As opposed to having more structure and probably doing destructuring-bind or something
jprajzne has left #lisp [#lisp]
<nij>
right
<nij>
Does that mean if a language is good enough for a problem, I should just use it? Instead of lisp?
<nij>
Much more expressive. It remembers the structure of our thoughts.
<nij>
aeth: In your first category (DSL by string eg FORMAT), can one still argue that lisp is a better language for designing it?
<nij>
Also, as for your third category, what would be some instances?
jibanes has quit [Ping timeout: 264 seconds]
<aeth>
nij: if the string is a literal string, it can still be parsed at compile time
gaqwas has quit [Ping timeout: 265 seconds]
jibanes has joined #lisp
<aeth>
implementations probably do this with FORMAT when the string is literal.
<no-defun-allowed>
You have to be sure that Lisp isn't changing the structure of your thoughts. Some wise internet celebrities say it is (and make it sound like writing Lisp is like doing drugs), but that could be a bad thing if there is a better structure.
notzmv has joined #lisp
<aeth>
nij: so (your-macro "1 + 2 + 3 + 4") isn't too different from (your-macro 1 2 3 4)
<aeth>
(FORMAT isn't a macro, though, so implementations have to be clever)
<Xach>
> How to change the cooking time? "Setf second list new-value" is how I would phrase it in English.
mbomba has quit [Quit: WeeChat 3.0]
<nij>
no-defun-allowed: humans thoughts are full of structures.. while it's definitely not the same as lisp, I'm convinced that lisp is the most alike.
<nij>
Lol that's different grammar. But as thoughts it's alike.
iskander has quit [Quit: bye]
<nij>
Also in Latin, I think people can talk like that.
<nij>
(im not an expert in Latin)
jibanes has quit [Ping timeout: 240 seconds]
kenran has quit [Quit: leaving]
jibanes has joined #lisp
iskander has joined #lisp
<nij>
Xach: but it's still a pretty nice joke xD
<aeth>
Xach: Personally, I think in destructuring-bind rather than FIRST, SECOND, etc., but I think that those are just LETs, not accessors. We need a with-destructuring-accessors for the SETF, I guess.
<nij>
I recall one of my high school classmates. He were so into computer science and sometimes talks like that (not in English though).
<mrcom>
nij: Would think computer algebra is actually *very* lisp-ish. Core problem is re-arranging graphs which are mostly-but-not-entirely trees.
<aeth>
mrcom: agreed
<aeth>
at least, symbolic CAS
<aeth>
You don't really think about trying to differentiate math expressions in a "normal" programming language, but plenty of people have that thought when it's in s-expression form
<nij>
You'd need to write (+ (make-integer 3) (make-rational 3.5))......
<nij>
The structure is lisp, but there's too much abstractions.
<nij>
So to cut the interface down, one must make it less lispy..
<nij>
Here, ofc, 3 and 3.5 are handled automatically by lisp. But this is just an example.
<mrcom>
nij: '(+ (* A B) (* A C)) -> '(* A (+ B C))
heisig has quit [Quit: Leaving]
<nij>
oh this part yes
<nij>
very lispy
<nij>
But when one starts to deal with (N in Z in Q in R in C in C[x] in C[x,y] in C(x,y))...
iskander- has joined #lisp
<nij>
there will be much ambiguity
<nij>
As we don't want to mess #'+ around..
<nij>
or some other fundamental operations that can be "lifted".
jibanes has quit [Ping timeout: 268 seconds]
<nij>
Oh wait! We can use generic function..
iskander has quit [Ping timeout: 272 seconds]
jibanes has joined #lisp
dbotton has joined #lisp
<mrcom>
(map 'list #'(replace-when-matches (* (+ _0 _1) (+ _0 _2)) (* _0 (+ _1 _2))) '(* (* (+ A B) (A C)) (* (+ A E) (+ A F))))) -> '(* A (+ (+ B C) (+ E F)))
<mrcom>
(they're quoted lists so + and * are treated as symbols, not functions)
<nij>
i see
<mrcom>
Any this is hand-wavy lisp :)
<nij>
the language is also list-like, instead of string-like.
<nij>
Oh, is this translator easy to write in lisp?
<mrcom>
Yep, very easy.
<nij>
How about rational functions? Namely, polynomials over polynomials.
<nij>
Maybe multi-variated. Namely, many indeterminants x, y, z, etc..
<mrcom>
A basic idea is to define patterns with place holders, and then define transforms on patterns-of-patterns.
jeosol has joined #lisp
matryoshka has joined #lisp
matryoshka has quit [Client Quit]
<nij>
i see
<mrcom>
For example, "when you see (* A B), if A matches (^ C D) and B (^ E F), and C and E are the same thing, then replace with (^ C (+ D E))"
infra_red[m] has joined #lisp
<mrcom>
Then there's "let's represent the possible transforms as lazy trees, and walk the tree until we're happy."
<mrcom>
So it's all lists. The whole universe is lists :)
<mrcom>
sorry: replace with (^ C (+ D F))
andreyorst has quit [Quit: WeeChat 3.0]
madage has joined #lisp
<mrcom>
More head-explodey: Symbols are really pointers to... everything. There is a symbol which has an identifying string "+" (more precisely, there's a symbol in the COMMON-LISP namespace with that ident).
izh_ has quit [Quit: Leaving]
phireh has quit [Read error: Connection reset by peer]
<nij>
It's nice. I shall learn this.
<mrcom>
When you do something like `(format t "~A~%" '+)', you are telling the lisp reader to "find the symbol `+', then include it in the list that will get passed to FORMAT when it's called."
jibanes has quit [Ping timeout: 272 seconds]
rumbler31_ has quit [Ping timeout: 256 seconds]
<mrcom>
FORMAT takes the second parameter (the "~A~%" string), sees the ~A, looks at the next parameter and sees its a symbol. The ~A tells FORMAT to get the symbol's name field and stuff it in the output string.
jibanes has joined #lisp
<mrcom>
Not too complicated. The head-splodey part is this:
dieggsy has joined #lisp
rumbler31_ has joined #lisp
sjl has quit [Ping timeout: 256 seconds]
<mrcom>
If you do something like '(+ A B) [including the single quote] the reader does _exactly the same thing_. That initial symbol in the resulting list _is_ the symbol that identifies the "+" function.
Alfr has joined #lisp
kam1 has joined #lisp
jibanes has quit [Ping timeout: 256 seconds]
<mrcom>
So transforming '(+ (* A B) (* A C)) to '(* A (+ B C)) _is_ directly transforming code.
<mrcom>
So your transforming language is just playing with lists of symbols, but if you choose the symbols appropriately you are directly refactoring code.
rgherdt has quit [Ping timeout: 268 seconds]
villanella has quit [Ping timeout: 268 seconds]
<Nilby>
Now to really a splode your head, run the metacircular lisp 'whitespace' compiler written in 'parentheses hell' that outputs k-machine code to an invisible color channel in a jpg of a walrus.
<mrcom>
I'm sorry, but the walrus is just gratuitous. I could see a spherical cow, but...
* Nilby
apologizes
* Nilby
self kicked
Nilby has left #lisp ["👽愛🆑"]
matryoshka has joined #lisp
igemnace has quit [Remote host closed the connection]
luckless has quit [Quit: luckless]
random-nick has quit [Ping timeout: 246 seconds]
dbotton has quit [Quit: This computer has gone to sleep]
rumbler31_ has quit [Ping timeout: 240 seconds]
kam1 has quit [Read error: Connection reset by peer]
kam1 has joined #lisp
pve has quit [Quit: leaving]
dbotton has joined #lisp
jibanes has quit [Ping timeout: 268 seconds]
jibanes has joined #lisp
dhil has quit [Ping timeout: 260 seconds]
igemnace has joined #lisp
kam1 has quit [Read error: Connection reset by peer]