libera/#commonlisp - IRC Chatlog
Search
15:58:05
beach
http://metamodular.com/SICL/environment-info.pdf is the latest version of our paper on Trucler to be submitted to ELS'22. Feel free to give us feedback. I am not sure whether we should include CLISP in the section on previous work, and I am not sure where to find the most recent CLISP code. Opinions are welcome.
15:58:37
beach
The deadline is presumably this coming Sunday, but I fully expect another week of extended deadline.
16:02:46
beach
It has no CLtL2 environment functions. I might have a look at the native environment representation, but it is likely to be in C.
16:08:22
phoe
but there's no good way to access them from the outside, I can't find any good interface after a really quick look
16:10:08
phoe
whatever it is, it prints some lambda-like Lisp forms, so it has to keep them memorized somewhere
16:11:39
phoe
that's a macro to return the current environment, similar to what I've done above, I guess
16:19:33
contrapunctus
beach: re: clobber-demo, to get the aforementioned error ( https://paste.rs/MEQ ) all I did was `(ql:quickload :clobber) (in-package :clobber-demo) (do-things-1)` ...any idea why that's happening?
16:23:32
contrapunctus
I thought it was supposed to be a symbol, perhaps, but quoting it didn't change anything
16:24:36
contrapunctus
(i.e. `'*transaction-log*` instead of `*transaction-log*` ) ...and, well, it gave a different error.
16:29:42
beach
contrapunctus: I am sorry that it's not better documented. I wrote it mostly as a concrete suggestion in the debate about prevalence, serialization, etc.
16:47:10
contrapunctus
beach: just made a PR 😀️ see if you like this as the README - https://github.com/robert-strandh/Clobber/blob/fb401800f0bb9f986691279d4349dc4925823cf3/README.md
16:59:20
phoe
I am free to instead write 50 kB of Markdown regarding the state of our Common Lisp world in light of some recent kerfluffles that echoed through it
17:05:15
beach
It seems to me that people spend more energy obsessing about this "community" thing than they spend working to get more stuff done.
17:14:12
Bike
not that i've been paying much attention, but "somebody is hassling the ASDF dev enough that they want to quit" seems like a specific actionable issue
17:15:12
phoe
I gotta finish my article about that since finger-pointing at people is a thing that is both dangerous and missing the point
17:28:10
rotateq
oki, I'm glad to be allowed to learn so much from you all, as exchange of thoughts is very important
17:29:44
phoe
I have no idea if it's explicit permission - IMO it's more like, you simply are a decent citizen of #commonlisp
17:31:24
phoe
no spamming, no trolling, no personal attacks, no asking the same question over and over again, no soliciting money after proclaiming yourself to be the sole worthy leader of the Common Lisp community at large and the only savior from some almighty mafia thing that is both otherwise undefeatable and comically impotent in stopping you altogether
17:31:47
phoe
just hanging out and asking questions is more than fine, that's what #commonlisp is for
17:37:33
rotateq
yes right, like you for example. I'm no programming genius like gilberth or others here, but I try to get better every day.
17:43:29
Bike
"ffloor, fceiling, ftruncate, and fround handle arguments of different types in the following way: If number is a float, and divisor is not a float of longer format, then the first result is a float of the same type as number. Otherwise, the first result is of the type determined by contagion rules;"
17:44:28
Bike
by the contagion rules, if divisor is a rational it's converted to a float of number's type, so the result will be of that type
17:44:47
Bike
and if it's a float of shorter or equal format, by the contagion rules it will be converted ot the larger format, again giving you the type of number
17:45:27
Bike
not specifically, but the way this is phrased the divisor clearly exists, presumably defaulting to 1 if necessary
17:45:31
phoe
Bike: maybe it's a repetition; see e.g. CLHS STRING which does not mention the term "string designator" and instead spells out the "string, symbol, or character" thing fully
17:46:13
Bike
yeah but the page on the string function doesn't also use the phrase "string designator"
17:49:40
Bike
no, but i mean, the way this ftruncate is written, it's phrased as if these rules are different from the general contagion rules
17:51:56
Bike
if it just repeated the contagion rules, that would be one thing. but no, it says "do this, except sometimes do the contagion rules instead"
17:53:01
aeth
it could've just been something that wasn't caught in the editing process as the standard changed over time
17:53:08
Bike
semz: point, but then if we follow the text as written, we do follow the contagion rules if number is a rational (so if the divisor is also a rational, the result would be)
17:55:02
jasom
In theroy if you did ffloor 1.0d 'a then the result would need to be a double-float since the divsor is not a float of a longer format :P
18:02:34
jasom
Also, it might matter for implementations with subtypes of real other than integer and float?
18:03:17
jasom
Also, it might matter for implementations with subtypes of real other than rational and float?
18:04:30
jasom
log-scaled numbers would apply, maybe fixed-point too (though those are arguably rationals)
19:28:48
rotateq
phoe: but if you would like it, i could come up from time to time here with another erc instance and give statements (rather than expressions) like "all those silly parentheses!" and then leave :D
19:31:11
rotateq
i remember this one dude some months ago immediately "is clhs the best that can be done?" or others
20:04:47
simendsjo
In some languages, I can use _ as a variable (or prepend _) to indicate a variable is unused. In CL, this is `(declare (ignore x))` as I understand it. While it does what I want, it's very verbose, especially in short lambdas. Are there a shorthand/hack available?
20:06:07
semz
Within loop forms you can use nil to indicate that the variable is unused, but this is a special case.
20:06:08
phoe
the only helpful thing is that required arguments in DEFMETHOD don't have this behavior
20:08:48
jmercouris
anyone can think of an elegant way of collecting every other element from a list? E.G. (list 0 1 2 3 4) -> (list 1 3)
20:09:02
jmercouris
now, note that this list isn't a number, so I can't do evenp or some other such heuristic
20:09:58
EdLangley[m]
jmercouris: (mapcan (let ((it nil)) (lambda (v) (setf it (not it)) (if it (list v) (list)))
20:09:59
EdLangley[m]
s/jmercouris: (mapcan (let ((it nil)) (lambda (v) (setf it (not it)) (if it (list v) (list)))/jmercouris: (mapcan (let ((it nil)) (lambda (v) (setf it (not it)) (if it (list v) (list)))/
20:10:53
jmercouris
I mean, I understand it, but at glance goin through the codebase, I would do a double take
20:11:16
EdLangley[m]
The predicate would be: (let ((it t)) (lambda (v) (setf it (not it)) (if it (list v) (list))))
20:11:52
phoe
(let ((list '(0 1 2 3 4))) (remove-if #'evenp list :key (alexandria:rcurry #'position list)))
20:12:07
EdLangley[m]
Where true-every-other-time is: (let ((it t)) (lambda (v) (setf it (not it)) (if it (list v) (list))))
20:15:55
phoe
jmercouris: https://franz.com/support/documentation/cl-ansi-standard-draft-w-sidebar.pdf
20:18:33
rotateq
jmercouris: i remember very well the situation i was in when beginning, so yes, not very beginner friendly :)
20:20:22
rotateq
oh i can imagine, for me not so much, but other "not normal" stuff and more math things before
20:21:40
rotateq
and now you're so deeply into the AWESOME project of nyxt jmercouris, or don't i remember that correctly?
20:22:33
rotateq
firefox annoys me more and more, but i have to redo the nyxt tutorial and manual, so finally can get productive at serious browsing too
20:22:50
jmercouris
well, 2.2.4 is quite good, and I would say is a suitable replacement for a standard browser
20:23:43
semz
EdLangley[m]: Funny enough that's really a criticism of everything outside Lisp in disguise
20:26:01
rotateq
"… it's just that in C++ and the like, you don't trust anybody, and in CLOS you basically trust everybody. The practical result is that thieves and bums use C++ and nice people use CLOS."
20:36:29
theothornhill
Can someone help me understand this a little better? What is the shl for, and how does that relate to the line below? That's line 10-11
20:38:37
dre
i got the common lisp client merged into nvim-conjure if there's still nvim users here.
20:44:25
Bike
yeah. "immediate" because it's in a register or something instead of memory. and "tag" is the end 0. non-fixnums have different tags.
20:45:54
Bike
yes. zero is used as a tag since it has the convenient property that you can add and subtract tagged fixnums without untagging or retagging.
20:47:57
theothornhill
Yeah, because then the number will end in zero, so the condition will always be false, no?
20:47:58
Bike
i guess probably some sb32 times itself is a bignum, and it's a check to return that in that case?
20:48:31
theothornhill
Yeah, maybe, but i set safety 0 and speed 3, so probably that will fail if we overflow?
20:50:43
Bike
so, if the imul overflows, num must have been -2147483648, so the cmov arranges to return the bignum 4611686018427387904
20:51:28
Bike
if you put in some non-(signed-byte 32), since you have safety 0, it will just return that bignum anyway
20:54:17
rotateq
theothornhill: be careful declaring (optimize (safety 0)) when full moon is, the loopus is out for hunt
20:54:49
theothornhill
So it's a conditional check for overflow that checks whether the shift left destroys the tag?
20:57:32
rotateq
in 'Common Lisp Recipes' edi clearly says the three steps of optimizing "1. don't do it. 2. don't do it. 3. don't do it (yet)"
20:58:10
rotateq
so much money and time always wasted every day in the world with directly think about over-optimizations sacrifycing other stuff
20:58:34
theothornhill
4. do it when you want to look at the disassembly and compare with other things through godbolt
20:59:32
theothornhill
And I'd also like to get a feel for _how_ the disassembly looks, intuitively, I mean.
21:02:54
phoe
analyzing disassemblies might be important, depending on what you do and what you are optimzing
21:03:40
phoe
and a question about reading and understanding disassembly seems to be exactly what theothornhill posted up there
21:03:45
theothornhill
hehe, you are not wrong, and I agree with you. The reason I'm doing this now is that I don't want to code in C to learn about x86
21:05:57
semz
theothornhill: In case you meant (optimize (safety 0) (debug 0) (speed 3)) instead of the rather bizarre (safety 0) (debug 3), please don't, especially in public interfaces let alone everywhere. It's not the "make Lisp fast" button, it's the "make Lisp segfault on minor mistakes" button.
21:09:47
Bike
"So it's a conditional check for overflow that checks whether the shift left destroys the tag?" a shift left isn't going to destroy the tag, since a zero bit will be shifted in
21:10:10
Bike
however if the imul returns a high enough number, the most significant bit will be set, and that will be shifted out by the shl, causing overflow
21:10:11
theothornhill
rotateq: but yeah, I think looking at the internals is very interesting. Implementation dependent or not. That's why I like lisp. You can choose your abstraction level at any time, and noone (apart from irc, perhaps) will judge :P
21:11:04
pjb
Bike: it's not so obvious that 7 << 1 + 7 << 1 = 14 << 1 in C. AFAICS, it depends on sizeof(int) and CHARBITS, and it expects some consistency between the undefined behavior of << and of +, which is nowhere guaranteed, since we're talking of undefined behavior of two different operators.
21:12:13
frodef
Is there any semi-standard (library) function that flips the args of a binary function?
21:12:55
pjb
frodef: I don't know of any library gathereing this kind of functions. I've proposed to newbies to write one several times. Cf. Baker's functional paper.
21:16:14
theothornhill
pjb: offtopic now, but isn't 7 << 1 + 7 << 1' '7 << (1 + 7) << 1' in implicit precedence?
21:19:09
Bike
before coming in with a pedantic criticism, just ask yourself: does this actually matter? am i improving the clarity of this conversation by making this point, or just making it that much more obscure for no good reason?
21:19:43
Bike
also, maybe don't do it if the criticism doesn't even apply within the irrelevant circumstances, as per the C minimum size
21:20:38
theothornhill
Sorry if I offended you. Thanks for your help. I was just trying to understand.
21:24:04
theothornhill
Well, you'd be happy to know that (square most-positive-fixnum) returns that constant, and. (square (1- most-positive-fixnum)) returns 4
21:25:14
theothornhill
Both of which are clearly crazy results. Seeing how safety is 0 in this case, I guess all bets are off and bogus values are preferred?
21:26:19
phoe
can be anything from an error through silently returning invalid values all the way into trashing your heap and/or stack
21:27:04
theothornhill
Well, you'd have to run enough code with safety 0 to find them. I seems noone dares
21:29:30
phoe
there's a reason why I have two sb-ext:restrict-compiler-policy calls in my rc file - one for safety 3, the other for debug 3
21:30:50
mfiano
I think that edge is not really there and you are falling to your doom, you just haven't realized it yet, like Wile. E. Coyote.
21:33:43
rotateq
theothornhill: I can just do stupid and unuseful stuff :) and of course asking dumb questions
21:33:48
semz
(safety 0) doesn't really do all that much outside of special situations (where you're better of with a (locally (declare ...) ...)) anyway, it's usually some 10%
21:35:36
rotateq
i often wrap classes where slot-types shall be explicitely checked (and not just having it for kind/part of documentation) with (locally (declare (optimize (safety 3))) ...)
21:35:56
theothornhill
Bike: the clc in that disassembly though. I read somewhere sometime that that was for extra values as in (values 'foo 'bar). Why isn't that removed in compilation when the function makes to calls to values? If I'm correct, that is
21:36:59
Alfr
Though (safety 0) sometimes is useful, e.g. when trying to match the disassemble output with the code I wrote.
21:37:03
Bike
theothornhill: it still needs to indicate to the caller that exactly one value was returned. as explained in http://www.sbcl.org/sbcl-internals/Unknown_002dValues-Returns.html#Unknown_002dValues-Returns this is indicated by clearing the carry flag.
21:37:32
Bike
(this is an "unknown values" return because the caller knows nothing about this function)
21:40:58
theothornhill
Bike: thanks! Interestingly it seems to me from reading this, that returning more than three values might be slower, since it involves the stack, but <= 3 values does not.
21:41:52
Bike
probably, but also the caller's code might be a little slower with multiple values versus one, since it has to do a little more to determine the number of values
21:43:05
Bike
it can get subtle. if the caller is expecting some number of values, due to a type declaration or whatever, that might be a little more optimized. i don't know.
21:44:23
theothornhill
My guess is that if performance would be that important you'd probably not return multiple values at all, or not use lisp in the first place
21:45:01
Bike
well, this probably won't be a bottleneck anyway, compared to boxing floats or something
22:51:02
masinter
the franz PDF of dpANS converts to HTML OK. I imagine it would be better to start w'ith the tex
23:02:22
mfiano
At some point, but at all points, likely higher (I never even mentioned mine publicly)
23:52:49
mzan
theothornhill: eh, if you came from C, (signed-byte 32) is "error-prone". You had to change mentality.
23:53:48
mzan
You are saying to Lisp that you want to manage numbers with a range of (- 0 (ash 1 31)) to (ash 1 31)
23:54:31
mzan
For example usually in SBCL, in 64 bit platforms the last 3 bits of a number are used as tag.
23:55:44
mzan
(defconstant +max-bits+ (- (max (integer-length most-positive-fixnum) (integer-length most-negative-fixnum)) 1)
23:55:44
mzan
"After these bits, native numbers are not any more nice inside CL run-time, because they will be big numbers.
23:55:44
mzan
I subtract 1 bit for avoiding problems with signed fixnum. This is not optimal, but for this code example, good enoxgh.")
23:56:44
mzan
In CL it is the contrary of C. You don't think to number formats. The CL will change numeric format automatically if it discover an overflow during calculations.
23:57:13
mzan
Only in the end, if you want very fast code, then you can starting optimizing the code.