<dialectic>
I have, in some of my lightweight archaeology, discovered something called an "array leader" which existed in Lisp Machine Lisp among other places, and which might have made it into Common Lisp but did not. Is this similar to, in C:
<dialectic>
struct { t1 f1; t2 f2; t f[] }, i.e. the array header pattern?
<Bike>
this appears to be described in the chinual.
<dialectic>
Wow, I didn't know Stallman was a co-author of that.
<dialectic>
I thought it was just the other two, Moon and Weinreb.
<Bike>
it does seem a bit like a flexible array member, but it can be accessed as a thing in itself, so it might not have been implemented as one
<Bike>
well
<Bike>
it seems like everything in the struct EXCEPT the flexible array member, i mean
oni-on-ion has joined #lisp
<Bike>
wait, no, you can't swap out the array leader
<dialectic>
Interesting. I wonder why it didn't make it into CL. That's useful if you're handed a contiguous "buffer with a header" from somewhere else.
<Bike>
well, the leader represents lisp specific data
oni-on-ion has quit [Remote host closed the connection]
<Bike>
e.g., it mentions the zeroth element of the leader is the fill pointer, and if you use an array with a leader but don't treat that spot as a fill pointer you'll have problems
<beach>
Good morning everyone!
oni-on-ion has joined #lisp
<Bike>
still, it could be kind of neat to have FAM type structures
<dialectic>
FAM?
<dialectic>
fields and memory?
<Bike>
flexible array member because i'm sick of typing it out
<Bike>
the formal name for the C pattern you mentioned
<dialectic>
Oh. Embarrassed I had forgotten that. I don't do embedded anymore.
<Bike>
everybody just does f[0] instead anyway
karlosz_ has joined #lisp
torbo has joined #lisp
akoana has joined #lisp
<White_Flame>
dialectic: in my reading of the Ivory, the array leader is variable-sized. The Lisp implementation chooses to implement certain structures using arrays, and can store any amount of metadata in the leader. The CPU mechanisms are oblivious to what's there
<White_Flame>
on the Ivory, the object pointer to an array is to the normal array header, and the leader is before that in memory
<White_Flame>
as wellas being optional
notzmv has quit [Ping timeout: 245 seconds]
dialectic has quit [Ping timeout: 246 seconds]
linli has joined #lisp
linli has quit [Ping timeout: 258 seconds]
libre-man has quit [Ping timeout: 245 seconds]
libre-man has joined #lisp
torbo has quit [Remote host closed the connection]
vlatkoB has joined #lisp
dialectic has joined #lisp
akoana has left #lisp [#lisp]
<dialectic>
White_Flame: Oh? Curious. If that's the case, no wonder it was removed.
nanoz has joined #lisp
<White_Flame>
yeah, it's definitely an implementation artifact for constructing other compound data types, not a feature of standard arrays
<White_Flame>
for instance, flavor/clos class pointers would go there
<White_Flame>
but since the GC was very low-level, the memory layout of extended custom objects needed to follow a regular model that the GC could always grok
<White_Flame>
hence that metadata leader blob
<White_Flame>
nowadays, since GC is at the same software level as the rest of the software runtime, it can be much smarter
<White_Flame>
and object types can have much more customization than relying on low-level array metadata
karlosz_ has quit [Quit: karlosz_]
karlosz_ has joined #lisp
nanoz has quit [Ping timeout: 244 seconds]
_whitelogger has joined #lisp
mathrick has joined #lisp
slyrus__ has joined #lisp
slyrus_ has quit [Ping timeout: 246 seconds]
ltriant has quit [Ping timeout: 245 seconds]
Inline has quit [Quit: Leaving]
ltriant has joined #lisp
Necktwi has quit [Quit: leaving]
stacksmith has quit [Ping timeout: 252 seconds]
ltriant has quit [Ping timeout: 245 seconds]
frgo has joined #lisp
varjag has joined #lisp
ltriant has joined #lisp
asarch has joined #lisp
<asarch>
One stupid question: why SBCL and not GNU Common Lisp?
<asarch>
Is it because GCL is Lisp-1 and SBCL Lisp-2?
<no-defun-allowed>
GCL isn't a conforming Common Lisp implementation, and it doesn't have a native code compiler that makes JVM weenies fear for their lives[citation needed].
<asarch>
Oh :(
<jackdaniel>
GCL implements CLtL2 with effort to support ANSI CL (and it is Lisp-2)
<no-defun-allowed>
GCL, if it is supposed to be a Common Lisp implementation, has to be a Lisp-2. There should be zero difference in semantics when running portable CL programs on conforming implementations.
<dialectic>
Didn't GNU Common Lisp turn into Kyoto Common Lisp?
<dialectic>
Or do I have it backwards
<jackdaniel>
you have it backwards
<no-defun-allowed>
I think it was the other way around.
<jackdaniel>
kcl was ancestor of ibuki, delphi, akcl and ecolisp
<no-defun-allowed>
Kyoto implemented CLtL 1 (which is not ANSI CL), Austin-Kyoto was an improved fork, then GCL was derived from AK.
varjag has quit [Ping timeout: 268 seconds]
<jackdaniel>
gcl is descendant of akcl
<dialectic>
it's cool that CLASP is on there
<jackdaniel>
probably I should paint some green blocks yellow and vice versa after 3y, but nvm that
<jackdaniel>
there is also some inaccuracy in the obsolete section, I remember being called for making the link Lisp-to-C towards Star Sapphire
<jackdaniel>
s/a towards b/from a to b/
sauvin has joined #lisp
scymtym has quit [Ping timeout: 268 seconds]
crystalball has joined #lisp
rsawrecht has left #lisp ["Using Circe, the loveliest of all IRC clients"]
martylake has joined #lisp
sawrechtr has joined #lisp
dialectic has quit [Ping timeout: 248 seconds]
karlosz_ has quit [Quit: karlosz_]
ltriant has quit [Quit: leaving]
manualcrank has quit [Quit: WeeChat 1.9.1]
DGASAU has quit [Ping timeout: 248 seconds]
lonjil has quit [Ping timeout: 259 seconds]
schweers has joined #lisp
scymtym has joined #lisp
lonjil has joined #lisp
crystalball has quit []
nowhereman has quit [Ping timeout: 252 seconds]
ggole has joined #lisp
crystalball has joined #lisp
crystalball has quit [Remote host closed the connection]
crystalball has joined #lisp
crystalball has quit [Client Quit]
asarch has quit [Remote host closed the connection]
hhdave has joined #lisp
martylake has quit [Read error: Connection reset by peer]
cosimone has joined #lisp
martylake has joined #lisp
orivej has quit [Ping timeout: 246 seconds]
DGASAU has joined #lisp
sawrechtr has left #lisp ["Using Circe, the loveliest of all IRC clients"]
random-nick has joined #lisp
rsawrecht has joined #lisp
heisig has joined #lisp
andrei-n has joined #lisp
zotan has quit [Ping timeout: 244 seconds]
lnostdal has quit [Ping timeout: 258 seconds]
zotan has joined #lisp
martylake has quit [Read error: Connection reset by peer]
lnostdal has joined #lisp
keep_learning_M has quit [Quit: This computer has gone to sleep]
martylake has joined #lisp
lnostdal has quit [Ping timeout: 245 seconds]
cooro has joined #lisp
lnostdal has joined #lisp
cooro has quit [Quit: Vision[0.10.3]: i've been blurred!]
amerlyq has joined #lisp
rsawrecht has quit [Ping timeout: 248 seconds]
Ricchi has quit [Remote host closed the connection]
cosimone has quit [Quit: WeeChat 2.4]
dddddd has joined #lisp
heisig has quit [Remote host closed the connection]
m00natic has joined #lisp
dmiles has quit [Ping timeout: 248 seconds]
martylake_ has joined #lisp
martylake has quit [Ping timeout: 245 seconds]
dmiles has joined #lisp
frgo has quit [Remote host closed the connection]
pierpal has joined #lisp
pierpal has quit [Ping timeout: 246 seconds]
cpc26 has quit []
orivej has joined #lisp
Lycurgus has joined #lisp
ebrasca has joined #lisp
vaporatorius has joined #lisp
ebrasca has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
amerlyq has quit [Ping timeout: 245 seconds]
amerlyq has joined #lisp
fivo has joined #lisp
Bike has joined #lisp
Posterdati has quit [Ping timeout: 245 seconds]
t58 has joined #lisp
igemnace has quit [Quit: WeeChat 2.5]
cosimone has joined #lisp
Lycurgus has quit [Quit: Exeunt]
makomo has quit [Ping timeout: 246 seconds]
Posterdati has joined #lisp
frgo has joined #lisp
cosimone has quit [Ping timeout: 264 seconds]
igemnace has joined #lisp
Posterdati has quit [Ping timeout: 245 seconds]
Necktwi has joined #lisp
w37 has joined #lisp
v88m has quit [Read error: Connection reset by peer]
v88m has joined #lisp
Posterdati has joined #lisp
rozenglass has joined #lisp
zhlyg has joined #lisp
kuribas has joined #lisp
<kuribas>
what the equivalent of haskell take in lisp?
brett-soric has joined #lisp
<kuribas>
take 2 [1, 2, 3] => [1, 2]
<kuribas>
take 2 [1] => [1]
<Bike>
subseq, roughly, i guess?
<kuribas>
but (subseq '(1) 0 2) => error
<Bike>
roughly
<kuribas>
Bike: I'd like the exact behaviour
<Bike>
(defun take (n list) (subseq list 0 (min n (length list))))
stepnem has quit [Ping timeout: 258 seconds]
<kuribas>
Bike: yes, now that's O(n)
<kuribas>
over the length of the list
cosimone has joined #lisp
<Bike>
yeah?
<kuribas>
length is O(n)
<Bike>
i'm aware.
<Bike>
in a strict language i don't see how you could do this faster, really.
<kuribas>
erm (take 2 list-of-twenty-million-values) => should only look at two elements
<LdBeth>
Why list?
<kuribas>
not twenty million
<kuribas>
LdBeth: because I have a list as input?
<Bike>
okay. true. so you can write an iteration over list elements. do you want me to write it for you or are you capable.
<LdBeth>
You can create a grey stream
<kuribas>
Bike: I am capable thank you. Just wanted to know if lisp has something standard defined
<Bike>
no.
<LdBeth>
Which is strict language’s lazy list
<kuribas>
ok, thanks
kuribas has left #lisp ["ERC (IRC client for Emacs 25.3.2)"]
<LdBeth>
There’s one in CLtL2 Appendix
<LdBeth>
Though not merged into ANSI
<LdBeth>
And neither grey stream’s in standard
kuribas has joined #lisp
lucasb has joined #lisp
<LdBeth>
gg
<_death>
there are libraries, like clazy
oni-on-ion has quit [Remote host closed the connection]
<ggole>
(defun take (n list) (loop repeat n for elt in list collect elt))
oni-on-ion has joined #lisp
<zhlyg>
Grey or Gray?
<shka__>
zhlyg: Grey
<shka__>
family name
<_death>
Gray..
<shka__>
oh, sorry!
<shka__>
_death is right
Lord_of_Life_ has joined #lisp
manualcrank has joined #lisp
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
fivo has quit [Quit: WeeChat 1.9.1]
kushal has quit [Ping timeout: 260 seconds]
<pjb>
ggole: for terminates.
<pjb>
for in I mean.
kuribas has left #lisp ["ERC (IRC client for Emacs 25.3.2)"]
ebrasca has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
<ggole>
Isn't that the desired behaviour here?
<pjb>
which is what haskell takes does… Yes.
<pjb>
I was thinking about (defun take (n list) (loop repeat n for current := list :then (rest current) collect (first current))) but then (take 2 '(1)) #| --> (1 nil) |#
brett-soric has left #lisp [#lisp]
ebrasca has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
Necktwi has quit [Quit: leaving]
wxie has joined #lisp
vaporatorius has quit [Read error: Connection reset by peer]
Inline has joined #lisp
wxie has quit [Quit: wxie]
gareppa has joined #lisp
gareppa has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 245 seconds]
rippa has joined #lisp
Posterdati has quit [Ping timeout: 246 seconds]
pest-ctrl has joined #lisp
khisanth_ has quit [Ping timeout: 245 seconds]
rozenglass has quit [Remote host closed the connection]
svillemot has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
Posterdati has joined #lisp
oni-on-ion has quit [Remote host closed the connection]
Ricchi has joined #lisp
rumbler31 has quit [Remote host closed the connection]
vibs29 has joined #lisp
schweers has quit [Ping timeout: 252 seconds]
khisanth_ has joined #lisp
vibs29 has quit [Quit: bye]
cosimone has quit [Quit: WeeChat 2.4]
kushal has joined #lisp
kushal has quit [Read error: Connection reset by peer]
kushal has joined #lisp
kushal has quit [Client Quit]
gareppa has joined #lisp
gareppa has quit [Quit: Leaving]
kushal has joined #lisp
kushal has quit [Remote host closed the connection]
kushal has joined #lisp
vibs29 has joined #lisp
vaporatorius has joined #lisp
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #lisp
oni-on-ion has joined #lisp
whartung has quit [Read error: Connection reset by peer]
shka_ has joined #lisp
kajo has quit [Quit: From my rotting body, flowers shall grow and I am in them and that is eternity. -- E. M.]
hhdave has quit [Quit: hhdave]
<dim>
just noticed that the topic here says SBCL 1.4.16 is current, but I see _The most recent version is SBCL 1.5.4, released June 29, 2019_ over at sbcl.org... do we want to maintain the topic version numbers?
makomo has joined #lisp
<ck_>
I'd put the urls in the topic if they fit -- I'd be surprised if anybody depended on the topic of #lisp on freenode for their release updates
<ck_>
or maybe those are there in case of rhetorical emergencies. "What version do you run? I'm sorry. We only discuss sbcl 1.4.16 in here!"
<aeth>
I'm reading the backlog but I'm confused because the topic says 1.5.4
<aeth>
Maybe I should go back to reading in backwards order
lucasb has quit [Quit: Connection closed for inactivity]
orivej has joined #lisp
<aeth>
pjb: ggole has the correct answer. LOOP will terminate at the shorter iteration, so it will either repeat n times or for loop the length of the list, whichever ends first
<aeth>
sort of like how mapcar uses the shortest list
<aeth>
(values (take 2 '(1)) (take 2 '(1 2 3)))
cosimone has joined #lisp
devon has joined #lisp
Necktwi has joined #lisp
<aeth>
if you wanted to have a filler value you'd have to let the user specify a default because the user might have a list of NILs as the input!
devon has quit [Ping timeout: 245 seconds]
rumbler31 has joined #lisp
<aeth>
I think the best TAKE in CL style, though, would be sequence-generic and have an ETYPECASE with Bike's (subseq sequence 0 (min n (length sequence))) solution for non-list sequences (ideally vectors, but a user-extensible sequence might be used).
rumbler31 has quit [Ping timeout: 244 seconds]
<aeth>
(defun take (n sequence) (check-type n fixnum) (etypecase sequence (list (loop :repeat n :for item :in sequence :collect item)) (sequence (subseq sequence 0 (min n (length sequence))))))
<aeth>
You actually don't want to check for fixnum. A positive fixnum type will probably work, although technically there are some very large positive fixnums that will be invalid. Not really an issue since you'll run out of memory first. Either way, the check-type will actually wind up speeding things up for large enough n because it will remove the generic arithmetic.
<aeth>
And I guess if you're using check-type, then CTYPECASE fits better than ETYPECASE
lnostdal has quit [Remote host closed the connection]
Bike has quit [Quit: Lost terminal]
lnostdal has joined #lisp
martylake has joined #lisp
martylake_ has quit [Ping timeout: 246 seconds]
szmer has quit [Quit: WeeChat 2.4]
m00natic has quit [Remote host closed the connection]
dialectic has joined #lisp
karlosz_ has joined #lisp
<interruptinuse>
hey #lisp
<interruptinuse>
asdf manual "6.3.12 Feature dependencies" says :feature cannot be used to make the system depend on a specific impl feature
<interruptinuse>
does asdf provide anything for that?
<interruptinuse>
my current options are: (1) to :if-feature the package.lisp file, which is ugly, or (2) to detect the feature myself in package.lisp or something and fail at compile time
bexx has joined #lisp
<interruptinuse>
basically i'd lik to say, as declaratively as possible, "this .asd is for SBCL only"