rumbler31 has quit [Remote host closed the connection]
verisimilitude has joined #lisp
<verisimilitude>
I keep seeing this stupid advice to avoid :USE, so I figured I'd start an argument about it here. Also, this local nicknames nonsense isn't standard and shouldn't be encouraged.
<no-defun-allowed>
Sure. Here's my two cents: eazy-opencl is decent, except that it accidentally overwrites a macro in CFFI which I presume it did not have before.
<beach>
verisimilitude: You need to tell #lisp participants that you come here mainly when you are bored and want to argue.
<verisimilitude>
That's not why I usually come here and I don't usually visit at all.
<beach>
But you said that yourself in the past.
<beach>
I am not inventing anything.
<verisimilitude>
Isn't this solved by SHADOWING-IMPORT-FROM, no-defun-allowed?
<no-defun-allowed>
No, because this is an issue with "moving" expectations.
<verisimilitude>
What's the issue, then?
<no-defun-allowed>
When eazy-opencl was written, it assumed some properties of the set of symbols CFFI exports, notably that WITH-FOREIGN-ARRAY was not exported by CFFI; but it is now.
<verisimilitude>
I suppose one of them should change, then.
Bike has quit [Quit: Lost terminal]
<no-defun-allowed>
Now eazy-opencl overwrites that macro, and code loaded after eazy-opencl that uses that macro could break in awkward ways.
<verisimilitude>
What does this EAZY-OPENCL do, anyway?
<no-defun-allowed>
It is a somewhat high-level abstraction over a OpenCL interface, which I use for my GPU-accelerated Petalisp backend.
<verisimilitude>
Is there any reason it needs the CFFI or would it be possible to interface with it in Common Lisp?
<no-defun-allowed>
Yes, OpenCL only exposes a C interface (to my knowledge).
<verisimilitude>
How unfortunate.
<no-defun-allowed>
And its use of CFFI isn't the problem here; the problem is that it :USEd CFFI and overwrote one of its macros.
<verisimilitude>
Both can be issues; anyway, this could be solved by changing either or using a CFFI before the change.
beach has quit [Ping timeout: 272 seconds]
beach has joined #lisp
<no-defun-allowed>
phoe often mentions a similar situation with Alexandria, where packages that use that could also break other packages subtly. That has a greater probability of being a problem, because more packages use Alexandria than eazy-opencl (which isn't even in Quicklisp), and it's often treated like a necessity like the CL package to use.
<verisimilitude>
I've had the misfortune of reading through code which uses Alexandria, yes. There's no little good reason, I think, to not simply add to Alexandria if it's desired. Fretting over hypothetical ``breakage'' is silly.
<no-defun-allowed>
(defpackage netfarm (:use :cl :ironclad :s-base64 :flexi-streams :split-sequence) ...) ;; There's something else I have to clean up, then.
<no-defun-allowed>
It's not really hypothetical; I just described a case where we got some breakage, and I am saying that for that one case with two seldom used packages, there are dozens of cases with Alexandria and everything that depends on it.
<verisimilitude>
Thinking about ALEXANDRIA, I'm reminded of some discussion here where it was acknowledged a very inefficient implementation was in-place, where unnecessary.
<verisimilitude>
It's fine to design a library which isn't intended to be USEd, but to advocate against it entirely is silly.
vlatkoB has joined #lisp
<verisimilitude>
An easy solution is to not use a newer version of a library unless you've audited it. This does make the accumulation of dozens of dependencies harder, though.
<no-defun-allowed>
Sure, I'll name a case where it is useful: in decentralise2, I have a package decentralise-utilities that has parsers and generators for some of my internal formats, and some other macros.
<no-defun-allowed>
That is fine to USE, because I will always have control over that.
oxum_ has joined #lisp
oxum_ has quit [Remote host closed the connection]
oxum has quit [Read error: Connection reset by peer]
oxum has joined #lisp
asarch has joined #lisp
oxum has quit [Ping timeout: 260 seconds]
oxum has joined #lisp
<asarch>
How do you convert a string into a symbol and vice versa?
Theseus has quit [Quit: Leaving]
oxum has quit [Remote host closed the connection]
shangul has joined #lisp
<no-defun-allowed>
clhs intern
shangul has quit [Read error: Connection reset by peer]
oxum_ has quit [Remote host closed the connection]
v_m_v has quit [Ping timeout: 258 seconds]
oxum has joined #lisp
oxum has quit [Remote host closed the connection]
<White_Flame>
olde timey lisps would break apart symbols into lists of single-character symbols for processing, then intern them back into a single symbol
oxum has joined #lisp
<White_Flame>
foo => (f o o) => concatenate => (f o o - b a r) => intern => (foo-bar)
<White_Flame>
erm,without parens for the last one
buffergn0me has quit [Ping timeout: 240 seconds]
<asarch>
For example, the user will input random numbers until he inputs 'q' to exit and do the average of those numbers: http://paste.scsys.co.uk/587907
<beach>
asarch: That won't work. MAKE-SYMBOL creates an uninterned symbol.
dale has quit [Quit: My computer has gone to sleep]
<asarch>
I now, even (string=) won't work when you type "1": The value 1 is not of type (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING SYMBOL CHARACTER)
<asarch>
*I know
<beach>
asarch: Also, why do you not call READ in the LET binding, rather than having a default LET binding and then assigning to it?
<beach>
asarch: And when you expose code, you should make sure it is indented correctly. Common Lisp programmers rely on indentation to see the structure of the code. If you have the wrong indentation, you force people to count parentheses which is not polite.
<beach>
asarch: Did you notice the CL-USER> that starts the line of the LET?
<beach>
And which is not present in the paste?
<no-defun-allowed>
Copying from the REPL is going to indent it funny, because the first line is "indented" less in the copied text.
<asarch>
D'oh!
<asarch>
Slime should have a "paste" option for such cases
<beach>
asarch: Clearly, you should not use READ if you want to enter things as strings. READ will produce Common Lisp objects, like numbers, symbols, arrays, etc.
<beach>
asarch: You should not write code at the REPL, but in a Lisp buffer.
<asarch>
I thought the REPL was for a "quickie" :-P
frgo has quit [Remote host closed the connection]
<beach>
asarch: It is considered bad style to use an IF with only one branch. The more specific WHEN and UNLESS should be used then. There is a very general rule in programming, namely "use the most specific construct that will do the trick", so as to inform the person reading your code of your intentions.
<beach>
asarch: WHEN and UNLESS are more specific than IF, because they say that you are only evaluating the body when some condition holds, AND you are only evaluating it for its side effect rather than for its value.
<beach>
asarch: So you didn't post the code in order to get feedback on it?
<beach>
What's the point of posting it then?
<beach>
But that's OK. Now I know not to bother.
<asarch>
Actually I did it. I like to know your opinion about my code because that's the way I learn the "good manners" in Common Lisp
<asarch>
I always write everything in my notebook :-)
<asarch>
You should write the "Common Lisp in 21 days" book
<phoe>
such a book already exists though and it's called PCL
<phoe>
(except for the day count)
<phoe>
also I don't think CL can be learned in full in 21 days, it takes a somewhat longer time to do that
<asarch>
That book is actually for someone who already knows Lisp
<no-defun-allowed>
No it isn't.
<asarch>
(Specially the part in the classes and their protocols)
<asarch>
For example, the part about condition gives me 1000 questions instead of show me the conditions in a very precise way
<no-defun-allowed>
Generally speaking, when you read a book, it is assumed you start at the start, and go through linearly unless you are already familiar with the topics covered.
<no-defun-allowed>
That is to say, that you are expected to know most of the content covered in the chapters preceding the chapters on classes and generic functions.
<verisimilitude>
I also find this insistence that using an IF with only one branch is bad style silly.
flamebeard has joined #lisp
<asarch>
Exactly. And the first thing you should learn is: Common Lisp IS NOT C/C++, why? Because most of programmers (if not all of them) come from C/C++
<phoe>
if you don't know C++, you don't need to unlearn it
<phoe>
that's also why Gentle exists
<asarch>
So, for example, when they want learn Python, they usually compare this from Python with that from C/C++
<phoe>
(and I am serious)
<phoe>
the fact alone that classes don't have methods tends to take a while to grok
<no-defun-allowed>
Or in other other words, you should ensure you understand the concepts presented in the book, before proceeding to read later chapters that will likely refer to those concepts, leaving you confused.
<asarch>
Gentle is worst
<asarch>
It should start with the scope
<verisimilitude>
I learned Common Lisp by reading CLtL2 and then a list of differences with the final standard.
<verisimilitude>
It's easy if one already has an idea of what Lisp is in general.
<no-defun-allowed>
"Lisp can be learnt in a day [citation needed], but if you know C, then it's three days."
Codaraxis_ has quit [Ping timeout: 240 seconds]
<no-defun-allowed>
verisimilitude: Somehow I think this may lead to a good application of <https://xkcd.com/2270/>.
Lord_of_Life has quit [Ping timeout: 258 seconds]
<verisimilitude>
What's your meaning, no-defun-allowed?
<no-defun-allowed>
One can formulate a good style guide and/or learning strategy by ensuring they don't do what you do.
Lord_of_Life has joined #lisp
<verisimilitude>
Alright, that's what I figured you meant.
<verisimilitude>
It's amusing, because looking at the advice shared here gave me some inspiration for that most insidious stupidity to remark against in my style document.
<asarch>
A "Common Lisp for Dummies" book
<verisimilitude>
Have fun being scared of &AUX, USE-PACKAGE, and pretending your CFFI wrapper is a Common Lisp program.
<no-defun-allowed>
asarch: That's exactly what A Gentle Introduction to Symbolic Computation is.
<asarch>
Really? Wow!
frgo has joined #lisp
<no-defun-allowed>
If you would like to recreate the OpenCL framework and the drivers for my graphics card in Common Lisp, you're more than welcome to.
<asarch>
Anyway, thank you very much guys!
<asarch>
Have a nice day! :-)
asarch has quit [Quit: Leaving]
<no-defun-allowed>
(And I think the Linux AMD drivers are open source, so you shouldn't have too much trouble with that :)
frgo has quit [Read error: Connection reset by peer]
<verisimilitude>
I wouldn't mind being paid for such, but I figure you wouldn't actually want to pay for it, and would simultaneously complain when it's AGPLv3.
<no-defun-allowed>
No, I can't pay for that, but I wouldn't complain about licensing.
<no-defun-allowed>
Did you know Petalisp and oclcl-petalisp are both AGPLv3 licensed?
<verisimilitude>
Well, you'd be better than some of the others here, then.
<verisimilitude>
I wasn't, no-defun-allowed.
<beach>
I can understand why someone would prefer to ignore conventions, but I can't for my life figure out why someone would want to encourage others not to follow conventions.
<verisimilitude>
Just because you follow them doesn't make them universal conventions, beach.
<no-defun-allowed>
verisimilitude: Kidding, lol no Cooperative Non-Violent Public License
<phoe>
it is high time to make tea
<verisimilitude>
Are you serious, no-defun-allowed?
<no-defun-allowed>
Very much so.
<verisimilitude>
Well, that's amusing.
frgo has joined #lisp
<verisimilitude>
Just because this channel is named ``#lisp'' and is on Freenode doesn't make it authoritative, beach, even though some would prefer to think otherwise.
<verisimilitude>
There's a similar issue with ``the front page of the Internet'' in thinking itself so important.
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
frgo has quit [Remote host closed the connection]
<verisimilitude>
None of you would know, but I was the only one who bothered giving any feedback regarding that recent Common Lisp survey; the Reddit users were content to share stupid jokes and vapid praise.
frgo has joined #lisp
<verisimilitude>
Ironically, I can't participate in the survey, however, because it requires Google JavaScript.
<no-defun-allowed>
(The only reason I don't use it, is because my only large project for the last year has been a distributed object system, and I need to be sure that blame doesn't go where blame shouldn't go, namely that node operators don't get in trouble if their nodes download inappropriate content without knowing any better. Oh, and I was doing weirdo licenses before it was cool, even before the CNPL...)
<verisimilitude>
I told the fellow managing it that he should expect a fairly incestuous turnout, considering he only shared it here and Reddit.
<jdz>
verisimilitude: I learned about it from neither.
<verisimilitude>
I was going to share it with my group, but I can't advocate for it, due to these reasons.
rumbler31 has joined #lisp
<verisimilitude>
Where'd you learn of it, jdz?
<jdz>
verisimilitude: Also, did you know about "private browsing mode"?
<verisimilitude>
What of it?
<jdz>
It seems to me you're spreading FUD about "Google JavaScript."
<verisimilitude>
I don't enable JavaScript at all, jdz; considering it's a basic form, there's no reason it should be needed.
<verisimilitude>
Requiring me to enable a megacorporation's JavaScript just to participate in a survey isn't much for community, in my eyes.
<verisimilitude>
I really didn't like that it was Google at all, but not even the radio buttons work without JavaScript; it's just a giant mass of <script>.
<jdz>
I agree with you that you may live your life keeping to your values, but you should not complain about other people having different opinion about them.
<no-defun-allowed>
Requiring JavaScript is a security feature /s
<verisimilitude>
I merely mean this consequently prevents the Common Lispers such as myself from participating, leading to what I deem the ``incestuous'' turnout.
<jdz>
Maybe the form is where it is now just to filter out your input?
fanta1 has joined #lisp
<verisimilitude>
The medium is the message; the setting of the survey determines who will respond.
<verisimilitude>
If you're going to be passive aggressive, be more clever, jdz.
<jdz>
Creating a survey is work. How much work have you invested in this?
<verisimilitude>
I'm the only one who bothered to send the fellow an email about it, and contributed the idea for several questions he'd not thought of.
<verisimilitude>
Now, what did you invest in it, jdz?
<jdz>
I filled out the survey.
<verisimilitude>
How nice for you.
<jdz>
My dislike of Google JavaScript aside.
rumbler31 has quit [Ping timeout: 260 seconds]
Cymew has joined #lisp
<jackdaniel>
for discussions in this spirit I have only one response: "lubię placki" ;-)
<beach>
Pancakes?
patrixl has left #lisp [#lisp]
<jackdaniel>
literally "I like cakes", that's a humorous Polish equivalent of "whatever"
<beach>
Ah. :)
mingus has quit [Remote host closed the connection]
mingus has joined #lisp
shangul has joined #lisp
karlosz has quit [Quit: karlosz]
man213 has quit [Read error: Connection reset by peer]
man213 has joined #lisp
ski has joined #lisp
shka_ has joined #lisp
gravicappa has quit [Remote host closed the connection]
HDurer has quit [Ping timeout: 240 seconds]
rumbler31 has joined #lisp
fanta1 has quit [Quit: fanta1]
m00natic has joined #lisp
rumbler31 has quit [Ping timeout: 260 seconds]
ljavorsk has joined #lisp
zaquest has quit [Quit: Leaving]
hhdave has joined #lisp
v_m_v has joined #lisp
v_m_v has quit [Ping timeout: 265 seconds]
beach has quit [Ping timeout: 272 seconds]
oxum_ has joined #lisp
oxum has quit [Read error: Connection reset by peer]
shangul has quit [Ping timeout: 260 seconds]
beach has joined #lisp
v_m_v has joined #lisp
shangul has joined #lisp
cpape has quit [Read error: Connection reset by peer]
cpape has joined #lisp
penguwin has quit [Quit: Ping timeout (120 seconds)]
Shinmera has quit [Remote host closed the connection]
scymtym has quit [Ping timeout: 258 seconds]
penguwin has joined #lisp
Shinmera has joined #lisp
shangul has quit [Ping timeout: 258 seconds]
shangul has joined #lisp
scymtym has joined #lisp
rumbler31 has joined #lisp
rgc has joined #lisp
beach has quit [Read error: Connection reset by peer]
rumbler31 has quit [Ping timeout: 258 seconds]
beach has joined #lisp
beach` has joined #lisp
oxum_ has quit [Read error: Connection reset by peer]
oxum has joined #lisp
beach has quit [Ping timeout: 252 seconds]
HDurer has joined #lisp
cosimone has joined #lisp
beach has joined #lisp
zaquest has joined #lisp
beach has quit [Remote host closed the connection]
beach` has quit [Read error: No route to host]
terpri has quit [Remote host closed the connection]
<aeth>
My first reaction was "oh verisimilitude is back, isn't verisimilitude the one with the odd style?" and then I read the text and it's a style debate. Some things never change. :-)
<aeth>
I guess you can assume most Lispers are unlearning C and/or C++. For a while there there was a very good chance that people might've learned Java instead of C++, but thanks to Oracle's neglect after the Sun acquisition, C++ kind of made a comeback in teaching afaik.
<aeth>
JavaScript might actually be a "security feature" as in a "don't cheat the survey" feature. Obviously this assumes that it's the worst case, privacy-destroying JS, too, which is probably is. On the other hand, thanks to the recent Nevada Caucuses (last Saturday), we can now say that Google Forms were used for an election so...
<aeth>
maybe they need the security.
Inline has joined #lisp
<aeth>
As for USE, IMO you can (probably) safely use exactly one thing other than CL, assuming that it's very unlikely that a conflict will be introduced later on, especially if e.g. it's another one of your own libraries.
<no-defun-allowed>
To be fair, I was able to repeatedly send a HTTP request to resend my response many times a couple of years ago with Google Forms.
ukari has quit [Remote host closed the connection]
rumbler31 has joined #lisp
ukari has joined #lisp
fanta1 has joined #lisp
rumbler31 has quit [Ping timeout: 260 seconds]
Codaraxis_ has joined #lisp
v_m_v has quit [Remote host closed the connection]
Codaraxis_ has quit [Ping timeout: 240 seconds]
amerlyq has joined #lisp
ggole has joined #lisp
prince1 has quit [Ping timeout: 258 seconds]
jmercouris has joined #lisp
<phoe>
aeth: using exactly one thing other than CL won't be a big issue as long as you are sure to *not* define stuff on the symbols that are used from that package
<phoe>
and by USEing a package, you allow it to define which symbols of the using package belong to the used package.
<phoe>
that's a nontrivial responsibility that you delegate outside, yanno
<aeth>
if you delegate it outside, e.g. USE is perfectly fine for other internal packages
<aeth>
(and if you use a monorepo, everything's internal!)
<phoe>
or that, yes
<phoe>
was thinking of e.g. :use :alexandria which is a fully external and independent package
<jmercouris>
still thinking about that article ambrevar posted?
<aeth>
:use :alexandria is problematic because not enough people do that, so it's really easy to get conflicts, so I'm surprised so many people say it's used so often
<aeth>
alexandria uses some ultra-generic names where it's likely some other library also tries to solve the same thing
<aeth>
e.g. alexandria and uiop conflict
Bourne has quit [Ping timeout: 260 seconds]
<aeth>
Although I suppose the issue is when new conflicts are introduced, since known ones can be worked around.
Bourne has joined #lisp
ljavorsk has quit [Ping timeout: 258 seconds]
v_m_v has joined #lisp
ljavorsk has joined #lisp
v_m_v has quit [Ping timeout: 240 seconds]
fanta1 has quit [Quit: fanta1]
shifty has quit [Ping timeout: 240 seconds]
shifty has joined #lisp
rwcom7 has joined #lisp
rwcom has quit [Ping timeout: 258 seconds]
rwcom7 is now known as rwcom
cosimone has quit [Quit: Terminated!]
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 252 seconds]
gko_ has joined #lisp
jmercouris has quit [Remote host closed the connection]
jmercouris has joined #lisp
ukari has quit [Remote host closed the connection]
<Bike>
but otherwise no, it's just an efficiency concern
<Bike>
that's up to the function you're calling
<Bike>
which doesn't seem to mention it, so, good luck
<jmercouris>
:-)
<jmercouris>
I'll try some things, worst case a little memory leak never killed anyone :-P
<jmercouris>
this function is ran literally once or twice at moast
<jmercouris>
most*
prince1 has quit [Ping timeout: 260 seconds]
<Bike>
since the other functions in here seem to allocate memory themselves, what i would guess is that it allocates its proxy settings object, and then copies in your ignore_hosts. so you can delete the ignore_hosts immediately. but that's a guess
<jmercouris>
I'll give it a try
<jmercouris>
if I get a fun sigabrt I'll know
<dlowe>
I wonder if there's some way to override malloc() in our lisp image so that it uses the lisp allocator instead.
v_m_v has quit [Remote host closed the connection]
<Bike>
If you want it garbage collected there are more complications
<Bike>
and if you don't, you might as well use malloc
<phoe>
in theory, you could allocate an ub8 vector, and then pin it and use its data-pointer when necessary
<phoe>
that's not covering everything though, you still need some way of keeping track of it when it isn't pinned and used
<phoe>
and just allocating in dynamic space runs into trouble with tags and such
<pjb>
This is a C data structure, therefore allocate it as a C data structure!
<Bike>
I mean think of the performance characteristics here. C programs allocate memory in different ways than lisp ones, and malloc is optimized for C ways
<pjb>
If foreign-alloc is specified to do it, then you can use it. But otherwise, allocate and fill the foreign stuff yourself.
v_m_v has joined #lisp
cosimone has quit [Read error: Connection reset by peer]
scymtym has joined #lisp
luni has quit [Remote host closed the connection]
cosimone has joined #lisp
jmercouris has quit [Ping timeout: 240 seconds]
v_m_v has quit [Ping timeout: 240 seconds]
frgo_ has quit [Ping timeout: 240 seconds]
amerlyq has quit [Quit: amerlyq]
amerlyq has joined #lisp
amerlyq has quit [Client Quit]
amerlyq has joined #lisp
amerlyq has quit [Client Quit]
amerlyq has joined #lisp
amerlyq has quit [Client Quit]
amerlyq has joined #lisp
beach has joined #lisp
ebrasca has quit [Remote host closed the connection]
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 258 seconds]
shifty has quit [Ping timeout: 258 seconds]
shifty has joined #lisp
sjl_ has joined #lisp
EvW has quit [Ping timeout: 248 seconds]
kajo has quit [Ping timeout: 240 seconds]
ebzzry has joined #lisp
ebrasca has joined #lisp
scymtym has quit [Ping timeout: 265 seconds]
shifty has quit [Ping timeout: 255 seconds]
shifty has joined #lisp
X-Scale` has joined #lisp
X-Scale has quit [Ping timeout: 265 seconds]
ebzzry has quit [Read error: Connection reset by peer]
X-Scale` is now known as X-Scale
EvW1 has joined #lisp
m00natic has quit [Remote host closed the connection]
hhdave has quit [Quit: hhdave]
ebrasca has quit [Remote host closed the connection]
shifty has quit [Ping timeout: 260 seconds]
shifty has joined #lisp
ebrasca has joined #lisp
narimiran has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 272 seconds]
shifty has quit [Ping timeout: 255 seconds]
shifty has joined #lisp
gko_ has quit [Ping timeout: 240 seconds]
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 265 seconds]
frgo has joined #lisp
prince1 has joined #lisp
LiamH has joined #lisp
prince1 has quit [Ping timeout: 260 seconds]
sarna has quit [Ping timeout: 272 seconds]
cosimone has quit [Quit: Terminated!]
kajo has joined #lisp
shangul has joined #lisp
shangul has quit [Read error: Connection reset by peer]
shangul has joined #lisp
shangul has quit [Ping timeout: 240 seconds]
shifty has quit [Ping timeout: 265 seconds]
shifty has joined #lisp
efm has joined #lisp
shangul has joined #lisp
rumbler31 has joined #lisp
shangul has quit [Ping timeout: 255 seconds]
cosimone has joined #lisp
rwcom3 has joined #lisp
rumbler31 has quit [Ping timeout: 260 seconds]
rwcom has quit [Ping timeout: 258 seconds]
rwcom3 is now known as rwcom
shifty has quit [Ping timeout: 255 seconds]
buffergn0me has joined #lisp
shifty has joined #lisp
jcowan has left #lisp [#lisp]
_whitelogger has joined #lisp
shifty has quit [Ping timeout: 255 seconds]
sauvin has quit [Read error: Connection reset by peer]
vms14 has joined #lisp
Lord_of_Life_ has joined #lisp
shifty has joined #lisp
EvW1 has quit [Ping timeout: 240 seconds]
Lord_of_Life has quit [Ping timeout: 258 seconds]
Lord_of_Life_ is now known as Lord_of_Life
didi has joined #lisp
shifty has quit [Ping timeout: 265 seconds]
shifty has joined #lisp
<didi>
So, if I wanted to write PUSH, I would need to use `define-setf-method', righ?
<verisimilitude>
I think of Ada, and how you can use Ada types, but with a C convention, so that they're still completely under the control of the Ada side of things. Poor programming practices have killed people, and so even a small memory leak is principally unacceptable. This has me think about how I disagree with some of the design decisions made in other portability libraries, and it has me remark on how designing a library as a collected subset
<verisimilitude>
of nonstandard functionality will likely result in something suboptimal, compared to how the ANSI would've been able to design it.
<Bike>
didi: no such operator. PUSH is probably just defined with defmacro (using get-setf-expansion, though)
<didi>
Bike: Interesting. Thank you.
<didi>
verisimilitude: You reminded me of the rocket that leaked memory.
cosimone has quit [Quit: Quit.]
<didi>
New version of the question: what about (setf (getf ...))?
<phoe>
verisimilitude: ANSI would not and will not be able to design anything better. Would not, given their time and money constraints; will not, because no one has enough money to revise the CL standard.
<Bike>
didi: What exactly are you asking? When you can use a setf function versus having to use the macro mechanism?
<phoe>
didi: seems like defmacro with get-setf-expansion. One cannot have a #'(setf getf) function because functions cannot modify variable bindings.
<didi>
Bike: I am playing with SETF. Now I'm playing with writing a way to setf a value of an alist.
<verisimilitude>
The basic point is that portability libraries tend to be suboptimal, when considering their purpose, phoe.
<verisimilitude>
I've written a very simple one and even that isn't the ideal version of the interface I'd want.
<phoe>
Bike: non-trivial, but one could macrostep these define-alist-get- forms to get a more sensible expansion.
<phoe>
verisimilitude: I am aware, and yes, they tend to be suboptimal. They are usually "good enough" for contemporary purposes though, since most people do not want to optimize every single thing possible and instead move to other endeavours.
<didi>
Uh, OK, it's harder than I expected.
<phoe>
My cl-lzma bindings to the C LZMA library are no exception.
<phoe>
didi: inorite
<didi>
phoe: rite
<verisimilitude>
Taking a quick look at what LZMA is to refresh myself, there's no reason it shouldn't be written in Common Lisp, in my eyes, phoe. I've only taken a brief glance, however, so is there a reason beyond it already being implemented in C?
shifty has quit [Ping timeout: 240 seconds]
<verisimilitude>
When I wrote of portability libraries, I more meant USOCKET and BORDEAUX-THREADS than simple C bindings.
<Bike>
didi: If you make the define-alist-get macro global and then macroexpand the (define-alist-get assoc-value ...) form it should be easier to understand.
shifty has joined #lisp
<phoe>
verisimilitude: I did not care enough about the project to actually reimplement all of the compressor and decompressor in CL. I prefered to reuse existing and tested code.
<didi>
Bike: Thanks.
<verisimilitude>
Alright; that's what I figured, phoe.
<phoe>
verisimilitude: I see.
<verisimilitude>
It reminds me of my ACUTE-TERMINAL-CONTROL and Ncurses.
<verisimilitude>
Ncurses is a poor design that goes beyond being a foreign library, though.
<phoe>
I think I've said everything I have on that matter in the reddit comments related to your blogpost on that. Don't have anything new to add.
<verisimilitude>
Which username on Reddit is yours?
<verisimilitude>
Are you flaming_bird?
<verisimilitude>
I ask because I understand you'd either be flaming_bird or _priyadarshan, if I'm looking at the correct discussion; it's not much discussion, though, since two of the three messages are bemoaning the license.
<verisimilitude>
Or, rather, two of those three involve that and not the actual library.
rumbler31 has joined #lisp
CrunchyChewie has joined #lisp
rumbler31 has quit [Ping timeout: 260 seconds]
<phoe>
flaming_bird there
DGASAU has quit [Read error: Connection reset by peer]
<verisimilitude>
Alright; you may find it amusing seeing your recent advice about :USE had me come here to start with.
prince1 has joined #lisp
DGASAU has joined #lisp
shifty has quit [Ping timeout: 255 seconds]
shifty has joined #lisp
asarch has joined #lisp
prince1 has quit [Ping timeout: 265 seconds]
Burleigh has joined #lisp
DGASAU has quit [Ping timeout: 272 seconds]
DGASAU has joined #lisp
<jackdaniel>
I was going to find some nice relevant quote directed at Shinpachi from Ginatama but I've failed
<pfdietz>
I will not be going to ELS this year, unfortunately. Last year it was a court appearance, this year a global pandemic. I fear next year will involve vacuum decay.
CrazyPython has joined #lisp
DGASAU has quit [Ping timeout: 255 seconds]
<Bike>
with vacuum decay there will be no time to worry, so it's fine
<didi>
It might be happening right now.
Jesin has quit [Quit: Leaving]
DGASAU has joined #lisp
Jesin has joined #lisp
shka_ has quit [Ping timeout: 252 seconds]
narimiran has joined #lisp
<asarch>
When the (with-open-file ...) scope ends, does it automatically close the stream or should I do manually?
<didi>
asarch: It closes it.
<jackdaniel>
it does close the stream, even if you have error inside the body
rumbler31 has joined #lisp
akrl`` has quit [Read error: Connection reset by peer]
akrl`` has joined #lisp
z147 has joined #lisp
<jackdaniel>
as of corona virus, I've read into it and it seems that it is "just" a nasty flu with higher risk of pneumonia; still very bad but it seems much better than how media has pictured it
scymtym has joined #lisp
<phoe>
asarch: WITH-* macros are a Lisp idiom that allocate some closeable resource, allow you to use it in the dynamic scope of the macro, and then automatically close it whenever control leaves that macro.
<jackdaniel>
(of course it is not a flu; it is just similar)
<didi>
Ufs, `define-setf-expander' is hard.
<asarch>
Thank you!
<asarch>
Do you want to know a secret? The Corona virus doesn't even exist :-P
<pjb>
asarch: it looks to me quite reasonable to get a dialog when calling (read) on a system with a GUI…
<phoe>
ooh, the android REPL
<pjb>
asarch: what's your complaint?
<phoe>
TIL it does this
<pjb>
*query-io* is also like this. Don't be surprised if your system reads the prompt aloud when you (progn (format *query-io* "Please enter your age: ") (force-output *query-io*) (read *query-io*)) and it expects you to tell an integer to the speech recognizer…
<pjb>
Or something.
Krystof has quit [Ping timeout: 258 seconds]
Posterdati has quit [Read error: Connection reset by peer]
<z147>
btw, there's several solutions for quit across implementations, is there something similar for read?
<jackdaniel>
C-d usually means eof, you could handle a condition resulting from that
<phoe>
z147: what do you mean, for read?
terpri has joined #lisp
<phoe>
CL:READ is standardized
akrl`` has quit [Read error: Connection reset by peer]
akrl`` has joined #lisp
Posterdati has joined #lisp
<z147>
With sbcl, prompting for user input, I had to finish-output nil, which was not needed in clisp
gioyik has joined #lisp
<pjb>
z147: You have to finish-output always, when you want the output to be sent away!
<pjb>
z147: this is basic I/O.
<phoe>
^
<pjb>
z147: the problem you may have, is that you learned programming with some language that hides that fact.
<phoe>
an implementation may but is not required to finish-output for you
<z147>
Ah, I see
CrazyPython has quit [Ping timeout: 258 seconds]
<z147>
thanks
vms14 has quit [Remote host closed the connection]
<phoe>
writing to a stream does not necessarily mean that stuff gets sent away, e.g. if output is buffered
<pjb>
z147: note that when buffer are flushed for you, you may get very inefficient I/O.
<phoe>
you need to explicitly tell Lisp when you want it to send away whatever is buffered.
<pjb>
z147: you definitely want to control that, so that your batch programs can be as I/O-efficient as possible, and your interactive programs can be as responsive as possible.
kajo has joined #lisp
Krystof has joined #lisp
<z147>
I'll try to come up with some benchmarks to experiment with, thanks!
buffergn0me has quit [Ping timeout: 248 seconds]
narimiran has quit [Ping timeout: 258 seconds]
amerlyq has quit [Quit: amerlyq]
rumbler31 has joined #lisp
buffergn0me has joined #lisp
rumbler31 has quit [Ping timeout: 258 seconds]
slyrus_ has joined #lisp
<didi>
I think I'm getting the hang of `define-setf-expansion'. Expanding the setf form helps, but this thing is brutal.
<aeth>
Hmm... Reading a stream character by character and matching on the first, longest match unreading at the first point at which the match stops is... well, it's a very brutal macro, but I'm almost there with an unoptimized form and without 0+/1+/ranges/booleans for character matches.
slyrus has quit [Ping timeout: 258 seconds]
<aeth>
Once it's complete, though, I get a parser for everything I've wanted to parse via a stream...
<aeth>
The full version should also be a possible compilation target for EBNF.
<aeth>
I think nested cases is more powerful than EBNF, though.
prince1 has joined #lisp
efm has quit [Quit: Konversation terminated!]
ljavorsk has joined #lisp
prince1 has quit [Ping timeout: 265 seconds]
slyrus has joined #lisp
slyrus_ has quit [Ping timeout: 260 seconds]
xkapastel has joined #lisp
Codaraxis has joined #lisp
<p_l>
z147: CLISP installs a more complex REPL handler, whereas SBCL goes for minimum. And read and write use separate streams in unix without special handling
<z147>
If i understand the above correctly, finishing output when appropriate should resolve this
prince1 has joined #lisp
didi has left #lisp ["O bella ciao bella ciao bella ciao, ciao, ciao."]
random-nick has quit [Ping timeout: 240 seconds]
buffergn0me has quit [Remote host closed the connection]
buffergn0me has joined #lisp
buffergn0me has quit [Ping timeout: 240 seconds]
rwcom4 has joined #lisp
rwcom has quit [Ping timeout: 255 seconds]
rwcom4 is now known as rwcom
sjl_ has quit [Ping timeout: 255 seconds]
hiroaki_ has joined #lisp
Bike has quit [Quit: Bike]
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 240 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
wsinatra has quit [Quit: WeeChat 2.7.1]
kajo has quit [Ping timeout: 248 seconds]
kajo has joined #lisp
slyrus_ has joined #lisp
<pjb>
z147: take for example, punched cards. To punch a card, or to read it, it's a mechanical process. Then it's faster to punch 12 rows of 80 columns at a time rather than to punch 80 colums of 12 rows at a time. Ie. while the data is encoded column by column, mechanically it's way faster to process it row by row (since there are fewer rows than columns).
<pjb>
z147: therefore a fast card puncher will have to buffer the whole card (80 characters), and will punch them all at once.
<pjb>
z147: it's similar for line printers. Fast line printers will print a whole line (132 characters) at a time.
slyrus has quit [Ping timeout: 265 seconds]
<White_Flame>
aeth: with only a single character buffer for unread, it's the only way to attempt to only read what's necessary, in case something else is going to read the stream next
<White_Flame>
(well, without extending your own streams with additional buffers I guess)
<aeth>
White_Flame: I'm not sure what you mean
<White_Flame>
if you read-line, for instance, and search the array for the first non-included char from that buffer, you can't unread the buffer back into the stream
<aeth>
ah
<pjb>
z147: and then, there are the magnetic tapes. The magnetic tape drive, again being a mechanical device, will have to start and stop moving the tape between each block. While you can write 80-character records or 133 character records each in a block on a tape, this is very inefficient, given that the inter-block space (and time) is on the order of the size of a 64 kbyte block.
ljavorsk has quit [Ping timeout: 240 seconds]
<aeth>
White_Flame: See, a lot of the time I've just done a read-line because it's a parse-it-or-fail sort of thing. But this can also be used for those old read-line-based approaches
<aeth>
Messier than those require, but since the macro is written, might as well abstract away the reads and reduce consing, too
<White_Flame>
my lexer/parser stuff can swap out rules and pass off to other readtables in the middle, so I have to be careful not to read too much
<pjb>
z147: therefore it's more efficient to store (truncate 65536 80) --> 819 punched card per block or (truncate 65536 133) --> 492 line printer lines per block, on the tape.
ealfonso has joined #lisp
<aeth>
White_Flame: This is going to replace my Brainfuck parser, my Scheme reader function, my UCI chess engine protocol reader, my calculator, and a bunch of other things... since it's general purpose enough. Probably even e.g. parse JSON
<ealfonso>
is there an loop "else if"?
<White_Flame>
there's ELSE and IF, does that not suffice?
<aeth>
ealfonso: Yes. I think it's just "else if" Make sure that you actually need it (e.g. doing :collect, :sum, etc. conditionally), though because otherwise a COND is way clearer.
<pjb>
z147: when you use hard disk drives, the important size is the cylinder, since what is slow in this mechanical device, is to move the head from on cylinder to another. In any case, the operating system will use block sizes of at least 4 KB. So when you write files, if you force output of smaller buffers, the OS will have to read the disk (the whole cylinder), modify your little buffer, and write back at least the block-size, if
<pjb>
the whole cyliner.
<z147>
pjb, what would be the effective "block" for reading user input or text from file, say SSD?
<pjb>
z147: again, it would be much more efficient in that case NOT to call force-output, and wait the closing of the file to flush the buffers.
<White_Flame>
aeth: and yeah, mine's fully general purpose as well, with the intent to have other languages inline with each other
<pjb>
z147: now, in the case of the ssd, it's a little different, because there are no mechanical parts. However, there's still wear, based on a block-size (which depends on the SSD, I would guess it's on the order of the KB still).
<aeth>
White_Flame: Well that just trivially follows from using streams (and thus the potential of using reader macros), even though I personally won't be doing that...
<aeth>
Any (CL-style) reader written in CL can be a reader macro!
hiroaki_ has quit [Ping timeout: 272 seconds]
<White_Flame>
lack of unread makes it a ton harder, though
<pjb>
z147: when reading or writing from files, given the current diffenrential between memory speed and storage speed, use the biggest buffer you can (and given the size of RAM we currently have, this means, the maximum file size you can process, usually).
<White_Flame>
with backtracking options
saturn2 has quit [Ping timeout: 248 seconds]
<pjb>
z147: for user input, it's different. Here the question is that of interactivity and responsivity of your program. It depends on the expectation of the user.
<pjb>
z147: in general, the user wants to give a command line-by-line. Therefore the buffer size will have to be the maximum line length you can take.
saturn2 has joined #lisp
<pjb>
z147: as for the output, you can use force-output for intermediate output (eg. progress logs), and finish-output before expecting input.
<pjb>
note the difference: force-output is asynchronous, while finish-output is synchronous and waits for the output to be finished before the program can continue.
<z147>
I just ran ulimit on my box and it replied "unlimited". Spicious
<pjb>
z147: there's also the case of socket, for network protocols. You need to force-output to ensure the packets are sent.
<z147>
Thank You for the clarification, pjb , the hyperspec is not verbose on the basics
sarna has joined #lisp
<aeth>
White_Flame: the lack of unread when called via a reader macro?
<White_Flame>
yep
<aeth>
ah, okay, nevermind then
<aeth>
I guess it's not trivial and you have to create a buffer stream
<aeth>
Then you only have to worry about the last char being potentially already read, and otherwise can use your old algo