freenode/lisp - IRC Chatlog
Search
13:58:23
Bike
if you're adding strings rather than characters, i would use concatenate or indeed with-output-to-string
13:58:36
Nilby
from my tests reduce by conatenate is fastest on sbcl and with-output-to-string is fastest on ecl
14:01:29
phoe
if you collect into a vector then you'll need to copy it anyway in order to have ("x" "xx" "xxx" "xxxx" ...)
14:02:50
dlowe
You might want to use reduce instead of apply so as to not hit argument number limits
14:05:58
jackdaniel
(loop until (string-equal (random-string) (expected-result)) finally (return (random-string))) ; that will work under assumption, that random-string will generate the same string twice in a row
14:07:36
dlowe
an efficient implementation would sum the lengths of strings, create a new string of the proper size, and REPLACE them all into the destination
14:10:12
_death
if you know the length beforehand, allocating a string and replacing (or FORMAT :) is indeed good.. but w-o-t-s is also good enough, and apply concatenate should also be ok.. not reduce though
14:20:24
Bike
even if it is, you could probably break it up into multiple concate calls and then concat the results
14:21:04
dlowe
(defun concat-string-list (l) (let ((o 0)) (reduce (lambda (r s) (replace r s :start1 o) (incf\
14:22:30
dlowe
(defun concat-string-list (l) (loop with r = (make-string (reduce '+ l :key 'length)) for o = 0 then (+ o (length s)) for s in l do (replace r s :start1 o) finally (return r)))
14:38:36
_death
Bike: call-arguments-limit may be big, but in practice things don't go so well.. I just tried (progn (apply #'concatenate 'string (loop repeat 100000 collect "x")) nil) on sbcl
14:47:57
jackdaniel
I think that if you try to concatenate 100k strings, you may have other problems than the call arguments limit :)
14:48:37
jackdaniel
hm, too many ":)", that was obviously a joke, but not a sarcastic one, mind that!
14:50:39
_death
other problems.. I just compiled sbcl from head and trying to figure out what some strange new warnings mean
14:52:13
_death
; caught 9 WARNING conditions ; caught 500 STYLE-WARNING conditions ; printed 3604 notes
14:56:07
_death
sure.. it's my personal snippets code base after all.. but I think I'll take more time to understand it
15:43:38
_death
anyway, the warning said that the derived type of something is (values null &optional) not number because it's the result of CAR, and although I know it to always be a cons (with a number in car) sbcl thought NIL might be passed to CAR
16:19:12
_death
yes.. but if the inner IF actually comes from an inline function, that warning may not be so useful (not to mention it may cause compilation to fail...)
16:24:36
_death
correct, but like I said, change the inner IF to (F X) and have (defsubst f (x) (if (consp x) 'it-is-a-cons (* 1.0 x)))
16:26:21
_death
but SBCL will warn because of the dead code, because it doesn't know that the argument will always be CONS
16:27:03
_death
and because there's a layer of indirection (actually, there were several inline functions calling each other, so it was multiple layers) the warning was confusing
16:32:53
phoe
the real issue is the fact that SBCL derives the type of X in (defun f (x) (if (consp x) 'it-is-a-cons (* 1.0 x))) to be T, not (OR CONS REAL)
16:34:01
_death
I also note that sbcl doesn't warn on (> (CAR X) MAX) .. even though X may be NIL.. this is pragmatism.. but for example SBCL does warn on the result of POSITION
16:44:10
_death
the good news is that the new assign-but-no-read warning did find a small bug in some old code :)
16:44:18
Nilby
slime doesn't seem to save repl history permanently so I wonder if anyone has my problem
16:45:40
_death
Nilby: have you seen https://github.com/vseloved/flight-recorder ? I didn't try it though
16:49:07
_death
there was also a blog post.. at the time I wonder why wouldn't a simple sqlite database suffice
16:49:46
Nilby
That seems useful. But I don't use slime. I have 40k lines worth of REPL history. Some junk, but some magic. Everyday it grows and gets slower.
16:51:56
Nilby
It can already go in sqlite, but it seems like it needs tagging, and garbage collections, so I'm wondering if anyone else has such a problem.
16:55:27
_death
https://lisp-univ-etc.blogspot.com/2018/09/ann-flight-recorder-robust-repl-logging.html
16:59:58
Nilby
unfortunately http doesn't seem like a performant thing for history searching keystrokes, although I guess browser search bars are a counterexample
17:04:34
Nilby
deaht: cool, thanks. that looks like it could scale. maybe jjwiseman had the problem too.
17:05:37
_death
Nilby: heh, I just concatenated the two strings, "montezuma" and "repl history".. not sure the former comes with support for the latter ;)
17:47:17
phoe
sjl_: is it expected to stare more at the cadetesque keyboard than at the actual books
17:47:48
sjl_
I still need to get around to setting up the firmware on the board, and buying some wrist rests for it.
17:51:43
sjl_
could get one of these https://keeb.io/collections/keyboard-pcbs/products/bdn9-rev-2-3x3-9-key-macropad-rotary-encoder-and-rgb and bind it to various inspector/debugger shortcuts for fun
17:55:00
sjl_
anyway yeah, I got my paper copy of your CL book today. Already started reading Holms' book and Lisp in Small Pieces though, so it'll have to get in line, hah.
17:59:15
ane
what sort of testing is run to ensure a quicklisp distribution "works" and is in releasable condition?
18:01:32
phoe
well... nowadays, an ASDF thing; previously it was also for mk-defsystem and other build systems that are no longer around
18:01:57
ane
I'm asking because folks over at GNU are building yet another package repository for emacs lisp and I was thinking of suggesting to have it do monthly/<x>ly distributions
18:02:23
ane
actually I did suggest it https://lists.gnu.org/archive/html/emacs-devel/2020-10/msg01531.html but I haven't mentioned quiclisp yet
18:03:58
phoe
a module is a deprecated CL term that is not really used because it's too generic and because ASDF systems have taken over
18:06:04
Inline
right, when you are referring even to 1 file which is in a subfolder, sometimes the pathname stuff doesn't work or gets cumbersome or so
18:07:23
phoe
actually pathnames and namestrings work well enough with those, or they have at least worked well enough for me
18:07:38
Inline
problem is when you are trying to group files together from different subfolders i suppose
18:08:09
Inline
then one has to combine all that stuff in one pathname, via merge-pathnames or so, not sure if that works, i'm just making that up now
18:09:11
phoe
I mean you could do things like #P"foo/bar/../baz/quux.lisp" but that would be, uh, kinda pointless
18:09:55
Inline
like to say this is your toplevel, and these are your subdirs, only these which are given explicitly etc...
18:09:58
dlowe
yeah, just because you have the flexibility to do a thing doesn't mean it's a good idea
18:11:16
Inline
yes, or relative, which might make things combsersome to use from the toplevel as a toplevel load thing tho
18:12:35
Inline
kinda like a hint or a protocol spec, like in saying "not thought to be used from toplevel"
18:13:58
phoe
but ASDF knows the system-definition-pathname of :phoe-toolbox and can therefore construct a full absolute pathname
18:24:17
Inline
just for the sake of maybe isolating a system definition, which might got stray because you pasted the wrong thin in the wrong buffer, or the developer had a glitch in his/her last git push, and you are not social enough to mail them about their failings, or not willing to wait for next git push......
18:26:45
Inline
actually i'd not know if it would be polite or just asocial to not mail them in that case either .....
19:26:48
loli
how does ASDF deal with breaking package changes nicely, just have a local path and grab the dependencies you suspect which might change?
19:28:36
loli
say you rely on package with a function Y, and that package updates, and either Y takes different types of arguments or maybe that function was deprecated and removed, or maybe the exports got changed and now you have a shadowing conflict
19:30:09
phoe
a system might want to provide its own mechanisms to gracefully upgrade itself, but there's nothing built-in in ASDF
19:33:15
dlowe
how much anguish could have been saved if they had made Python 3 just be called Snek 1
20:22:34
johnjay
dlowe: python3 is a good example of why you can't really fundamentally change your language or platform, esp after a long time
20:22:41
Xach
hmm, the text of the issues in the hyperspec do not appear to be in the dpans sources.
20:23:37
aeth
johnjay: Perl 6 was the only larger failure than Python 3 as far as language transitions go. At least people mostly wound up on Python 3 eventually