meepdeew has quit [Remote host closed the connection]
Essadon has quit [Quit: Qutting]
Kundry_Wag has joined #lisp
<asarch>
What is the name of the elisp function for the Edit->Select All operation in Emacs?
<Bike>
mark-whole-buffer, i think
anewuser has quit [Ping timeout: 245 seconds]
nirved is now known as Guest34695
Guest34695 has quit [Killed (niven.freenode.net (Nickname regained by services))]
Kundry_Wag has quit [Ping timeout: 250 seconds]
nirved has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
robotoad has joined #lisp
resttime has quit [Quit: Leaving]
meepdeew has joined #lisp
marvin2 has joined #lisp
vms14 has joined #lisp
frodef has quit [Ping timeout: 244 seconds]
Kundry_Wag has joined #lisp
vms14 has quit [Remote host closed the connection]
Kundry_Wag has quit [Ping timeout: 246 seconds]
m00natic has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 240 seconds]
<asarch>
Thank you Bike
<asarch>
Thank you very much :-)
<asarch>
How do you separate a string in to parts and parse each part?: "my username is asarch" -> "my", "username", "is", "asarch"
<Bike>
there's a library called split-sequence that can do that, or ppcre is more general.
<asarch>
Thank you Bike :-)
TonCherAmi has quit [Quit: Quit]
<Xach>
there are so many options
<permagreen>
I literally wrote my own function to do that a little while back because I was too dumb to think of looking for an existing library. At least it was a good exercise.
<Bike>
as things to nih, it could be worse
<Bike>
it's, like, fairly simple.
Oladon has joined #lisp
<fiddlerwoaroof>
I also wrote my own split function because the existing ones were too slow on largish inputs
<fiddlerwoaroof>
I forget what the use-case was
<fiddlerwoaroof>
I think I had something like a 4GB CSV file and both cl-ppcre and split-sequence were slower than python's split method
<aeth>
neither are really designed to be fast
<aeth>
Splitting an array is a lot less common in CL than in some languages, though, because nearly everything works with a start and an end.
<aeth>
(Except, of course, when someone writes an API that doesn't match the built-in CL APIs)
<fiddlerwoaroof>
I generally like parsing files as soon as possible, so I don't have string manipulation everywhere
<fiddlerwoaroof>
I find, though, that it's sometimes more useful to use arrays diplaced into your string rather than actual splitting
<aeth>
When I parse I do the (subseq foo a b) as late as possible to get strings when necessary because most of the parsed things ime, at least with what I've done, don't need to be strings at all.
undiscovered has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
meepdeew has quit [Remote host closed the connection]
Kundry_Wag has quit [Ping timeout: 268 seconds]
meepdeew has joined #lisp
robotoad has quit [Quit: robotoad]
robotoad has joined #lisp
vms14 has joined #lisp
verisimilitude has joined #lisp
mulk- has joined #lisp
benkard has quit [Ping timeout: 272 seconds]
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 250 seconds]
Khisanth has quit [Ping timeout: 250 seconds]
akoana has left #lisp ["Leaving"]
moei has joined #lisp
Khisanth has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 246 seconds]
jkordani has quit [Read error: Connection reset by peer]
<equwal>
Yeah reddit is probably hiding it, you'll find the comment if you search my reddit username "bjyo"
<beach>
OK.
<equwal>
I'm not sure why I thought you mentioned notepad; I must have made up that memory later due to how relevant it seemed to me.
<beach>
Heh, maybe so.
<equwal>
It is a horrible editor for Windows.
dddddd has quit [Remote host closed the connection]
omilu has joined #lisp
<beach>
I see. I only used Windows briefly for an hour a week some 20 years ago.
<beach>
It lasted a few months. So my total Windows exposure is at most 20 hours.
<equwal>
You are a very fortunant.
<beach>
I know.
<equwal>
Well anyway
<beach>
Right, thanks for spreading the word.
<equwal>
Thanks
anewuser has joined #lisp
_whitelogger has joined #lisp
ebrasca has quit [Remote host closed the connection]
rumbler31 has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 268 seconds]
karlosz has quit [Quit: karlosz]
ahungry has quit [Remote host closed the connection]
ahungry has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
mrcom has joined #lisp
ahungry has quit [Remote host closed the connection]
atgreen has quit [Ping timeout: 246 seconds]
housel has quit [Ping timeout: 268 seconds]
housel has joined #lisp
rippa has joined #lisp
Lycurgus has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
vms14 has quit [Quit: Leaving]
anewuser has quit [Quit: anewuser]
iovec has quit [Quit: Connection closed for inactivity]
_whitelogger has quit [Remote host closed the connection]
Bike has quit [Quit: Lost terminal]
_whitelogger has joined #lisp
<LdBeth>
verisimilitude: Emacs is not capable for oneline HTML :(, I gave it a try and it stuck forever
<LdBeth>
Emacs stucks at lone line
krwq has joined #lisp
<LdBeth>
*long
<verisimilitude>
I do it just fine.
<verisimilitude>
You could always just disable highlighting.
<krwq>
hey, because i'm from poland i got to ask this question. was lisp based on polish notation? it was invented 7 years earlier than lisp if i read correctly
<verisimilitude>
Polish notation is far older than Lisp.
<krwq>
i can see that - natural language is based on polish notation
<verisimilitude>
A cursory check tells me it was created in 1924.
<krwq>
but for some reason it's called polish notatiomn
<beach>
"The description "Polish" refers to the nationality of logician Jan Łukasiewicz,[2] who invented Polish notation in 1924."
<krwq>
i see you were just correcting the year
<verisimilitude>
I just checked the Wikipedia page, even though I vehemently dislike Wikipedia; I figured it was good enough for a year, though.
<krwq>
so even if he invented it in 1924 it still was published only on 1951
<krwq>
in his book
<krwq>
but anyway the question was about if lisp origins in that
<krwq>
or was mc carthy aware of polish notation name
<verisimilitude>
You could read McCarthy's papers.
<krwq>
there was no internet at that time
<verisimilitude>
The prefix notation for general functions was already established, I believe.
<LdBeth>
verisimilitude: even in fundamental-mode, it’s a issue related to font display on Windows
<verisimilitude>
Don't you just need to do some regular expression removal, LdBeth?
<krwq>
it was kinda a wartime i guess in between invention and publishing
<LdBeth>
verisimilitude: If it’s my own computer I can come up with more than ten ways to do it
<LdBeth>
Polish notation and RPN are used to PREVENT brackets
<LdBeth>
So...
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 244 seconds]
orivej has joined #lisp
jack_rabbit has joined #lisp
angavrilov has joined #lisp
verisimilitude has quit [Remote host closed the connection]
vms14 has joined #lisp
slyrus1 has joined #lisp
<krwq>
LdBeth: the idea of polish notation is that you first say what function you want to use and then say arguments. in lisp eval is: read first symbol in a list and then arguments to it - so lisp went 1 level of abstraction further - but it's the polish notation which defined how to represent it
meepdeew has quit [Remote host closed the connection]
mrcom has quit [Read error: Connection reset by peer]
amerlyq has quit [Quit: amerlyq]
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
Kundry_Wag has joined #lisp
_whitelogger has joined #lisp
Lycurgus has quit [Quit: Exeunt]
orivej has quit [Ping timeout: 250 seconds]
orivej has joined #lisp
TonCherAmi has joined #lisp
mrcom has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
thodg has joined #lisp
acolarh has quit [Ping timeout: 246 seconds]
fortitude has quit [Remote host closed the connection]
buffergn0me has quit [Remote host closed the connection]
buffergn0me has joined #lisp
Kundry_Wag has joined #lisp
jprajzne has joined #lisp
Kundry_Wag has quit [Ping timeout: 250 seconds]
acolarh has joined #lisp
rozenglass has quit [Ping timeout: 258 seconds]
krwq has quit [Remote host closed the connection]
jack_rabbit has quit [Ping timeout: 264 seconds]
rozenglass has joined #lisp
peey has joined #lisp
heisig has joined #lisp
acolarh has quit [Ping timeout: 244 seconds]
peey has left #lisp [#lisp]
robotoad has quit [Quit: robotoad]
Oladon has quit [Quit: Leaving.]
knicklux has joined #lisp
akoana has joined #lisp
<pjb>
minion: memo for krwq: you are wrong. The internet was invented a very long time ago. Since the invention of paper, usenet took off: people wrote posts on paper, little packets that were transported thru a network of messengers from people to people. Some people made copies of the packets to diffuse them faster to more people. They were forwarded for more exposure, answered, etc. The system was then improved by the universities
<pjb>
with nntp there were repositories of articles called "university libraries", where scholars and students to find and read old articles, classified by matter.
<minion>
Remembered. I'll tell krwq when he/she/it next speaks.
<pjb>
minion: memo for krwq: with nntp there were repositories of articles called "university libraries", where scholars and students to find and read old articles, classified by matter.
<minion>
Remembered. I'll tell krwq when he/she/it next speaks.
<pjb>
minion: memo for krwq: It was a little slower than the current internet, but it didn't take 27 years to swap articles between Poland and the USA…
<minion>
Remembered. I'll tell krwq when he/she/it next speaks.
<pjb>
LdBeth: indeed. But in lisp we like to have 1- a variable number of arguments, and 2- know the number of argument without knowing the operator (eg. to be processed by macros), and foremost 3- use the notation to denote random data, including lists that start by lists. So brackets are needed in lisp.
knicklux has quit [Ping timeout: 250 seconds]
jack_rabbit has joined #lisp
meepdeew has joined #lisp
orivej has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
knicklux has joined #lisp
acolarh has joined #lisp
cage_ has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 240 seconds]
Zaab1t has joined #lisp
FreeBirdLjj has joined #lisp
iovec has joined #lisp
akoana has left #lisp ["Leaving"]
_whitelogger has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
hiroaki has joined #lisp
FreeBirdLjj has quit [Ping timeout: 258 seconds]
akoana has joined #lisp
meepdeew has quit [Remote host closed the connection]
Jachy has quit [Read error: Connection reset by peer]
no-defun-allowed has quit [Read error: Connection reset by peer]
xylef has quit [Read error: Connection reset by peer]
djeis[m] has quit [Remote host closed the connection]
Gnuxie[m] has quit [Read error: Connection reset by peer]
illandan[m] has quit [Remote host closed the connection]
Manny8888 has quit [Remote host closed the connection]
kammd[m] has quit [Remote host closed the connection]
sielicki has quit [Remote host closed the connection]
LdBeth has quit [Remote host closed the connection]
akanouras has quit [Remote host closed the connection]
irdr has quit [Max SendQ exceeded]
irdr has joined #lisp
vms14 has quit [Quit: Leaving]
rozenglass has quit [Read error: Connection reset by peer]
makomo has joined #lisp
Manny8888 has joined #lisp
yvy has joined #lisp
dale has quit [Quit: dale]
random-nick has joined #lisp
FreeBirdLjj has joined #lisp
hiroaki has quit [Ping timeout: 264 seconds]
hiroaki has joined #lisp
orivej has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
hiroaki has quit [Ping timeout: 250 seconds]
xylef has joined #lisp
no-defun-allowed has joined #lisp
Jachy has joined #lisp
illandan[m] has joined #lisp
sielicki has joined #lisp
neosloth has joined #lisp
hiroaki has joined #lisp
Kundry_Wag has joined #lisp
frodef has joined #lisp
LdBeth has joined #lisp
<LdBeth>
pjb: the idea of variable arity is introduced later, the very early lisp functions accept only fixed number of arguments
Kundry_Wag has quit [Ping timeout: 268 seconds]
<pjb>
LdBeth: nope. It was the core principle leading to the invention of lisp: meta-programming, representing programs as data, and processing them was the first design principle of lisp. Having operators of variable arity, and foremost, being able to process symbolic expressions without knowing the arity of operators was essential.
<pjb>
LdBeth: Otherwise, by the influence of lambda calculus. all operators would have had only one argument…
mrcom has quit [Read error: Connection reset by peer]
<pjb>
The first example of lisp code, after eval, was symbolic derivation.
frodef has quit [Ping timeout: 260 seconds]
<LdBeth>
I think meta programming stuff, along with macro, comes more later
<pjb>
Read JMC!
<LdBeth>
I don’t think there’s any function introduced in RFSETCM has variable arguments
<LdBeth>
Instead they accept a list when multiple arguments is desired
<pjb>
But plenty in lisp. LIST APPEND PLUS TIMES etc.
<pjb>
Not counting the special operators or macros, of course: COND, PROGN, etc.
<makomo>
hello
pierpal has quit [Ping timeout: 245 seconds]
<LdBeth>
In the RFSETCM List is just a notation, addition is didactic, there’s only IF special form, and no PROG, although they almost came up like what we know in these days in LISP1.5
<pjb>
Well this is #lisp, not ##lisp.
mrcom has joined #lisp
<LdBeth>
And the idea of S-exp comes even earlier than RFSETCM. :)
<pjb>
In AIM-8, there's mention of an alternative lisp "4.2 Binary Lisp".
<makomo>
minion: memo for jackdaniel: i finally wrote a reply for our backquote thing. i've posted the links above. feel free to reply whenever (leaving a memo would be good because i'm not always online).
<minion>
Remembered. I'll tell jackdaniel when he/she/it next speaks.
Kundry_Wag has joined #lisp
atgreen has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
shifty has quit [Ping timeout: 272 seconds]
varjag has joined #lisp
yvy has quit [Ping timeout: 252 seconds]
<jackdaniel>
makomo: please take a look on query
<minion>
jackdaniel, memo from makomo: i finally wrote a reply for our backquote thing. i've posted the links above. feel free to reply whenever (leaving a memo would be good because i'm not always online).
robdog_ has joined #lisp
Vohlenzer has joined #lisp
<Vohlenzer>
Hey. I'm currently enjoying The Little Schemer. I work as a c# developer. In my business code I use IoC / Dependency Injection to hide away configurable connection strings, urls and settings. What's the equivalent in lisp / functional programming?
<Vohlenzer>
Most simple thing I can think of is a function like; GetSetting(settingName) but I wondered if there's something else.
<pjb>
Well, in #scheme you'd get a more precise scheme answer.
<pjb>
Here, in Common Lisp, we can use dynamic variables for such things.
<pjb>
But otherwise, you can implement any technique you want, Common Lisp is a general programming language.
<pjb>
Even better, it's a meta-programming programming language.
<pjb>
Vohlenzer: also, there are a few things, such as logical pathnames, to provide an indirection for such configurations.
Kundry_Wag has joined #lisp
<pjb>
The translation of logical pathname to physical pathname can be configured from a file (using LOAD-LOGICAL-PATHNAME-TRANSLATIONS), or explicitely.
dddddd has joined #lisp
Kundry_Wag has quit [Ping timeout: 272 seconds]
JetJej has joined #lisp
scymtym has quit [Ping timeout: 246 seconds]
JetJej has quit [Client Quit]
desperek has joined #lisp
<desperek>
hi
<desperek>
anyone here using roswell?
<desperek>
can i specify different place for .roswell?
<desperek>
or wait.. i just need to do a link :d
<Xach>
Vohlenzer: defvar/defparameter is one way
<desperek>
oh htere's roswell_home..
furrymcgee has left #lisp [#lisp]
xrash has joined #lisp
robdog_ has quit [Remote host closed the connection]
lavaflow has quit [Ping timeout: 268 seconds]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 246 seconds]
Bike has joined #lisp
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
Lycurgus has joined #lisp
heisig has quit [Quit: Leaving]
atgreen has quit [Ping timeout: 252 seconds]
xkapastel has joined #lisp
fitzsim has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
makomo has quit [Ping timeout: 260 seconds]
<Vohlenzer>
pjb: Thanks, some keywords for me to learn :)
makomo has joined #lisp
scymtym has joined #lisp
Vohlenzer has quit [Ping timeout: 252 seconds]
ggole has joined #lisp
atgreen has joined #lisp
fitzsim has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
quazimodo has quit [Ping timeout: 246 seconds]
wxie has joined #lisp
atgreen has quit [Ping timeout: 246 seconds]
drot has quit [Quit: Quit.]
matijja has joined #lisp
drot has joined #lisp
undiscovered has joined #lisp
makomo has quit [Ping timeout: 250 seconds]
<aeth>
Instead of GetSetting(settingName) you can do (setting-name settings) and just work with an object or a struct or even a hash table (but you'd have to define your own accessors if you use a hash table)
muyinliu has joined #lisp
<muyinliu>
It's there function compare-and-swap exist in CMUCL?
<beach>
muyinliu: I believe SBCL has it. Do you have any particular reason to stick to CMUCL?
<muyinliu>
beach: Thanks. Not really, just be curious. How about CCL?
khisanth_ has joined #lisp
<beach>
Don't know. Sorry. Why are you curious?
<beach>
... about that.
<beach>
None of my business, I guess.
Khisanth has quit [Ping timeout: 258 seconds]
<phoe>
muyinliu: ask on #ccl, In believe there is such a thing
Lycurgus has quit [Quit: Exeunt]
<muyinliu>
phoe: Thanks.
cage_ has quit [Remote host closed the connection]
asarch has joined #lisp
flazh has joined #lisp
wxie has quit [Ping timeout: 240 seconds]
djeis[m] has joined #lisp
kenanb has joined #lisp
matijja has quit [Quit: rcirc on GNU Emacs 26.1]
matijja has joined #lisp
kenanb has left #lisp [#lisp]
muyinliu has quit [Read error: Connection reset by peer]
<sindan>
Is there some library for doing something similar in Clength?
<sindan>
CL*
<aeth>
Well, there are French nerds in CL.
<sindan>
It's a start
Kundry_Wag has joined #lisp
<sindan>
I ask bc they only do rare french websites with that, so something with more breatdh would be nice
marvin2 has quit [Ping timeout: 240 seconds]
<sindan>
alternatively, how would I look for this among 3rd party libraries? some keywords that can give results? "web text retrieval" or something like that don't narrow it down well
Kundry_Wag has quit [Ping timeout: 240 seconds]
slyrus1 has quit [Ping timeout: 250 seconds]
makomo has quit [Quit: WeeChat 2.2]
<sindan>
I find it hard to believe that no one has tried to do some framework to retrieve information from the web using console tools.
<thrig>
they have. website operators keep fiddling with the APIs or turning them off, etc
drewc has joined #lisp
<sindan>
ofc the web is unstable. I don't mind some maintenance, but I'm looking for some intelligently designed framework where the process is divided into sensible phases, with easily accessible/changeable plumbing.
<sindan>
The goal would be to react to the next "scrum sprint" of the website with minimal pain, and keep it that way no matter what they caome up with.
hiroaki has quit [Ping timeout: 258 seconds]
<Jachy>
Websites aren't under any obligation to change things a sprint at a time so the pain may be great... I've used https://en.wikipedia.org/wiki/JDownloader to archive some stuff off deviantArt, you might be able to use it through ABCL, but it's kind of a sketchy project...
<Jachy>
You might find projects out there using Selenium WebDriver though.
<thrig>
yeah, low demand, low reward, lots of work, walls of javascript
<phenoble>
Hi everyone
<phenoble>
Can anyone explain this observation to me that I've just made?
<phenoble>
Well, I'd expect that literal to remain the same across different function calls.
<_death>
well, you should change your expectation
<phenoble>
hah, that did it
<phenoble>
Obviously so. I'm rather surprised by this.
robotoad has joined #lisp
<phenoble>
_death: Do you have any hints on what to look up in more detail to understand that which is going on there?
<_death>
one nice thing about literals is that they can be constructed once
<_death>
well, it looks like elisp to me, so I'm guessing the elisp manual
egp_ has joined #lisp
<aeth>
phenoble: Modifying literals like '(1 2 3) and #(1 2 3) and "123" is undefined behavior, but unfortunately it is not normally caught. Sometimes, the compiler can catch it, especially if it's within the same function. SBCL can catch this particular one and gives the warning "Destructive function SB-KERNEL:%RPLACA called on constant data: (1 2 3)."
<Jachy>
(copy-list '(1 2 3)) is an option too
<aeth>
phenoble: you can think of '(1 2 3) as being an essentially immutable version of (list 1 2 3), except without always being able to catch an attempted mutation at compile or run time.
<sindan>
Jachy the selenium driver has given me the best results, since many websites are partially or entirely js-rendered, there is nothing else that will do, and since the classical sites are also accessible via webdriver, that's what I use for everything
<phenoble>
aeth: thank you, I was kindof expecting this to be somewhat undefined. For if it were not, I'd be surprised for this to not have found its way into common programming idioms as a technique.
SaganMan has quit [Quit: WeeChat 1.6]
<aeth>
phenoble: Using literals can be useful for something that's internal to a function because if it's never going to leave the function, the compiler can treat it more like a truly immutable object. e.g. (nth 4 '(1 2 3 4 5)) can safely be compiled as 5 if the compiler is smart enough.
<phenoble>
Jachy: Yes, though I'd suppose (list '(1 2 3)) to be more idiomatic.
<aeth>
(and my example is probably more likely to be compiled as the constant 5 than (nth 4 (list 1 2 3 4 5)))
<phenoble>
aeth: So '(1 2 3) is to be thought of being immutable, except that it mutates. Sometimes.
<phenoble>
^^
<phenoble>
aeth: I'll be more careful when using (/writing strangely-failing unit-tests) literals in the future. Thank you
<Jachy>
sindan: Yeah, there's also a pressure on those complex sites to not make too big of changes internally at once since they typically use selenium for their own test automation and want to change as few page objects as possible.
<aeth>
phenoble: Literals can be thought of as immutable if it stays within a function, and your compiler might be able to optimize it as such and catch attempted mutations within the function (obviously, both are implementation-specific). Literals passed between functions (not inline and not in the package CL) and especially between files/compilation-units might not be caught when you attempt to mutate them, though.
<aeth>
In that case they're more like a persistent-across-runs constant.
<aeth>
In that the data store itself is constant, but the things stored might be changed by something.
<aeth>
So a constant pointer, I guess.
Lycurgus has quit [Ping timeout: 268 seconds]
<aeth>
But, of course, there's no guarantees in that case that mutation will behave like you want, so don't rely on that behavior.
<sindan>
basically don't include compiler optimizations in explanations of how code works
<phenoble>
aeth: I see
<sindan>
because the optimizations are designed to be functionally identical to unoptimized code but they can have side effects
<phenoble>
sindan: Well, in this case you may clearly not be able to leave out compiler mechanics in understanding what you see.
<aeth>
sindan: (nth 4 '(1 2 3 4 5)) is more likely to be optimized into 5 than (nth 4 (list 1 2 3 4 5))) so it's worth noting that imo.
<_death>
phenoble: the issue is that you were trying to modify a literal.. that has undefined consequences.. if you don't try to modify literals, you can expect them to remain as they were (if you don't violate other rules of the language)
<sindan>
aeth phenoblesorry when I said "compiler optimizations" I meant "all possible compilers"
cage_ has joined #lisp
space_otter has joined #lisp
<sindan>
meaning that one should not rely on them. Be familiar, ok, maybe...
<dale>
I've never thought of the difference between (let ((x '(1 2 3))) and (let ((x (list 1 2 3))) in detail before. Is it fair to think of the the literal '(1 2 3) version of that form as binding x to some global list value that the compiler created somewhere in memory, whereas the (list) version always calls list upon entering the form?
<_death>
phenoble: (list '(1 2 3)) creates a cons whose car references a literal object and cdr is nil.. so it's ok to change the car of that cons, but not what the car references
<phenoble>
I am surprised to see that nowhere in Emacs' history ( - yes, it was a snipper of elisp) did anyone find it necessary to introduce a change to the compiler to have this detected.
<phenoble>
Are there cases where mutation of literals is desired, even necessary, or advantageous?
X-Scale has quit [Ping timeout: 240 seconds]
<aeth>
dale: It could be stack allocated instead of heap allocated, though. (Even without a declaration of dynamic-extent, since that's just a hint)
<phenoble>
_death: sorry, (list 1 2 3) was what I had in mind
undiscovered has quit [Ping timeout: 256 seconds]
<dale>
aeth: OK, and if an implementation did decide to allocate it on the stack then we would not expect mutations in one call to affect future calls, right?
X-Scale has joined #lisp
<aeth>
I think so. But I also think that it would only happen if it could determine that you're not passing it to some arbitrary #'foo that could mutate it.
<_death>
phenoble: in order to signal an error, such literals would have to have their own specialized storage.. this complicates things.. Lisp programmers learn to avoid such situations by always consing new structures if they suspect they may need to be modified, and being weary when modifying such structures, perhaps making sure to copy them first
<dale>
I've definitely fallen into this trap before but never thought about it in detail, so this conversation has been helpful.
<thrig>
SORT tends to mangle the list, for various reasons
undiscovered has joined #lisp
thodg has quit [Ping timeout: 244 seconds]
<phenoble>
_death: I have indeed been struggling with the question on how "functional" / immutable the code I've been writing these past few days should be.
<aeth>
I *think* the best way to think about a literal (and I could be wrong) is essentially as a constant pointer. So x would constantly point somewhere (at least at that point of time in the execution of the code, since x itself could be SETFed later on), and that place where it's pointing could be modified. Of course, that's just a way of thinking about it since the implementation's free to move the actual memory location.
<phenoble>
s/the code/the data that gets handed around in the code I write/
<Bike>
dunno why you need to bring pointers into it.
<aeth>
Bike: because conses are usually thought of in terms of pointers. [1|-]->[2|-]->[3|/]
<aeth>
So it's easy to think of the literal as constantly x->[1|-]->[2|-]->[3|/]
<Jachy>
Just think of it in terms of ownership. Literals are owned by the system, not you, so don't go modifying them even if you can.
<Bike>
can't you just think of a literal as a literal object. it's like altering program text.
emaczen has quit [Ping timeout: 252 seconds]
<sindan>
Bike exactly
<aeth>
Idk, for me the arrow to the box conses works. I guess people think about things differently.
<Bike>
if you have (let ((x '(1))) ...) you can setf x, which would be the "pointer" or whatever, but you can't alter the car or the cdr of the cons which is what, two pointers?
<_death>
phenoble: my advice is to avoid modification.. after you have something working, it may be that efficiency concerns will make it worthy.. sometimes modification is the answer (i.e. for some algorithms and data structures), but as a beginner, it's best to first avoid it
<aeth>
Bike: Well, it's x->[1|/] at that first point in execution. If you SETF the x, then you're having a different -> but when you come back around to executing that initial binding code again you're going back to x->[1|/] where the -> is the same -> from before, pointing to the same, original box.
<Bike>
okay?
<phenoble>
_death: Well, there does not seem to be a deep-copy operation in any of the lisps. So avoiding modification sure sounds easier as it is.
verisimilitude has joined #lisp
<_death>
phenoble: deep copy of what?
<phenoble>
_death: I've been working with some deeply-nested lists lately.
<_death>
phenoble: for conses, there's copy-tree
<phenoble>
But, copying the whole data structure for changing the value of one of its elements, just doesn't seem... right.
<Bike>
by the way, does elisp even have similar rules for literals
<aeth>
Bike: So I personally think that helps not be surprised by (setf (car x) 42) then meaning it becomes x->[42|/] the next time around in the same image because the literal is making the "->" be exactly the same each run, at least at that point in the code execution (since you could later setf x itself)
<aeth>
Bike: And, yes, I noticed that this was a question about elisp after I answered the question!
<_death>
phenoble: correct.. so either avoid modification or make sure nothing in that structure is a literal or shared with something that doesn't expect it to change
<Bike>
it's just, you're taking three paragraphs to explain your explanation of "you can't modify literals"
<aeth>
Bike: 3 paragraphs or 3 simple slides, but unfortunately IRC hasn't integrated slides yet.
<Jachy>
phenoble: fset exists for a reason :)
<_death>
Bike: I see a mention in EQ operator documentation.. and I'm sure (or hope...) there's more explicit discussion somewhere in that manual
<phenoble>
Yay, so on to keeping all my structures free of literals then...
<phenoble>
... what about the backquote operator: does it create lists or literals?
<Bike>
literals
<phenoble>
argh
<aeth>
phenoble: This is a Common Lisp channel so you've been getting Common Lisp answers, which might be subtly different than Emacs Lisp answers.
<Bike>
well, it mentions coalescence in the comment there
<phenoble>
Jachy: yes, I'm aware of that semantic, thanks
<_death>
Bike: in my emacs (compiled 2018-12-13) the manual contains another paragraph saying you should never modify literals
<Bike>
oh, huh.
<Bike>
weird place to put it.
<phenoble>
_death: where exactly?
<_death>
yeah.. but for Common Lisp, phenoble, there's good discussion about structure sharing in Paul Graham's book (ANSI Common Lisp), and good discussion about keeping things functional in Paul Graham's book (On Lisp)
<phenoble>
_aeth: I am aware that the answers from you may not apply to elisp, thank you.
<phenoble>
_death: Funny that you mention it - I've started reading Graham's On Lisp a couple of days ago.
<_death>
now, Graham's style is a bit idiosyncratic, but it's good for a newbie to take this approach at first
<_death>
seems the online manual on gnu.org is from 2017/04/28
<aeth>
Graham has some very weird views on Lisp, which you see when he attempted to write his own Lisp
<_death>
phenoble: in the most recent manual, you can find it in section 2.7
<pjb>
phenoble: there is not that much difference between C and Lisp actually. (Lisp is even lower level than C in some aspects). The difference is that lispers don't like to shoot themselves in the foot,s o they don't try to mutate literals (and they don't do other silly things C programmers like to do). Just have a look at comp.lang.lisp to see how dumb they are.
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
<aeth>
pjb: Well, it's more about Lispers wanting to write portably.
<phenoble>
_death: that paragraph is right on the issue indeed. Good it made its way into the manual last June. The public html/pdf versions are void of this information though, and on stackoverflow, people do treat quoted literals as identical to structures created with list and cons.
gravicappa has quit [Ping timeout: 250 seconds]
<aeth>
The #1 sin here is to write to a specific implementation. (And you could even have a major contributor to one of the other implementations complain personally here.) Not abusing UB is just a side effect.
<_death>
phenoble: learn to distrust :)
<pjb>
Also, some scheme pedagogical material and implementation (specifically Racket) are quite evil there. They would display (list 1 2 3) -> '(1 2 3) instead of (list 1 2 3) -> (1 2 3).
<aeth>
Racket has its own cons representation, which are immutable.
<pjb>
Yes, plus that.
<_death>
pjb: ouch..
<aeth>
This is a case where learning Racket first will hurt your understanding of Scheme/CL/elisp
<phenoble>
pjb: I see
<_death>
this convention of using "'(1 2 3)" to mean the three element list just looks worse now ;)
pierpal has quit [Ping timeout: 258 seconds]
<aeth>
yes it should be '(0 1 2) so NTH lines up
<phenoble>
Well, I'd vote for both interpreters and type-predicates to differentiate already. In elisp, (listp '(1 2 3)) evaluates to t, and both (list 1 2 3) and '(1 2 3) evaluate to (1 2 3)
<phenoble>
But as aeth (or _death) mentioned earlier, might be about storage space, which might be difficult to detect. (-> why is there no "literal bit flag" then, attached to literal types, or something?)
<aeth>
Tagging #(1 2 3) differently from (vector 1 2 3) or (make-array 3 :element-type 'character :initial-contents '(#\1 #\2 #\3)) differently from "123" so you could actually make the literal version a proper immutable that would e.g. always error if you try to mutate it could work. For '(1 2 3) that would be more difficult because it's really '(1 . (2 . (3 . NIL)))
pierpal has joined #lisp
<_death>
you should also know about calling convention rules.. if you don't know whether a function will attempt to modify an object or not, pass a copy.. if you write a function, assume you can't modify an object, unless you intend to write a destructive function, and then you should document that it is so
<aeth>
You could document or you could just copy the Scheme convention and end it with !
<aeth>
(There isn't a perfect match to it in CL, unlike the p or -p that matches with Scheme's ? convention)
<_death>
let Scheme conventions stay with Scheme
<_death>
in CL sometimes such operators are prefixed with N (for non-consing), but what matters is their documentation
<aeth>
Instead of documenting a type, use DECLARE or CHECK-TYPE (or a macro that can generate either, like I often do). Instead of documenting that it's destructive, use a convention that makes it clear. Saves a lot of documentation that would otherwise have to be maintained.
frodef has joined #lisp
undiscovered has quit [Remote host closed the connection]
<aeth>
"non-consing" might be misleading because you can cons all you want in that function, the important thing is that it mutates something
pierpal has quit [Ping timeout: 240 seconds]
<phenoble>
_death: indeed, I've wished for such semantics in function specification in elisp oftentimes
<aeth>
nfoo also has the same problem as foop. There's no clear distinction between the name itself and the convention, especially for automated tools that might want to e.g. highlight certain things differently. You already see this in practice for another convention. Custom define-foos are automatically highlighted in Emacs as if they were built-ins, but custom deffoos are not.
<phenoble>
Well, explicit mechanisms that is, baked into the language, similar to what C++ does with e.g. making it possible to explicitly pass references.
undiscovered has joined #lisp
<phenoble>
(I think, you meant taking care of passing copies to the function yourself.)
<_death>
I think names of functions should not be "adorned" with this or that property indications.. what matters is their documentation.
buhman has quit [Ping timeout: 268 seconds]
<_death>
oh, if Microsoft had developed a Hungarian Lisp..
<aeth>
The only reliable documentation is the HyperSpec because any violation in an implementation is a bug. Everything else is just M-. and read the source if there's an issue ime.
<_death>
the -P convention is OK, but still..
<_death>
it's more like MAKE-/WITH-/DO than N or F..
<_death>
(or Q...)
<aeth>
If half of your functions are destructive and half are consing then it really helps to have a very clear naming convention. e.g. vec+ vs. vec+-into! makes it very clear that vec+ will return a new vec and vec+-into! sums them into the first argument. (In this particular case -into itself might be sufficient, like map-into, but it doesn't hurt to be extra clear imo.)
<_death>
I guess because being a predicate is much more essential to an operator than being destructive
<aeth>
It really depends on the particular API you're designing.
notzmv has quit [Ping timeout: 250 seconds]
<_death>
aeth: sure.. I used vec+= for that.. but I'm talking about a general convention
<aeth>
+= doesn't really seem as clear to me. "-into" is out of the standard, so people might have seen it before.
<Jachy>
Maybe splitting them on package lines is better. Or just relying on suggestive names.
<Jachy>
But yeah, "it depends" is a safe position. :)
lavaflow has joined #lisp
anewuser has quit [Ping timeout: 258 seconds]
trittweiler has quit [Ping timeout: 240 seconds]
ggole has quit [Quit: ggole]
scymtym has quit [Ping timeout: 260 seconds]
pierpal has joined #lisp
jprajzne has quit [Read error: Connection reset by peer]
pierpal has quit [Ping timeout: 258 seconds]
jprajzne has joined #lisp
alexshendi has joined #lisp
puchacz has joined #lisp
<puchacz>
hi, there is nothing wrong with having a class hierarchy that has different metaclasses, does it?
pierpal has joined #lisp
<puchacz>
I use postmodern, and it has metaclass called dao-class, which maps to SQL table, and I want to use these classes with some other classes that have no SQL mapping. it seems to work, and for what I recall from this chat, it is legal.
shifty has joined #lisp
<djeis[m]>
Generally speaking, if subclassing cross-metaclass works that's because one of the two metaclasses explicitly supports mixing with the other one.
<djeis[m]>
Because cross-metaclass subclassing has to be explicitly turned on for particular classes/metaclasses
pierpal has quit [Read error: Connection reset by peer]
<puchacz>
djeis[m] will it be in metaclass definition?
<puchacz>
and what am I looking for?
<djeis[m]>
There's a generic function called validate-superclass which, by default, returns nil for cross-metaclass superclasses.
<djeis[m]>
For cross-metaclass subclassing to even be accepted by defclass there must be a method added to validate superclass which lets that work.
<puchacz>
is this the only method? the one that I pasted?
<puchacz>
(this one says T as you see)
<djeis[m]>
Yea, that lets DAO classes inherit from standart classes.
<djeis[m]>
*standard
<puchacz>
great, thanks!
<djeis[m]>
That's not where the explicit support is added, per say- there are other places where the dao-class metaclass needs to handle standard-class stuff. But that method wouldn't be there if the author of postmodern wasn't expecting you to do that.
<djeis[m]>
And if that method weren't there then defclass would error if you tried.
<puchacz>
makes sense
pierpal has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
<puchacz>
as a matter of fact, I can't see any other standard-class reference when grepping postmodern
<puchacz>
the only other place is (defclass dao-class (standard-class) .... )
<djeis[m]>
Well, it's entirely possible that said handling doesn't explicitly require referencing standard-class, or that dao-class is already close enough to standard-class that it doesn't need anything special.
<puchacz>
okay, I am not worried then :)
pierpal has joined #lisp
<djeis[m]>
Do you have to explicitly note what slots in a dao class are tied to the db model?
phoe has quit [Quit: leaving]
<djeis[m]>
I haven't looked at postmodern in a while lol
jinkies has joined #lisp
zotan has quit [Ping timeout: 250 seconds]
trittweiler has joined #lisp
zotan has joined #lisp
jack_rabbit has joined #lisp
<puchacz>
djeis[m], yes you have to mark them as :column t
<puchacz>
maybe this is why there is unwanted interaction
<djeis[m]>
Oh, yea, then it's probably fine.
pierpal has quit [Ping timeout: 246 seconds]
<djeis[m]>
I'd bet that a dao-class without any columns is basically just a standard-class then.
<djeis[m]>
And just reuses a lot of the standard-class machinery.
<puchacz>
ok
makomo has joined #lisp
trittweiler has quit [Ping timeout: 246 seconds]
pioneer42 has left #lisp [#lisp]
flazh has quit [Ping timeout: 250 seconds]
meepdeew has joined #lisp
gigetoo has quit [Ping timeout: 244 seconds]
gigetoo has joined #lisp
pierpal has joined #lisp
nebg has joined #lisp
<nebg>
hello all how "SICP" can make me a better programmer ?
<nebg>
what does it teach me ?
pierpal has quit [Ping timeout: 258 seconds]
test1600 has joined #lisp
scymtym has joined #lisp
test1600 has quit [Remote host closed the connection]
<jackdaniel>
nebg: it teaches you concepts which are foundamental to computer science
test1600 has joined #lisp
<jackdaniel>
while you may program without knowing these foundations (or knowing some of them) having better knowledge about basics will make you a better programmer indeed
pierpal has joined #lisp
<jackdaniel>
i.e you may be fine with simply using floats as a data type, but understanding how they are represented, what are their limitations and adventages etc will make you more perceptive about your programs which use floats
<thrig>
I've got 16777217 problems, and float rounding isn't one of them
pierpal has quit [Ping timeout: 258 seconds]
cage_ has quit [Remote host closed the connection]
flazh has joined #lisp
<jackdaniel>
hah! good one :_)
<aeth>
thrig: are you using short-float?
<thrig>
it wouldn't be a joke in doubles, now would it
pierpal has joined #lisp
<nebg>
jackdaniel, ok which are these concepts ?
notzmv has joined #lisp
<jackdaniel>
I'd look at the table of concept instead of asking untrustworthy strangers on the internet
<jackdaniel>
contents*
pierpal has quit [Read error: Connection reset by peer]
jmercouris has quit [Remote host closed the connection]
test1600 has quit [Quit: Leaving]
meepdeew has quit [Remote host closed the connection]
pierpal has joined #lisp
meepdeew has joined #lisp
jack_rabbit has quit [Ping timeout: 264 seconds]
pierpal has quit [Ping timeout: 240 seconds]
meepdeew has quit [Ping timeout: 240 seconds]
Kundry_Wag has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Kundry_Wag has quit [Ping timeout: 272 seconds]
pierpal has joined #lisp
nebg has quit [Read error: Connection reset by peer]
anewuser has joined #lisp
pierpal has quit [Ping timeout: 258 seconds]
Selwyn has joined #lisp
marvin2 has joined #lisp
mathrick has quit [Ping timeout: 250 seconds]
pierpal has joined #lisp
mathrick has joined #lisp
pierpal has quit [Ping timeout: 268 seconds]
pierpal has joined #lisp
JetJej has quit [Quit: [Quit]]
jmercouris has joined #lisp
malm has quit [Quit: Bye bye]
pierpal has quit [Ping timeout: 240 seconds]
shifty has quit [Ping timeout: 250 seconds]
rjid has joined #lisp
Kundry_Wag has joined #lisp
pierpal has joined #lisp
Kundry_Wag has quit [Ping timeout: 244 seconds]
Oladon has quit [Quit: Leaving.]
pierpal has quit [Ping timeout: 246 seconds]
slyrus1 has joined #lisp
pierpal has joined #lisp
puchacz has quit [Quit: Konversation terminated!]
rjid has left #lisp [#lisp]
akoana has joined #lisp
pierpal has quit [Ping timeout: 258 seconds]
pierpal has joined #lisp
jinkies has quit [Ping timeout: 246 seconds]
random-nick has quit [Ping timeout: 252 seconds]
CrazyEddy has quit [Ping timeout: 258 seconds]
pierpal has quit [Ping timeout: 245 seconds]
scymtym has quit [Ping timeout: 258 seconds]
CrazyEddy has joined #lisp
yvy has joined #lisp
phoe has joined #lisp
undiscovered has quit [Remote host closed the connection]
JetJej has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 260 seconds]
phoe has quit [Remote host closed the connection]
pierpal has joined #lisp
malm has joined #lisp
jmercouris has quit [Remote host closed the connection]
plugd has joined #lisp
angavrilov has quit [Remote host closed the connection]
plugd has quit [Client Quit]
test1600 has joined #lisp
plugd has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 244 seconds]
Selwyn has quit [Remote host closed the connection]
Oladon has joined #lisp
scymtym has joined #lisp
TonCherAmi has quit [Ping timeout: 250 seconds]
p9fn has quit [Ping timeout: 252 seconds]
anewuser has quit [Quit: anewuser]
vms14 has joined #lisp
notzmv has quit [Ping timeout: 245 seconds]
notzmv has joined #lisp
space_otter has quit [Remote host closed the connection]