freenode/#lisp - IRC Chatlog
Search
7:46:39
beach
markasoftware: I think NCONC is specified to modify the list, unless it is the empty list of course.
8:03:25
moon-child
markasoftware: nconc is defined in terms of rplacd, so it would have to be in-place
8:13:52
moon-child
not least because it's really well integrated with the rest of the language. And whitespace isn't significant, so you don't have to squish all the code together
8:15:23
aggin
what would be the best implementation of CASE that uses string= and also supports the OTHERWISE key ?
8:26:53
splittist
You can break a (cl-ppcre) regex into mulitple lines and provide line comments. That can reduce the write-only-ness of complex mangling.
8:49:36
semz
moon-child: cl-ppcre has an alternative sexpr syntax, though I find it pretty cumbersome and idiosyncratic personally
8:50:44
semz
I can really go without writing :non-greedy-repetition over and over to get optional matches
12:36:45
phoe
am I screwing something up here, or is it cheaper to sort lists than arrays on SBCL? https://plaster.tymoon.eu/view/2334#2334
12:40:07
flip214
phoe: though I'm trying to be at or above one second for TIME, to reduce noise a bit.
12:41:00
phoe
sure, let me try with 3M and bear with the fact that SHUFFLE is quadratic for lists...
12:48:58
Nilby
I think it's because it with the element type it actually has to do more copying. And quicksort may have a slight throughput advantage to mergesort.
12:52:36
Xach
i was looking for this, maybe you were too: https://web.archive.org/web/20200212080133/http://home.pipeline.com/~hbaker1/
12:53:31
Nilby
I imagine there might be some way to get that mergesort a smidgeon faster, by maybe having an architecture specific version. But of course the advantages of parallelizing are likely greater.
12:53:50
minion
Xach: look at baker: https://web.archive.org/web/20200212080133/http://home.pipeline.com/~hbaker1/
13:09:47
phoe
found it and recreated at https://gitlab.common-lisp.net/alexandria/alexandria/-/issues/21
13:13:15
phoe
I think the same way, but my nitpickish nature told me to nonetheless put the questions there
13:13:58
phoe
better to voice my worries out loud even if they are only going to be read by a single random person 10 years from now whose old code blew the heap because of this change
13:15:24
_death
so maybe that person is still waiting for it to finish, and in the meantime won't use the new shuffle
13:20:20
_death
if only it performed the shuffling on disk, like they used to merge sort "big data" in the old days...
13:21:16
_death
flip214: interesting.. I also had something like that happen to me, and only noticed a PR by chance
13:22:38
Nilby
Also of course the performance on a random value straight consed list is slightly faster than shuffled
13:29:50
_death
many alexandria functions are good for convenience but may not be the most efficient for your particular use-cases.. e.g., I remember having to implement a map-iota-permutations function that's similar to alexandria:map-permutations but uses a compact representation, given that the sequence is [0-n)
13:33:50
_death
flip214: I guess the reason for no notification is that your alexandria repo on github is a "fork"
15:15:11
jackdaniel
the usual way to designate a function as an implementation detail is to not export it
15:16:24
phoe
in my headcanon foo:bar is public, foo::bar is private, foo::%bar is an invocation to cthulhu and should never be used
15:17:27
jmercouris
the only reason we need the function that processes multiple salmon is because the caller expects to be able to pass a list of salmon to be processed
15:19:24
phoe
I'd avoid trouble and use a singular process-salmon and indicate this in the documentation/docstring, and ask the users to mapcar/mapc #'process-salmon if they want to try and process multiple
15:20:41
phoe
is a single salmon allowed to be a list, or not? if that is the case, you can make a very simple GF of typecase that accepts either a non-list singular salmon or a list of salmon
15:21:41
jmercouris
therefore I need a sort of 'mini wrapper' to just unwrap the list, I do NOT want to put that logic into scroll-page-to-heading
15:22:06
jmercouris
I would end up having to write a (if (listp heading) (first heading) heading) at the top
15:22:58
jmercouris
I don't think it is a wise idea to overload the value of heading to accept EITHER a list or a single value
15:22:58
phoe
this sounds like a question of API design - are your functions specified to accept a single object, a list of objects, or both?
15:23:19
phoe
I'd grab any of those choices (preferably the first, but that's my preference) and apply that consistently
15:23:46
phoe
if that is impossible, then specify in the function contract/documentation/docstring what is accepted by a given function - a single object, or a list, or both - and then use that
15:24:14
phoe
and then refactor as much as possible in order to aim for eventual consistency in the API
15:28:10
jmercouris
the problem is that many of our functions do not yet respect this, and they accept only single values
15:30:11
jmercouris
phoe: yes, when calling (prompt "give me some input") prompt will ALWAYS return a list
15:34:23
jmercouris
it is counterintuitive to pass a list when we only want the first value /always/
15:36:28
phoe
well then, you should encourage users to fix their code whenever you change stuff, too
15:38:52
phoe
;; and then you could just (make-command scroll-to-heading* scroll-page-to-heading) if you're willing to changing your MAKE-COMMAND macro to accept a function name instead of a lambda list and body
15:40:09
phoe
well then which one of them accept lists and which one of them don't accept lists, because things are getting real sloppy
15:41:41
jmercouris
And I can either wrap them as ive done with (first xyz) or use ensure car within the body of the actual function
15:43:15
phoe
because if (1 2 3) is a valid argument to one of your functions then (ensure-car '(1 2 3)) ;=> 1
15:43:30
phoe
and so your users will need to work around your sloppiness and manually wrap their lists
15:46:00
phoe
it's weird to me, because (download-links '(a b c)) operates on A B C whereas (scroll-to-heading '(a b c)) operates on A and nothing else
15:48:44
phoe
I'd honestly always explicitly unwrap this list whenever I want to get its first element
15:50:48
phoe
because if prompter is allowed to return a list of N elements (including one), then we need to always verify if we get a list of exactly 1 element
15:51:45
jmercouris
you see in my example, I wrap it and extract the first function quite explicitly
15:53:14
splittist
Just stick :before and :after methods to ensure-car all the things. What could go wrong?
15:57:42
phoe
but these multiple sources of information in the prompter, they happen one after the other, right?
15:58:26
phoe
does it mean that I can get three popups at the same time, each asking me for different stuff?
15:59:27
phoe
so it merges these sources of information in some way and displays a merged list of all them that the user can select from?
15:59:30
jmercouris
at this point the prompt will gather up all of the tomatoes you've selected and return them
16:01:54
phoe
it's a problem of you not being able to configure the *prompter* to only allow a single selection across *all* the sources
16:02:12
phoe
so info sources aside, you cannot tell the prompter that you want to get a single result from it
16:02:47
phoe
I'd like to have a prompter that forces the user to only select one and only one thing, only to return it
16:03:10
phoe
but then also has the multi-select behavior as an option to allow opening multiple URLs, for example
16:04:02
jmercouris
starting with "When I wrote this I realized it did not work. Then I tried to do"
16:04:47
phoe
but it's not the prompter returning that IMO is the problem, it is the prompter getting invoked
16:05:06
phoe
I'd like to invoke the prompter in a way that always returns one element, because then I can depend on that element being singular
17:37:05
mfiano
So if we have a class with a few slots that is not exported, and then we have a macro
17:37:17
mfiano
MOP question: If I have an internal class that is not exported which has a few slots, and then I have a macro that is exported that the user uses to define a class that is a subclass of this class (among other details), can our internal code reliably use STANDARD-INSTANCE-ACCESS to access the inherited slots, without fear of the vector positions changing when the user redefines the subclass?
17:38:34
mfiano
The internal class is never going to be changed itself, only the user's subclass, which we want to S-I-A in our internal code to access the inherited slots
18:14:59
fiddlerwoaroof
It turns out that if you do (SET-PPRINT-DISPATCH 'string ...), you can break ASDF/UIOP
18:16:15
fiddlerwoaroof
For portability, they should probably copy the pretty-print dispatch table and add it to the WITH-SAFE-IO-SYNTAX macro
18:17:23
_death
fiddlerwoaroof: you should use your own dispatch table.. I have a patch for slime that lets you have a repl-specific dispatch table
18:18:17
fiddlerwoaroof
So, user error, but it seems like the sort of problem a library like ASDF should think about
18:19:03
_death
fiddlerwoaroof: as I wrote in that patch's commit message, their assumptions may not be warranted, but this is the real world ;)
18:43:33
waleee-cl
Will a newer sbcl re-use the cached files in ~/.cache/common-lisp from the previous version on the system?
18:44:04
waleee-cl
I got a package error when building nyxt that went away after wiping the cache, hence the question
18:45:28
_death
waleee-cl: sbcl's fasls have versions, but even with the same version I don't know if you can practically rely on that
18:45:39
Bike
mfiano: i think you can rely on the slot locations being the same unless the user can use multiple inheritance or affect the inherited slots in certain ways
18:45:54
waleee-cl
_death: yeah, I guess. It worked without wiping it for about 4 months of sbcl's straight from the git repo
18:46:05
Bike
mfiano: "For a given class, the locations increase consecutively, in the order that the directly accessible slots appear in the list of effective slots."
18:46:39
mfiano
Bike: I was told the MOP does not guaranteee slot locations, in that the "youngest" slots could be placed first.
18:46:59
Bike
"Direct slot definitions coming from classes earlier in the class precedence list of class appear before those coming from classes later in the class precedence list."
18:50:12
Bike
oh, wait, i see, "The result of compute-slots is a list of these effective slot definitions, in unspecified order."
18:51:30
Bike
if this is important, you could define your own metaclass with a compute-slots that does define the order/locations
18:52:21
mfiano
I would have to underatand that better to see if the obsoileted instance edge case would bite me
18:53:39
mfiano
Also I feel like I would totally screw that up. I'm not very familiar with defining custom metaclasses
18:56:51
mfiano
Bike: is beach's example here doing just that? https://common-lisp.net/~mevenson/lisp/beach/CLOS-MOP-HTML/instance-structure-protocol.html
18:57:42
Bike
yes, although as you can see you have to explicitly specify the slot-order for every class, which is probably not what you want
18:59:59
mfiano
Really all I want is for 2 slots in a private class that is the sole direct superclass (enforced by a macro) to always by first in the storage
19:02:44
Bike
sure. plenty of ways you could do that. all you need to do is make sure compute-slots always returns those two slots first
19:05:23
Bike
it's simple. say your slots are named A and B. one thing you could do would be to (call-next-method), get your list, look for the slots named A and B, and reorder them to the head of the list, and then return that.
19:13:55
mfiano
Can you dumb it down for me, as far as how your suggestion of using c-n-m is different than the use of it there?
19:14:18
Bike
in the example they sort the entire list with this predicate that uses the (custom) class-slot-order property
19:15:59
Bike
(defmethod compute-slots ((class whatever))(let* ((prev (call-next-method))(a-slot (find 'a prev :key #'slot-definition-name))(b-slot (find 'b prev :key #'slot-definition-name)))(list* a-slotb-slot(remove a-slot (remove b-slot prev)))))
19:20:23
Kingsy
https://github.com/xach/buildapp <- is this considered the easiest way of buildign an executable when using commonlisp ?