<Guest74>
the link posted earlier. By the talk it sounded like they started writing gimp in lisp. But the link says they got fed up with lisp and decided to program something in C, gimp.
<Guest74>
i realize i didn't make it any clearer in my summary. They were originally writing a compiler in lisp.
Oladon has joined #commonlisp
s-liao has joined #commonlisp
_whitelogger has joined #commonlisp
Jing has quit [Remote host closed the connection]
Jing has joined #commonlisp
unixlisp has joined #commonlisp
<unixlisp>
Suppose a implementation of CL, (defparameter *a* 0) (impl:get-lisp-object-address *a*) (setq *a* 1) (impl:get-lisp-object-address *a)
<unixlisp>
number may be boxed. two addresses equal.
<unixlisp>
Is it conformming to spec?
<hayley>
GET-LISP-OBJECT-ADDRESS is not a function that is specified by the Common Lisp standard.
<hayley>
An implementation is permitted to make ``copies'' of characters and numbers at any time. The effect is that Common Lisp makes no guarantee that eq is true even when both its arguments are ``the same thing'' if that thing is a character or number.
<Bike>
also, fixnums like 0 or 1 probably don't have "addresses" in any meaningful sense to begin with
<unixlisp>
fixnum is boxed object, not conforming to spec?
<hayley>
The spec doesn't say anything about object representation.
<Bike>
i mean you put "impl:" in your example code
<Bike>
that means it's non standard
<unixlisp>
not break standard?
<Bike>
"impl" presumably means it's an extension to the standard
<unixlisp>
yes. To directly modify fixnum object, identical address Is not a contradiction to standard?
<hayley>
You cannot directly modify a fixnum object, and the standard says nothing about addresses.
<unixlisp>
The standard do not permit you to modify a fixnum object?
<hayley>
And I'll happily bet that "impl:" is an attempt at censoring "sb-impl:" which is a library exposing SBCL "internal" features, and thus exposes SBCL implementation decisions.
<hayley>
No, it does not.
<hayley>
You were modifying a binding, not an object. We went over this yesterday.
<Bike>
can we get some context here?
<Bike>
oh. i see.
<unixlisp>
Hayley: If I modify a object, do it break the standard?
<hayley>
Bike: The context, I think, is that unixlisp has been learning the difference between modifying a binding to an object, and modifying the object itself.
<hayley>
unixlisp: There simply is no way for you to modify a fixnum object. You've been replacing the object that is the value of some binding.
<unixlisp>
It is boxed.
<hayley>
Boxing or not is irrelevant.
<Bike>
thinking in terms of boxing or addresses will get you nowhere at this stage
<hayley>
Here is a sketch of what you are doing. SETQ does not modify objects, it just makes the value in a binding change.
<unixlisp>
If it modify object, do it break spec?
<hayley>
I am nowhere near my desk at the moment, so the head-desk slamming will have to wait until later.
<unixlisp>
thanks for discussion.
<hayley>
You can modify objects, generally speaking, but there are no operations which let you modify fixnums, and you are not modifying any objects in the example code provided.
Jing has quit [Remote host closed the connection]
<unixlisp>
possible implementation and standard conformming is the point.
Jing has joined #commonlisp
<Bike>
it sounds like you are not at the level of complexity where standard conformity should be high among your concerns
s-liao has quit [Quit: Client closed]
s-liao has joined #commonlisp
<unixlisp>
to understand spec and CL
<hayley>
The spec doesn't provide any way to modify numbers. So why would it specify what happens if you modify a number?
<Guest74>
this reminds me of ELIZA
<Bike>
you don't seem to understand basic aspects of the language semantics, so you should start with learning those, and then later you can worry about conformity and addresses and such
Spawns_Carpeting has joined #commonlisp
<unixlisp>
It is simple. Do the behavior break spec? Or is it not possibly implemented?
<Bike>
It's not simple if you don't understand basic concepts about the language. You keep talking about modifying numbers as if that's a thing that's possible, but the standard is very clear that it's not, so asking about what happens if you modify a number is nonsensical.
lisp123 has quit [Ping timeout: 256 seconds]
<beach>
Good morning everyone!
* mfiano
thinks above first two questions aren't even orthogonal to each other.
cjb has quit [Quit: rcirc on GNU Emacs 29.0.50]
dre has quit [Quit: Leaving]
slyrus_ has quit [Ping timeout: 252 seconds]
semz has quit [Ping timeout: 268 seconds]
dre has joined #commonlisp
slyrus has joined #commonlisp
semz has joined #commonlisp
slyrus has quit [Ping timeout: 256 seconds]
<White_Flame>
and of course the other layer is that lisp systems were implemented in lisp, therefore they had to implement a ton of the low-level runtime implementation itself in lisp, including low-level memory access
<White_Flame>
so certainly that can necessarily coexist in CL to implement the spec
unixlisp has joined #commonlisp
<White_Flame>
oh, you weren't here, so I'll repeat
<White_Flame>
and of course the other layer is that lisp systems were implemented in lisp, therefore they had to implement a ton of the low-level runtime implementation itself in lisp, including low-level memory access
<White_Flame>
so certainly that can necessarily coexist in CL to implement the spec
<unixlisp>
Bike: "You keep talking about modifying numbers as if that's a thing that's possible, but the standard is very clear that it's not", that is a clear answer.
<unixlisp>
But, quote the text of spec.
<beach>
unixlisp: There is no operator that modifies a number. That's perfectly clear I think.
<beach>
unixlisp: That phrase refers to objects that can be modified using existing operators.
<beach>
unixlisp: Like RPLACA on a literal CONS cell.
<Bike>
"immutable adj. not subject to change, either because no operator is provided which is capable of effecting such change or because some constraint exists which prohibits the use of an operator that might otherwise be capable of effecting such a change. Except as explicitly indicated otherwise, implementations are not required to detect attempts to
<Bike>
modify immutable objects or cells; the consequences of attempting to make such modification are undefined. ``Numbers are immutable.''
<Bike>
from the glossary.
<unixlisp>
"undefined" not break spec
<beach>
unixlisp: Oh, come on! Are you being intentionally dense?
<Bike>
Reading "the consequences are undefined if literal objects are destructively modified" to mean that anything that can be literal can be destructively modified is completely absurd.
<Bike>
"Numbers are immutable." right there in the glossary. stop being silly.
<unixlisp>
"undefined" not absurd
<Bike>
Do you actually think that numbers are mutable despite the sentence "numbers are immutable" literally appearing in the spec
<Bike>
i honestly didn't think it would be that explicit! but no, it's right there, straight out
<unixlisp>
"numbers are immutable" in glossary not in spec
Jing_ has joined #commonlisp
<hayley>
The glossary is part of the specification.
* beach
makes use of /ignore.
<hayley>
The only part of the HyperSpec that is not normative, i.e. not really part of the standard, is example code.
<unixlisp>
beach: do you agree "The glossary is part of the specification."
Jing has quit [Ping timeout: 252 seconds]
<mfiano>
Yes, /ignore is handy
<unixlisp>
and what is "being intentionally dense?"
<Bike>
the standard explicitly lists which sections are not normative in "1.4.3 Sections Not Formally Part Of This Standard". It does not include the glossary, so the glossary is part of the standard.
<Bike>
Intentional denseness is when you twist what writing says to draw the conclusions you want to draw despite the frankly obvious meaning. If you persist in this, I don't think you're going to get any valuable experience out of this channel, and we're not going to get anything out of you.
<unixlisp>
not intentional surely. just standard and implementation, simple.
<Bike>
i don't know why i answered that. i'm so easily trolled. whatever.
<Bike>
it's apparently not simple because you, unixlisp, continue to be unable to understand its most basic aspects.
<Bike>
or maybe you're just fucking with us, who knows.
<mfiano>
It's very hard to tell which, given how much of a lack of understanding there is, so I'm deferring help to others.
Inline has quit [Quit: Leaving]
slyrus has joined #commonlisp
slyrus_ has joined #commonlisp
slyrus has quit [Ping timeout: 250 seconds]
<unixlisp>
Bike: "the consequences of attempting to make such modification are undefined. ``Numbers are immutable.'"
<White_Flame>
certainly from C you can appreciate the notion of "undefined behavior", up to and including corrupting your runtime
<Bike>
there is no operator in the spec that can mutate a number. as such, there is no way to even attempt to modify a number.
<Bike>
mutating numbers is "undefined" in the sense that there is no defined way to do it.
<beach>
Bike: I admire your patience.
<Bike>
i am just about out of it.
<unixlisp>
beach: spec say SETQ modify a number then it break spec?
karlosz has joined #commonlisp
<Bike>
Yep. I'm done.
unixlisp was kicked from #commonlisp by Bike [unixlisp]
elderK has quit [Quit: Connection closed for inactivity]
<mfiano>
Long overdue I think.
<Bike>
i really don't like to believe that people aren't acting in bad faith, i guess. anyway, sleeping. didn't bother with a ban, if they come back someone else can take care of that. toodles.
tyson2 has quit [Remote host closed the connection]
<mfiano>
I don't have to interrupt now to say that after a few months of not being able to program due to medical reasons, I am back on the horse, but taking it easy. A friend of mine got me interested in FreeBSD, so I've been wrapping the parts of its libc and kernel interface I need for some utilities I want to write in Common Lisp, rather than abort to an inferior language or shell scripting. It's far out of
<mfiano>
my comfort zone, as I really don't like writing implementation-specific code (in this case OS libc implementation, not CL), nor do I like relying on C code as my foundation instead of portable, conforming Common Lisp, but at least it's not Linux-volatile.
<beach>
Congratulations to being back.
<mfiano>
Thank you. I am having fun being back.
<mfiano>
In other news, I got another pull request to one of my maintained libraries today, that I refused to merge until (for the 3rd time recently) they re-edit the TAB settings in their editor. I don't see it very nice to mix TAB and space characters in a collaborative version control environment. That just adds a lot of back-and-forth whitespace diff noise.
s-liao has quit [Quit: Client closed]
<opcode>
is it possible to split a string/sequence on a blank line (e.g. \n\n in other langs?
<mfiano>
Sure
<mfiano>
"Hello
<opcode>
I tried #\newline#\newline but it doesn't seem to be working
<opcode>
hayley: that'll split on any newline, but I want to split on an empty line only
<opcode>
i've tried with split-sequence and with the cl-str library but no luck :(
<mfiano>
Sounds like you want cl-ppcre
<hayley>
What's weird is that str uses cl-ppcre.
<opcode>
indeed
<opcode>
but regex is not my strong suit
<mfiano>
But _how_ does it use it?
<mfiano>
THis is a simple regex problem.
<hayley>
Try double escaping the \n, i.e. (str:split "\\n\\n" "Foo<newline><newline>bar")
<hayley>
It works with cl-ppcre but not cl-str.
lisp123 has joined #commonlisp
<mfiano>
looks like a test to add to omren
Oladon has quit [Quit: Leaving.]
<hayley>
Well, I don't think backslash-n works in Common Lisp strings (not something I try frequently), but an actual newline would work. Not that it looks very nice.
<opcode>
thanks, double-escaping \n worked with ppcre but not with str
<opcode>
that's strange, I might file a bug with str
<hayley>
mfiano: possibly easy, unfortunately, since I don't currently have a sense of lines; everything matches the whole string, and the "every character" symbol also matched whitespace.
<mfiano>
backslash n is just going to escape the character n iirc
<mfiano>
in a string that is
<opcode>
yes I realized that after the fact, haha
lisp123 has quit [Ping timeout: 268 seconds]
<mfiano>
also note that you may benefit from one of the efficient substring search algorithms, if your input is large enough, instead of cl-ppcre
<mfiano>
Such as KMP
<mfiano>
(there are better nowadays though)
<hayley>
cl-ppcre does use Boyer-Moore-Horspool for constant strings. It's still a slow implementation, somehow.
<opcode>
I'm doing advent of code, the inputs aren't huge and I can tolerate some slowness since I only have to parse the input once
<opcode>
what does KMP stand for?
<hayley>
(Or, use one-more-re-nightmare to generate SIMD code...)
<mfiano>
Knuth-something-something
<hayley>
Knuth-Morrison-Pratt is my guess.
<mfiano>
Yes that
<opcode>
thanks, I'll search that up for future reference
<hayley>
Knuth-Morris-Pratt; Morrison is the prime minister here.
<mfiano>
I have not tried it, but Paul is an excellent hacker, and I wouldn't overlook his code
<mfiano>
Anyway, does anyone think I'm being too nitpicky about the above "in other news" comment I made? I seem to be getting a few PR's with that problem.
* mfiano
thinks whitespace is important for the [human] lisp reader, just not the lisp reader.
<hayley>
I think it is fair, given how much different tab widths have haunted #commonlisp.
<hayley>
Or, at the least, I can't really consistently say that tabs are unacceptable while doing code review in #commonlisp, but tabs are acceptable while doing code review elsewhere.
<hayley>
But if you like the changes, you could merge and then fix the tabs.
treflip has joined #commonlisp
<hayley>
mfiano: For what it's worth, you can get in trouble with "classic" substring search algorithms as they branch fairly unpredictably. So sometimes dropping constant factors, even for O(mn) algorithms, works better c.f. https://arxiv.org/abs/1612.01506
<mfiano>
I wouldn't doubt it.
slyrus_ has quit [Ping timeout: 250 seconds]
<hayley>
I probably should implement Boyer-Moore-Horspool in one-more-re-nightmare again, since people do use Lisp implementations other than SBCL, and machines that aren't x86-64+AVX2 machines...
<hayley>
but from memory, the DFA for ab|ac, which is pretty good, could run about 2-3 cycles/character, and SIMD ran at 2 characters/cycle or so.
slyrus has joined #commonlisp
peterhil has quit [Remote host closed the connection]
peterhil has joined #commonlisp
Spawns_Carpeting has quit [Quit: WeeChat 3.3]
slyrus_ has joined #commonlisp
slyrus has quit [Ping timeout: 260 seconds]
<Guest74>
oh hey that was me. And I had just asked how to get make emacs to stop inserting tabs a couple of day ago but I guess I forgot to reformat that.
Cymew has joined #commonlisp
spiaggia has joined #commonlisp
<White_Flame>
mfiano: also congrats on returning to code. been there myself
<mfiano>
Guest74: Can I both you to add at least a simple test to test.lisp?
<mfiano>
bother*
<mfiano>
It would be nice for regressions and all
<mfiano>
White_Flame: Thanks!
<Guest74>
I'll look at it tomorrow. past my bedtime.
<mfiano>
Guest74: Currently |3b| has the test framework setup to only test decoded images from disk. I'm not sure how difficult it would be to change that.
<mfiano>
So no worries
<mfiano>
Currently I'm more annoyed that GitHub Actions changed its API and we can't get Windows tests to pass...and now opticl is causing Linux tests to fail...
<Guest74>
np, I'll take a look and see if it's trivial.
<mfiano>
I need to hire a [free] CI specialist to takeover. I have no time for this headache.
<Guest74>
I think once ms forces/tricks my windows partition to update I'm never even going to bother with it. You probably have different priorities though.
slyrus has joined #commonlisp
<mfiano>
I have no idea what that means
slyrus_ has quit [Ping timeout: 260 seconds]
<Guest74>
wont bother making sure anything runs on windows.
<mfiano>
I only care about FreeBSD myself, but the 3 major OS's are the ones with all the users.
<mfiano>
I also take pride in ensuring my code is portable across OS's for the small ffi bits we have to do, in addition to the obvious CL implementation portability.
<mfiano>
The latter is much more beneficial to longevity of code. Read conditionals can disable OS-dependent things like mmap at the expense of speed.
<|3b|>
the "test framework" is just a call to (pngload.test:run-tests-for-ci)
<jackdaniel>
ensuring that also helps to identify bits that are os dependent (that is not always obvious)
<|3b|>
which just calls (test-images) and converts the results to "true/false" to indicate success
<Guest74>
|3b|: So what determines if a test succeeds? I guess I'd have to just read the files into a vector and then load from there?
slyrus has quit [Ping timeout: 268 seconds]
<phoe>
thanks
<mfiano>
I think it just tests the sample images in the official libpng test suite, whether or not they decode to expected values
<mfiano>
phoe: for?
<phoe>
oops, wrong channel
<mfiano>
:)
kakuhen has joined #commonlisp
Algernon69 has joined #commonlisp
<|3b|>
Guest74: the person writing the test decides what is success or failure
<|3b|>
so read file into a vector, load it, make sure it contains the expected data
waleee has joined #commonlisp
<|3b|>
might be reasonable to just combine that into test-image*
Guest74 has quit [Ping timeout: 240 seconds]
slyrus has joined #commonlisp
slyrus_ has quit [Ping timeout: 250 seconds]
slyrus has quit [Ping timeout: 268 seconds]
slyrus has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 240 seconds]
slyrus has quit [Ping timeout: 240 seconds]
varjag has joined #commonlisp
varjag has quit [Remote host closed the connection]
slyrus has joined #commonlisp
gaqwas has joined #commonlisp
Algernon69 has quit [Ping timeout: 250 seconds]
Algernon69 has joined #commonlisp
spiaggia has quit [Quit: ERC (IRC client for Emacs 26.3)]
shka has joined #commonlisp
dre has quit [Quit: Leaving]
s-liao has joined #commonlisp
aartaka has joined #commonlisp
pve has joined #commonlisp
aartaka has quit [Ping timeout: 265 seconds]
Jing_ has quit [Remote host closed the connection]
Jing has joined #commonlisp
voltron has joined #commonlisp
random-nick has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
edgar-rft has quit [Quit: Leaving]
peterhil_ has joined #commonlisp
peterhil has quit [Remote host closed the connection]
gaqwas has quit [Ping timeout: 260 seconds]
slyrus has quit [Ping timeout: 260 seconds]
slyrus has joined #commonlisp
igemnace has joined #commonlisp
slyrus has quit [Ping timeout: 256 seconds]
slyrus has joined #commonlisp
shka has quit [Remote host closed the connection]
heisig has joined #commonlisp
slyrus has quit [Read error: Connection reset by peer]
slyrus has joined #commonlisp
epolanski has joined #commonlisp
cosimone has joined #commonlisp
shka has joined #commonlisp
lisp123 has joined #commonlisp
Jing has quit [Read error: Connection reset by peer]
lisp123 has quit [Ping timeout: 268 seconds]
Jing has joined #commonlisp
s-liao has joined #commonlisp
rogersm has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life has joined #commonlisp
slyrus has quit [Ping timeout: 268 seconds]
slyrus has joined #commonlisp
rotateq has joined #commonlisp
attila_lendvai has joined #commonlisp
notzmv has quit [Ping timeout: 240 seconds]
perrierjouet has quit [Quit: WeeChat 3.3]
perrierjouet has joined #commonlisp
cage has joined #commonlisp
s-liao has quit [Quit: Client closed]
amb007 has quit [Ping timeout: 268 seconds]
amb007 has joined #commonlisp
s-liao has joined #commonlisp
karlosz has quit [Quit: karlosz]
yewscion_ has joined #commonlisp
yewscion has quit [Ping timeout: 252 seconds]
unixlisp has joined #commonlisp
<Nilby>
I'd like to apologize to all the people past and future who have been mistreated and badgered by operators and others for earnest misunderstandings. Note that many of the people here do not engage in such.
frgo has quit [Ping timeout: 256 seconds]
<jackdaniel>
Nilby: if you are driving at the morning incident then it is really hard to look at it with "earnest misunderstanding" optics
<jackdaniel>
also saying that operators and other users mistreat newbies kind of hurts - most people here try to earnestly help and not mistreat other human beings <;
<hayley>
It also helps when I felt like I was describing the same concepts yesterday.
voltron has quit [Remote host closed the connection]
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
igemnace has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 250 seconds]
<Nilby>
jackdaniel: I don't think anyone wakes up and says "How can I mistreat ‘newbies’ today", rather I know people try to be helpful, but it can't always work out.
<jackdaniel>
sure, but your apology on behalf of other people who behaved a) politely, b) accurately; is a dickish thing to do. I won't comment on that any further.
<Nilby>
hayley: If everyone didn't have such a hard time understanding Lisp values and places, etc. I like to imagine the programming world might join us more.
<hayley>
Last time I had to answer a "which pointer are we messing with" sort of question, they got it after am informal description and a diagram.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
VincentVega has joined #commonlisp
<Nilby>
jackdaniel: I very sincerely want to apologize to those people. I don't exclude myself from causing problems.
unixlisp has quit [Remote host closed the connection]
unixlisp has joined #commonlisp
<Nilby>
hayley: I liked your diagram. I think we could use more cool diagrams, but sadly I've met people with graduate degress in CS that may never fully get it.
<rotateq>
Nilby: don't worry, i had this yesterday evening in #clschool again, but then pjb rescued again with insights and detail knowledge i just don't have yet
<VincentVega>
Hmmm just what could possibly cause a no applicable method condition fail to print? "Error (TYPE-ERROR) printing the following condition: #<SB-PCL::NO-APPLICABLE-METHOD-ERROR {1005830293}>"
<Nilby>
I'm not sure if I'll ever be able to use define-setf-expander without messing it up.
cosimone has quit [Remote host closed the connection]
<|3b|>
VincentVega: bad print-object methods might cause that, for example on the object for which there was no method
<rotateq>
VincentVega: do you have used a call-next-method ? and maybe there is none after it
VincentV` has joined #commonlisp
VincentVega has quit [Ping timeout: 252 seconds]
<VincentV`>
Calling the function in the repl is OK, but when called by some other code, it gives me that error plus spits out "{#<THING2" to the repl. Any guesses/pointers would be appreciated.
VincentV` is now known as VincentVega
<|3b|>
yeah, sounds like buggy print-object methods
cranium has joined #commonlisp
slyrus has quit [Ping timeout: 268 seconds]
<VincentVega>
|3b
<VincentVega>
|3b|: thanks, I will look into those
<Nilby>
VincentVega: The print-object can do different things based on what stream it gets, which can differ between the REPL and other code.
<|3b|>
if you are using slime/sly, try hitting enter on the error message at the top of the debugger window, and then click on whichever things in inspector mention errors printing, and you should eventually get to the object it failed to print
* |3b|
suspects some print-object method might be sending output to *standard-output* or T instead of the requested stream, though that might be unrelated to whatever causes it to also signal an error
slyrus has joined #commonlisp
<VincentVega>
|3b|: Nilby: it was the print-object method. I didn't write it so will have to investigate. Thanks you!
<|3b|>
*print-whatever* settings might also differ between repl and other code, and for example some things might signal an error when told to print READably
<VincentVega>
|3b|: aright, I will keep these in mind
<VincentVega>
|
<VincentVega>
|3b|
<VincentVega>
yeah, the trace actually shows "error printing <structure-name>", thanks again, that was it
slyrus has quit [Ping timeout: 250 seconds]
slyrus has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
cosimone has joined #commonlisp
notzmv has joined #commonlisp
cosimone` has joined #commonlisp
tyson2 has joined #commonlisp
cosimone has quit [Ping timeout: 260 seconds]
s-liao has joined #commonlisp
unixlisp has quit [Remote host closed the connection]
yewscion_ has quit [Ping timeout: 268 seconds]
<rotateq>
Nilby: i never used it till now, seems to be one of the more advanced standard symbols
<rotateq>
i mean define-setf-expander
<jackdaniel>
it is one of the most confusing (yet useful) common lisp operators
<rotateq>
good to know
<jackdaniel>
it allows to group variables and places in a complex setf expression into things that need to be accessed only once, in particular order, with possible parallel assignment
<jackdaniel>
afair you are expected to return five values including temporary variable names
<rotateq>
and then the difference to defsetf ?
<rotateq>
or both included due to historical reasons/backwards compatibility?
<jackdaniel>
defsetf is easier and builds on top of define-setf-expander
<rotateq>
oki
<Nilby>
rotateq: defsetf is easier, but also can't do some complicated setf things, like juggling a bunch of values arguments
<rotateq>
jackdaniel: get-setf-expansion returns five values
<shka>
hi all
<shka>
i am looking for the pseudoinverse written in common lisp
<opalvaults2>
Is it abnormal to not have sly-lisp-implementations in emacs? I can't seem to use anything other than sbcl even though I've setq'd sly-lisp-implementations to include ccl.
lisp123 has quit [Ping timeout: 240 seconds]
<phoe>
opalvaults2: I use only inferior-lisp-program
<opalvaults2>
apparently it makes the difference with doing (or (parse-integer (prompt-read "Stuff:" ) :junk-allowed t) 0)..sbcl doesn't like that.
<phoe>
but then again I only use a single impl
<opalvaults2>
i would only be using sbcl phoe but practical common lisp uses CCL. the compiler cares about different things apparently :P
peterhil has quit [Read error: Connection reset by peer]
<_death>
the book talks about parse-integer returning NIL (in case of junk without digits), not prompt-read.. like phoe said, you are missing the read-line form there
notzmv has quit [Remote host closed the connection]
notzmv has joined #commonlisp
<opalvaults2>
_death: okay, I see what phoe meant now. I've added in read-line *query-io* and it works properly now
<opalvaults2>
woot
<opalvaults2>
user-error, as always. ;P
<_death>
the question is, if you get such an error from sbcl now, do you think you'll be able to figure out what happened?
<opalvaults2>
_death: do you have a suggestion on a resource I should read before going further in the book? I've only done a small amount of common-lisp (I am trying to build a ticketing system, I think you were here for that when I was asking about it?), so to answer more straightforwardly, probably not.
<opalvaults2>
happy to take a step back before going any further
<opalvaults2>
having a lot of fun with CL :)
<opalvaults2>
I was using caveman2 but it abstracts a lot up front so i wanted to go back to the beginning before I continued on using the library
<_death>
opalvaults2: reading PCL is fine, but it doesn't explain everything you need to understand, so what I mean is that you should also get more comfortable with reading the error messages and backtrace in the debugger
<_death>
in the backtrace, you can see that there is a (parse-integer nil :junk-allowed t) .. so you can look up parse-integer in the Common Lisp HyperSpec (do you know that?) and see that it takes a string
treflip has quit [Read error: Connection reset by peer]
treflip has joined #commonlisp
<_death>
and then you need to figure out why prompt-read returned NIL.. after evaluating defun prompt-read, you can test it in the REPL.. (prompt-read "Gimme: "), enter something and see the expected output
<opalvaults2>
I was not familiar with the Common Lisp Hyperspec, no! Thank you, I will bookmark that for reading up on the available macros(?) that CL comes with as I'm going forward. I think I'm used to a much less interactive environment in programming so that's something I'll have to get used to.
<_death>
it's one of the great things about Lisp :)
<opalvaults2>
I think so too so far! It's a lot more tinkering than I'm used to with compilers/interpreters (having only experience with Python and Golang).
<opalvaults2>
thank you again for the guidance _death, much appreciated!
<opalvaults2>
(plus thanks for the javascript heads up on that site, i'll use a different site. I have ublock origin with icecat so I don't typically see ads)
<_death>
opalvaults2: I have javascript disabled in my default browser, so when I need to visit something that requires javascript, I use a compartmentalized browser with almost vanilla configuration
<opalvaults2>
_death: which browser do you use? I've been thinking about using nyxt recently as it may help to immerse myself. Unsure if it can block javascript though, I've only seen LibreJS with Icecat able to do that (or setting it to disabled in about:config).
<_death>
opalvaults2: firefox, but anyway this is offtopic.. back to lisp :)
<opalvaults2>
true, okay.
<_death>
opalvaults2: in slime you can C-c C-d h parse-integer RET and it will look it up in the clhs.. you can also download an offline copy from the lispworks site and have slime use that by setting common-lisp-hyperspec-root
<opalvaults2>
_death: ah! so Emacs allowed more than just Emacs Lisp describe-function/variable. Excellent. Thank you for the pointer. Much better to read in info than having to look away to another document :)
<_death>
well, the clhs is html, so it needs a browser.. I use emacs-w3m but emacs's eww also works
karlosz has joined #commonlisp
sander has quit [Ping timeout: 240 seconds]
sander has joined #commonlisp
rain3 has quit [Ping timeout: 256 seconds]
<opalvaults2>
_death: it appears that sbcl/sly includes the macro/function definitions and explanations inside of describe-function. I'll have to cross reference it with what I see on the hyperspec to know if it's much different. Either way, nothing EWW can't clear up for me.
<opalvaults2>
yeah looks fairly similar (if not better formatted at the very least and searchable). Seems to include the source code as well. If only I had Emacs when I first started programming.
<opalvaults2>
ahh looks like I have an (interactive) function called hyperspec-lookup!
perrierjouet has joined #commonlisp
<opalvaults2>
I've set it to open up in a new EWW buffer. Wow. that's so cool :D
lisp123 has joined #commonlisp
<_death>
you can also look things other than symbols, like format directives C-c C-d ~ or dispatching reader macro characters C-c C-d #
x88x88x has joined #commonlisp
<_death>
glossary (I should use that more)..
* opalvaults2
~
<opalvaults2>
oops, apparently I don't have C-C C-d ~ bound correctly
<_death>
in slime buffers
lisp123 has quit [Ping timeout: 256 seconds]
<Guest74>
_death: thanks, I keep wondering what the formatting directives thing is, though it makes sense.
<opalvaults2>
oh! wow that's great! especially because those directives at first grok are hard to parse (but no harder than printf tbh). great to know there's a resource for them.
<opalvaults2>
_death: you're a wealth of helpful knowledge, thank you :)
<_death>
the hyperspec is the defacto specification of the language (it's derived from the de jure ansi document)
<opalvaults2>
alright, back to study. thanks again. i'm sure you'll hear from me again ;P
<akater[m]>
opalvaults2: There are at least 2 other hyperspec- commands, also very useful.
waleee has joined #commonlisp
epolanski has quit [Quit: Connection closed for inactivity]
qhong_ has quit [Ping timeout: 240 seconds]
qhong has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
<opalvaults2>
akater[m]: looks like I have about 6 of them upon M-x fuzzy search hyperspec.
<opalvaults2>
I'll have to take a look through them when I have some downtime at work.
<opalvaults2>
thanks! :)
djuber has joined #commonlisp
<mfiano>
Do you know how I can space-pad the front of a float with FORMAT? I am currently using (format nil "~vf" digits-after-dot percentage), but I want up to two spaces in front of the number (a percentage) so it's always a fixed width.
<mfiano>
I think I did this before a hacky way, but I can't seem to find the code, and I'm sure there must be a better way anyway
qhong_ has joined #commonlisp
qhong has quit [Read error: Connection reset by peer]
<_death>
(format t "~5,1F" 12.34)
<mfiano>
Sure beats my idea of separating the remainder and using ~d
<opalvaults2>
here's what I'm reading about it mfiano if you're interested
<rotateq>
format, a function with many directives :)
<opalvaults2>
an overwhelming amount, in fact.
<opalvaults2>
very flexible though it appears
<rotateq>
yes very powerful
<rotateq>
opalvaults2: it calls the macro FORMATTER on the control-string which parses it and builds the function to which the arguments can be applied
<Catie>
So if you know your string ahead of time you can pre-parse it to a compiled function?
<mfiano>
_death: How do I make that generic for any number of precision instead of 1?
sterni has quit [Quit: WeeChat 2.9]
<Shinmera>
Catie: any reasonable implementation will notice the constant string passed to FORMAT and do it for you
<mfiano>
That is also a variable in my program. Trying to figure out how to get two ~v's in there
<Catie>
Shinmera: Good to know! Thank you
nature has joined #commonlisp
<rotateq>
the april compiler by phantomics has a similar behaviour
<Shinmera>
I've never had a use for FORMATTER.
treflip has quit [Quit: good night ✨]
<rotateq>
Shinmera: yes, no direct use :) me too not
tyson2 has joined #commonlisp
<opalvaults2>
Wait so the compiler will pick up on string constants automatically?
<_death>
mfiano: there's no problem using ~V,VF
<opalvaults2>
replying to Shinmera*
<Shinmera>
If it's a good one, sure. It's a fairly trivial optimisation.
sterni has joined #commonlisp
<_death>
opalvaults2: implementations can define a compiler macro for FORMAT, so a literal format control string does not need to be interpreted during runtime (unlike C implementations with printf ;)
<mfiano>
Thanks
<Shinmera>
C implementations will also frequently catch printf and transform it.
* mfiano
has been away from programming for too long
<shka>
Shinmera: good evening
<Shinmera>
Hello
<opalvaults2>
Oh, I see. So format control string != the string being input so it can be put on the stack instead of the heap?
<opalvaults2>
pardon my ignorance if I get that wrong btw
<rotateq>
i still think there could be a need for more and broader educational material on compiler-macros
<_death>
Shinmera: interesting.. which C implementations do that?
<opalvaults2>
I'm a little used to how Rust decides to implement stack and heap concepts.
<drakonis>
ah its shinmera, hi there
perrierjouet has quit [Quit: WeeChat 3.3]
<Shinmera>
I am he
<opalvaults2>
rotateq: I'd be interested to bookmark resources if you know of any.
perrierjouet has joined #commonlisp
<mfiano>
They really aren't any different than regular macros, just that you can decline to expand, and an implementation may as well.
<rotateq>
opalvaults2: maybe for the beginning basic concepts are way more important to get right :) i can point you to good resources or bundle you some to upload
<Bike>
_death: clang does, apparently, in its SimplifyLibCalls pass
<opalvaults2>
rotateq: absolutely. I know nothing about the lisp interpreter/sbcl compiler so I'm happy to read up on how it handles these concepts.
<rotateq>
mfiano: i know, but as with readmacros the differences and when and how matter
<rotateq>
the book practical common lisp may be a good start for you
<opalvaults2>
rotateq: I'm actualling going through that book right now as I type this.
<opalvaults2>
:)
<rotateq>
okay good, i think that is enough for now. someone said some companies use it also to train new people
<mfiano>
If you have a function that applies a literal list known at compile time, you can remove that function call overhead with a compile-macro installed for your function, and similar things.
<_death>
Shinmera: try "%d %d"
<mfiano>
Though there are a lot of gotchas regarding constant variables. It's one of the only good uses for EVAL after you check constantness.
<mfiano>
Not using EVAL in a compiler macro is often a mistake, actually.
<opalvaults2>
rotateq: I'd believe that. Common Lisp has a mutable toplevel though no?
<Shinmera>
_death: I'm not interested in the limits of the expansion, just saying they do do it, as well as a bunch of much crazier shit like recognising common algorithm implementations and replacing them wholesale.
<Catie>
That's a use for constantp, right?
<Bike>
constantp tells you if something is constant. it doesn't tell you what the value of that constant is.
<Catie>
Having yet to run into a reason to use constantp, it's always just sort of been sleeping in the back of my head
<opalvaults2>
rotateq: from what I understand that's how the REPL is able to be integrated into programs easily. Happy to PM this sort of thing as there is other discussion happening.
<Bike>
some implementations have constant-form-value as an extension for that purpose, but failing that you have to try to figure it out yourself, or use eval
<Catie>
Right yeah, but if it's constant could you potentially optimize it?
<Shinmera>
mfiano: I prefer expanding to L-T-V than to hack stuff with EVAL.
<Bike>
if what is constant, could you optimize what
<mfiano>
Shinmera: Not always an option unfortunately. I think we talked about this not too long ago
<Shinmera>
I have no memory of that
<Catie>
If a form is constant, could you apply a transformation at compile-time rather than runtime?
<Shinmera>
Nor memory of ever needing to use EVAL in a compiler macro :)
<Bike>
sure. that's what we're talking about, isn't it?
<mfiano>
Catie: Yes
<Catie>
Bike: It is, I'm just trying to be very specific to get it into my head
<Bike>
Godspeed to you
<mfiano>
Shinmera: A constant could be a +constant+ passed from the user. Sure it is constant at compile time, like an other symbol :)
<Catie>
Thank you!
<Shinmera>
mfiano: ok, so?
<mfiano>
So a trick I learnd from cl-ppcre and scymtym is to use eval in this case
<Bike>
the problem with compiler macros is that they operate directly on forms, and almost certainly before compiler work like constant propagation that open more optimization opportunities.
Algernon69 has quit [Ping timeout: 268 seconds]
<Bike>
doesn't cl-ppcre use load-time-value for constant scanners?
<Shinmera>
I just expand to l-t-v and do whatever I need to in there.
<mfiano>
scymtym also said cl-ppcre has a bug in this regard, but he's have to elaborate further
<mfiano>
he'll*
Jing has quit [Remote host closed the connection]
<|3b|>
+constant+ might not have a value yet at compile time, so make sure you ensure it has one before looking at it :)
<|3b|>
(implementation only has to know it exists as a constant, and that only if defined at top level)
Jing has joined #commonlisp
perrierjouet has quit [Quit: WeeChat 3.3]
<opalvaults2>
In regards to with-open-file, "The stream object to which the stream variable is bound has dynamic extent; its extent ends when the form is exited." So if I understand this correctly, like most programming languages the compiler garbage collects with the final closing paren of the function?
<rotateq>
opalvaults2: no it's a programmable programming language :)
perrierjouet has joined #commonlisp
<Catie>
It just leaves scope at the end paren, there's no guarantee it'll be garbage collected. But after the closing paren, the file will be closed
<rotateq>
and with-open-file is a macro with an unwind-protect form, that automatically handles closing the file for you
<mfiano>
THis is not Rust. There is not explicit point in time a free will occur
<Shinmera>
opalvaults2: it means the consequences are undefined should you stash away the stream somewhere else and try to access it after the dynamic extent has exited.
zbrown[m] is now known as zborwn
<opalvaults2>
ah! okay, I think mfiano was right on the money in assuming I was thinking it acted in the same way as Rust does in regards to scope and gc. Either way, still good to know. thanks for the info!
zborwn is now known as nworb
<opalvaults2>
gotta shake a bit of the preconceptions
<Shinmera>
Common Lisp does not mention memory in any way, shape, or form.
<Shinmera>
You could write an implementation that runs on a tape drive.
<rotateq>
yeah wouldn't make sense in the spec as it's not just special purpose like C
<opalvaults2>
So if you need granular memory management, does CL allow for that sort of thing, or is it a "not the right tool for the job" kind of situation?
<Shinmera>
depends on the implementation :)
<random-nick>
depends on what you mean by granular memory management
<rotateq>
you can control and reprogram the garbage collector as what your impl offers you
<Shinmera>
usually you can employ standard tricks of creating manually managed pre-allocated pools and such
<mfiano>
dynamic garbage collection is very powerful and often gets a bad rap. Lisp GC's are often very good. In Rust, you are encouraged to heap-allocate a lot to get around the borrow checker, and when large objects go out of scope, large pauses can occur. The Rust community gets around this by implementing Drop on a background thread, which I can't even comment on why that is a bad idea.
<opalvaults2>
mfiano: I largely agree with you there. When you're learning they try and teach to allocate as much as possible on the stack and the compiler actively discourages otherwise (which is fine, I get it). I actually have no strong opinions on garbage collection. I also feel as though static typing gets the same kind of overhyped reverence. Not a fan of Clojure as far as I've ever tried it out, but I feel like Hickey has the right mindset.
<Shinmera>
I talked a bit about GC in my talk at GIC recently. It was very surface-level, but hey. Looks like that talk still hasn't made it to youtube, but the paper is here https://shinmera.com/paper/gic21.pdf
<rotateq>
sure Hickey did also a great job all in all
<opalvaults2>
I'd probably have chosen Clojure as the lisp-to-learn if the EPL was compat with the GPL ;P
<drakonis>
what is the deal with clojure anyways?
<opalvaults2>
Nearly purely functional lisp
<mfiano>
I think we are getting offtopic here
<mfiano>
#lisp ?
<opalvaults2>
Able to use java libraries
<drakonis>
hmm, sure.
<opalvaults2>
I think it's fairly on-topic as I'm comparing my experience with other programmings implementations of memory management vs common lisps. I think a few lines of off-topic shouldn't always be so bad. ;)
<rotateq>
or Racket, I used it some times to teach kids some programming
<opalvaults2>
s/programmings/programming languages
<rotateq>
opalvaults2: Clojure is mostly enslaved to the JVM :)
Algernon69 has joined #commonlisp
<opalvaults2>
rotateq: There's a common lisp that apparently can use the JVM iirc? Or at least can use Java libraries in some capacity.
<drakonis>
abcl
<opalvaults2>
I thought that was really cool.
<Shinmera>
opalvaults2: this channel has a long, long history of being very strictly on topic. You won't change any minds about it.
<rotateq>
yes ABCL
<opalvaults2>
Shinmera: that's fine, but it's really not a big deal.
<Shinmera>
that's like, your opinion, man
Algernon91 has joined #commonlisp
<opalvaults2>
Shinmera: truly. rotateq I was incorrect ABCL does run on the JVM
<random-nick>
abcl runs on java
<opalvaults2>
random-nick: correct the Java Virtual Machine
<random-nick>
reportedly that includes android java and java on .net
igemnace has quit [Ping timeout: 256 seconds]
<random-nick>
I don't know if those configurations are officially supported tho
<opalvaults2>
I kind of wonder how it compares to Clojure as far as compiler errors go. I'm not well-versed in Java so those compile time errors are basically hieroglyphics
<rotateq>
haha java on .net, as C# wouldn't be Microsoft Java anyway :D
<opalvaults2>
I imagine it's the same situation with ABCL.
<opalvaults2>
ah! And it's under the GPL! fantastic :D
Algernon69 has quit [Ping timeout: 250 seconds]
<jcowan>
Java on VM is available as part of mono.
<drakonis>
armed bear common lisp, defending the right to keep and arm bears!
<jcowan>
+1
<jcowan>
Perheps it should be "armored bear CL" instead
<drakonis>
its a reference to some old joke about guns
<rotateq>
do you know the joke?
<drakonis>
yes
slyrus_ has quit [Read error: Connection reset by peer]
<opalvaults2>
looks like this function allows for it to at least open up in w3m but I'm sure you could use eww.
<opalvaults2>
https://www.hexstreamsoft.com/articles/getting-started-with-the-clhs/ -- rotateq if you're interested, this details how you can leverage quicklisp to get an offline copy and point sly/slime to it for offline-browsing if you don't want to leave your emacs session
<rotateq>
oh no a hexadecimal stream
<rotateq>
i have the offline copy
<rotateq>
and thanks but i banned this site for my use
Guest74 has quit [Quit: Connection closed]
pdietz has quit [Quit: Client closed]
rogersm has quit [Quit: Leaving...]
lisp123 has joined #commonlisp
theothornhill has joined #commonlisp
lisp123 has quit [Ping timeout: 260 seconds]
pdietz has joined #commonlisp
lisp123 has joined #commonlisp
slyrus has quit [Remote host closed the connection]
slyrus has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
Jing has quit [Remote host closed the connection]
Jing has joined #commonlisp
cosimone` has quit [Remote host closed the connection]
cosimone has joined #commonlisp
paule32__ is now known as paule32
peterhil has joined #commonlisp
peterhil_ has quit [Remote host closed the connection]
peterhil_ has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
peterhil has quit [Read error: Connection reset by peer]
slyrus_ has joined #commonlisp
pve has quit [Quit: leaving]
slyrus has quit [Ping timeout: 250 seconds]
slyrus_ has quit [Ping timeout: 252 seconds]
tyson2 has joined #commonlisp
attila_lendvai has quit [Ping timeout: 260 seconds]
cjb has joined #commonlisp
jstoddard has joined #commonlisp
shka has quit [Ping timeout: 256 seconds]
slyrus has joined #commonlisp
jurov has quit [Ping timeout: 240 seconds]
theothornhill has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 256 seconds]
Guest74 has joined #commonlisp
aartaka has joined #commonlisp
azimut_ has joined #commonlisp
azimut has quit [Ping timeout: 276 seconds]
perrierjouet has joined #commonlisp
epolanski has joined #commonlisp
lisp123 has joined #commonlisp
gaqwas has joined #commonlisp
karlosz has quit [Ping timeout: 268 seconds]
lisp123 has quit [Ping timeout: 240 seconds]
nature has quit [Ping timeout: 260 seconds]
Algernon91 has quit [Read error: Connection reset by peer]