libera/#commonlisp - IRC Chatlog
Search
11:16:37
pl
It's not effectively possible to track CPython because the spec is "whatever PyEvalFrameEx is doing"
11:29:13
flip214
so it wasn't the QL update but the QL cleanup of "unused" stuff that broke the setup
11:37:56
gin
is the memory allocation different between these two options -- (push (cons a b) alist) vs. (push '(a . b) alist)? I think (cons a b) will allocate on the heap. what about '(a . b). does it not need to be allocated somewhere?
11:51:55
jackdaniel
from the allocation side, quoted expressions may be stored once in the memory, so single modification may impact all future accesses
12:07:42
pjb
gin: (setf *print-circle* t) (let ((fresh-conses '()) (literals '())) (loop repeat 3 do (push (cons 'a 'd) fresh-conses) (push '(a . d) literals) finally (return (values fresh-conses literals)))) --> ((a . d) (a . d) (a . d)) (#1=(a . d) #1# #1#)
12:08:27
pjb
gin: as you can see, there are semantic differences. That should be enough to decide which to use.
12:15:01
pl
SBCL generally will allocate literals in function header, so while I don't know how it would go with a cons cell, in my experience allocating a short vector resulted in said vector being completely stored in function header
12:16:43
jackdaniel
ECL stores literals in the FASL header, so it may possible collapse equal literals from different functions
17:22:26
Xach
etimmons: i don't see how that system file can be loaded. does asdf do something to suppress package-not-found or something?
18:16:52
etimmons
Xach: Huh, you're right (I haven't actually tried using clon in a while, I just remembered Didier mentioning that issue at ELS)
18:17:28
etimmons
ASDF does nothing with package-not-found, so sb-grovel must have been already loaded by the people that have gotten it to work
18:21:08
etimmons
xach: Anyways, the proper way of doing what he wants is to use `"sb-grovel:grovel-constants-file"` instead of `sb-grovel:grovel-constants-file`.
18:26:34
Xach
etimmons: i tried finding that info in the manual, but failed - is it in there? if so, can you tell me where?
18:36:13
etimmons
Xach: I can't find it either. And the commit that added that feature (50f2420f) didn't touch the manual
18:42:20
etimmons
Xach: Did you figure out a path forward with the UIOP version mismatch at compile vs. load times?
18:43:11
gin
if I want to a push the values of variables a and b into an alist, it is going to be (push `(,a . ,b) alist), am I right? just checking if my coding style is alright.
18:44:42
Xach
gin: i don't find it that common to use backquote to construct conses like that, but preferences vary. I'd do (setf alist (acons a b alist)) or (push (cons a b) alist) instead.
18:47:19
gin
moon-child: The Google CL guide I found online says, "For the Lisp efficiency point, given two options of equivalent complexity, pick the one that performs better. (This is often the same as the one that conses less, i.e. allocates less storage from the heap.)"
18:47:54
gin
moon-child: so I was avoiding (push (cons a b) alist) until now and going for (push `(,a . ,b) alist) but like Xach mentioned, I too did not find this coding style used by others.
18:48:29
gin
that is why I thought of coming to this channel and checking if I am doing the right thing by following the said style guide.
18:48:34
etimmons
Xach: Nice. I worry we're going to have users reporting a whole bunch of similar issues when the latest UIOP is actually released to QL, though.
18:50:04
lisp123
gin: my personal opinion (which is not much) is that you should use acons and not mutate the alist - given how powerful computers are, this very minor inefficiency is fine. UNLESS i guess you actually want to mutate it (there are many valid cases for that, but one should consider coding in a way without side effects wherever possible imo)
18:50:56
etimmons
Xach: This issue was randomly on my mind earlier today, so I opened <https://gitlab.common-lisp.net/asdf/asdf/-/issues/83>. Not sure if anything will come of it, but should be a lively issue thread at the very least.
18:51:07
gin
lisp123: my question isn't about acons vs. push. my question is about (cons a b) vs. `(,a . ,b)
18:51:58
gin
the Google style guide recommends avoiding cons whenever possible. but I never see the `(,a . ,b) coding style in practice. so that made me think if that style guide is followed in reality.
18:52:25
lisp123
gin: oh I see. (cons a b) is easier for me to read, but others who write a lot of macros may prefer the latter approach
18:53:41
etimmons
Xach: I mentioned it in that issue, but I may open a separate issue about this particular local package nickname thing. There might be support for another quick release to mitigate the issue for packages that don't explicitly ask for package local nickname support.
18:58:53
Bike
technically i guess an impl could use the information that modifying it is undefined behavior and do some kind of optimization there, but i doubt any of them do and the gain would be pretty marginal at best
18:58:54
gin
lisp123: by the way, why did you make the point about mutating the list? did you see any code example here in the chat that was mutating the list?
19:03:19
White_Flame
tacking on a new cons cell to the head of hte list does not mutate the old list's cells
19:04:37
White_Flame
(from its perspective. there might be multiple other cons cells that use that list as a shared tail to their list)
19:05:26
gin
lisp123: what do you get when you run this: (let* ((a (list (cons 'x 10))) (b a)) (push (cons 'y 20) a) (format t "a: ~a, b: ~a~%" a b))
19:05:56
White_Flame
so going from (2 3) to (1 2 3) or (1 . (2 3)), that (2 3) sublist is not mutated, and is used as the tail by the new (1 . <cdr>) cell which the place now uses as the first cell of its list
19:07:19
White_Flame
another place might still be pointing at the first cell of (2 3), and is completely unaware and unmutated when that other place now tacks on the (1 . ###)
19:07:32
gin
_death: I think so too that I have misunderstood the style guide. would you please explain what the style guide really meant here?
19:08:00
White_Flame
(1 . cdr), (2 . cdr), and (3 . nil) are 3 different objects on the heap that point to its respective 'next' list cell
19:08:45
_death
gin: assuming you mean https://google.github.io/styleguide/lispguide.xml?showone=Priorities#Priorities the wording there is not as decisive as "avoiding cons whenver possible".. there are ample qualifications, and note that efficiency is last on the priority order.. I don't particular like this style guide, and think the parenthetical remark should've been dropped
19:13:15
_death
gin: from what I heard in a recent talk (probably not recorded?) google's Lisp code is basically "C with parentheses" at this point so I don't think you should take its style guide as exemplary
19:15:25
Devon
gin: ITASoftware aka Google has very specialized needs, they can afford to spend extra work to gain performance.
19:15:50
_death
gin: this may be due to the constraints of their system.. you can read something written 20 years ago about it here: http://www.paulgraham.com/carl.html
19:16:21
White_Flame
pretty sure that naughty dog's GOAL was also mostly C-in-Lisp, but it makes sense there for performance gaming
19:17:32
lisp123
Would it be possible to convert 'usual lisp style' into 'c in lisp' style via macros?
19:18:48
White_Flame
it's like people asking if you can just compile JS to webasm, if you're in that space
19:21:05
pl
lisp123: there's a profile of webassembly that maps 1:1 with JS, which is common compilation target, but that's because Chrome's V8 has (had?) broken webassembly support
19:21:54
pl
White_Flame: GOAL was afaik a stripped down mix of CL and Scheme with liberal access to assembly
19:22:31
pl
White_Flame: no, webassembly. Because for considerable time, Chrome would compile webassembly to JS because it was incapable of JITing it otherwise
19:23:12
pl
the specific issue was that the JS roots of the V8 IR format meant there was no support for any sort of jump
20:53:16
ecraven
does slime have a "call this lisp function with region as a parameter and replace region with the result" builtin?
20:55:03
lisp123
I haven't played around much with slime's output / result settings, so I might do that as an exercise one day - let me know if you struggle with it
21:11:14
lotuseater
lisp123: spacemacs with slime is running here fine too. this DELL laptop I borrowed temporarily has some hardware issue
21:12:46
phantomics
I've been looking at developing an Emacs mode for April to give a REPL experience similar to the GNU APL mode
21:13:27
lisp123
ecraven: Functions you need to use to do what you are after are (slime-eval-defun), (kill-region), (insert ...), slime-eval-print
21:13:54
phantomics
Apart from that, another longer-range project of mine is aimed at creating a general-purpose Lisp interface, kind of like an IDE
21:14:01
lotuseater
phantomics: yes that was also what i thought about. or as i wrote, building with McCLIM some sort of IDE as Dyalog offers
21:14:46
lisp123
the first one (slime-eval-defun) you can probably avoid - you can use (buffer-substring-no-properties (region-beginning) (region-end)) to get the form, then pass it through slime-eval-print to get the result, then kill-region to delete the current region and finally insert to insert the result
21:15:10
lotuseater
we talked about eg it can get more performance by eg SIMDs meaning the SBCL intrinsics
21:16:05
lisp123
lotuseater: nice :-) will be curious to see how much performance you can get out of it (e.g. can you run a CRUD server)
21:16:54
phantomics
I build a web-based interface before where I had a window of APL code next to a window containing a Minecraft-style voxel environment generated by the APL
21:17:03
lotuseater
lisp123: atm i have NO IDEA how that even works. there is this nice blog article by Paul Khuong about it "for when abstracts too much away" :D
21:24:46
lotuseater
it was beginning of last year i got it running but didn't get how to do stuff. before my system had issues finding the .so files
21:39:54
lotuseater
the most important file is spec.lisp as you said in your long talk, right? i have to watch it again in detail and try out
21:45:33
phantomics
Most of the functions are implemented in library.lisp and aplesque/aplesque.lisp
21:46:01
lotuseater
and as i see the parser is with combinators. i wonder if Dyalog does it this way