<Bike>
aeth: and for the record, it's more or less impossible (in general, actually impossible, for computability reasons) for a compiler to determine that some function will never be called, in a world where any function could be redefined to do (eval (read))
<aeth>
Bike: you do something like what JITs do... you are prepared to deoptimize if necessary. Easier task than JITs because you'd only need to do it on the equivalent of C-c C-c or C-c C-k
s-liao has joined #commonlisp
<aeth>
Bike: but when something has EVAL obviously you don't even try
<aeth>
If it's unknown, it's treated as if it calls it
<Bike>
yeah great, so you can't optimize if an array is fed to any nonstandard function
taiju has joined #commonlisp
pve has quit [Quit: leaving]
tyson2 has quit [Remote host closed the connection]
<_death>
maybe instead of backpointers some signature can be kept?
<_death>
I suppose the backpointers approach would be overall better, speedwise
ryanbw1 is now known as ryanbw
gaqwas has quit [Ping timeout: 250 seconds]
tanners has quit [Ping timeout: 240 seconds]
selwyn has quit [Quit: WeeChat 3.3]
selwyn has joined #commonlisp
jstoddard has quit [Quit: ERC (IRC client for Emacs 27.2)]
tanners has joined #commonlisp
taiju has quit [Remote host closed the connection]
taiju has joined #commonlisp
kevingal has quit [Remote host closed the connection]
nij- has joined #commonlisp
tyson2 has joined #commonlisp
<nij->
Hello! Is it possible to define setf-expander that does file reading and writing on the file?: https://bpa.st/LMUA
<nij->
Hmm what I typed cannot be possible. But this could:
morganw has quit [Remote host closed the connection]
<nij->
Amazing. Thanks! I was trying (defun (setf ..)).
<_death>
that could also work
splatt990 has joined #commonlisp
s-liao87 has joined #commonlisp
jpl01 has quit [Remote host closed the connection]
s-liao has quit [Ping timeout: 256 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
akoana has joined #commonlisp
Bike has quit [Quit: back later maybe]
<nij->
While it works, it's kinda leaky.. especially used with access:accesses.
<nij->
I might try another way. Instead of defsetf, is there a way to monitor the value cell of a symbol, so that whenever the value cell is changed, we invoke a certain function?
perrierjouet has joined #commonlisp
<_death>
define-symbol-macro?
<nij->
Does that help add a hook to the value cell watcher?
<_death>
no.. there's no standard hook for that
<Catie>
You could define a :before method on the (setf ...) function, but that only handles the case where it's mutated via setf
Lord_Nightmare has quit [Read error: Connection reset by peer]
notzmv has joined #commonlisp
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
Lord_Nightmare has joined #commonlisp
Jing has joined #commonlisp
thomaslewis has joined #commonlisp
semz_ is now known as semz
Lord_Nightmare has quit [Read error: Connection reset by peer]
Lord_Nightmare has joined #commonlisp
asarch has quit [Quit: leaving]
Lord_Nightmare has quit [Read error: Connection reset by peer]
Lord_Nightmare has joined #commonlisp
monaaraj has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
thomaslewis has left #commonlisp [#commonlisp]
monaaraj has joined #commonlisp
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
rgherdt has joined #commonlisp
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
foxfromabyss has joined #commonlisp
Cymew has joined #commonlisp
karlosz has joined #commonlisp
mgl has joined #commonlisp
qhong has joined #commonlisp
ahammer has joined #commonlisp
azimut_ has joined #commonlisp
qhong_ has quit [Ping timeout: 256 seconds]
azimut has quit [Ping timeout: 276 seconds]
unyu has quit [Quit: brb]
anticomputer_ has joined #commonlisp
occ has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
jdz_ is now known as jdz
foxfromabyss has quit [Ping timeout: 256 seconds]
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
ahammer has quit [Quit: Leaving]
Algernon69 has quit [Ping timeout: 268 seconds]
MajorBiscuit has joined #commonlisp
pve has joined #commonlisp
Major_Biscuit has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MajorBiscuit has quit [Ping timeout: 250 seconds]
random-nick has joined #commonlisp
nij- has joined #commonlisp
varjag has quit [Ping timeout: 240 seconds]
Jing has joined #commonlisp
scymtym has quit [Ping timeout: 256 seconds]
Jing_ has joined #commonlisp
Jing has quit [Ping timeout: 240 seconds]
Major_Biscuit has quit [Ping timeout: 250 seconds]
MajorBiscuit has joined #commonlisp
gaqwas has joined #commonlisp
attila_lendvai has joined #commonlisp
qeqeqw has joined #commonlisp
gaqwas has quit [Remote host closed the connection]
scymtym has joined #commonlisp
unyu has joined #commonlisp
occ has quit [Ping timeout: 250 seconds]
_ante_ has joined #commonlisp
karlosz has quit [Quit: karlosz]
kevingal has joined #commonlisp
<nij->
Those who have used accesses - while it is great to access a place given by a variable, it doesn't seem to be working for a general place form like this
<VincentVega>
How does SBCL decide when to call a compiler macro? I am trying some examples from CLHS define-compiler-macro and the original function is called.
<phoe>
VincentVega: which example?
<VincentVega>
the square one
<phoe>
all examples up to (funcall (compiler-macro-function 'square) '(funcall #'square x) nil) work as expected
<VincentVega>
yeah, but (square 3) keeps calling the original function definition
<beach>
VincentVega: As I recall, the OPTIMIZE values may determine whether the compiler macro is called.
<VincentVega>
beach: thanks, I'll try that
<phoe>
yes - (sb-ext:restrict-compiler-policy)
<phoe>
uh sorry
<phoe>
(sb-ext:describe-compiler-policy)
<VincentVega>
phoe: interesting summary, thanks
<phoe>
VincentVega: and check the SBCL manual for optimization qualities, maybe some high DEBUG or something can cause SBCL to not use compiler macros
<phoe>
...welp, the manual does not seem to mention that!
<phoe>
#sbcl might provide more information, or the devs could write something in the manual about how CMs are treated
<VincentVega>
phoe: thanks! I will probably ask there. http://ix.io/3M4h optimization options didn't turn out to have an effect.
<VincentVega>
oh, nevermind, top-level compiling it was the reason. Putting it in a function definition works out just fine.
crunchdef has quit [Ping timeout: 256 seconds]
kingofcsu has joined #commonlisp
attila_lendvai has quit [Remote host closed the connection]
attila_lendvai has joined #commonlisp
nij- has left #commonlisp [#commonlisp]
Bike has joined #commonlisp
_ante_ has joined #commonlisp
mcoll- has quit [Ping timeout: 240 seconds]
pranavats has left #commonlisp [Error from remote client]
crunchdef has joined #commonlisp
kevingal has joined #commonlisp
pranavats has joined #commonlisp
miique has joined #commonlisp
waleee has joined #commonlisp
luna-is-here has quit [Ping timeout: 240 seconds]
thomp has joined #commonlisp
kingofcsu has quit [Quit: kingofcsu]
occ has joined #commonlisp
thomp has quit [Ping timeout: 240 seconds]
tyson2 has quit [Remote host closed the connection]
cage has joined #commonlisp
thomp has joined #commonlisp
thomp has quit [Ping timeout: 240 seconds]
parjanya has quit [Ping timeout: 245 seconds]
kevingal has quit [Ping timeout: 240 seconds]
waleee has quit [Ping timeout: 240 seconds]
sloanr has joined #commonlisp
waleee has joined #commonlisp
semz has quit [Quit: Leaving]
kevingal has joined #commonlisp
mcoll- has joined #commonlisp
mcoll- has quit [Read error: Connection reset by peer]
mcoll- has joined #commonlisp
kevingal has quit [Ping timeout: 256 seconds]
kevingal has joined #commonlisp
nature has joined #commonlisp
jealousmonk has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
monaaraj has joined #commonlisp
taiju has quit [Remote host closed the connection]
rotateq has joined #commonlisp
Major_Biscuit has quit [Ping timeout: 250 seconds]
thomaslewis has joined #commonlisp
tyson2 has joined #commonlisp
attila_lendvai has quit [Ping timeout: 252 seconds]
Kyuvi has joined #commonlisp
<rotateq>
Okay definitely one of the most funny lines I read in the last days. :) "Sometimes, when the full moon rises and foolish programmers declare (optimize (safety 0)), you can hear the howl of the Loopus, and screams of source code that is ripped to shreds."
NotThatRPG has quit [Read error: Connection reset by peer]
mgl has quit [Ping timeout: 256 seconds]
ec has joined #commonlisp
attila_lendvai has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
monaaraj has joined #commonlisp
ec has quit [Client Quit]
sloanr has quit [Remote host closed the connection]
NotThatRPG has joined #commonlisp
sloanr has joined #commonlisp
ec has joined #commonlisp
notzmv has quit [Ping timeout: 250 seconds]
MajorBiscuit has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
monaaraj has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
Algernon91 has joined #commonlisp
monaaraj has joined #commonlisp
Algernon69 has quit [Ping timeout: 245 seconds]
kevingal has quit [Ping timeout: 250 seconds]
lisp123 has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
ksp has joined #commonlisp
<ksp>
Hello, does anyone know how to split a string by a specific character? I want each line of my data to be a seperate string
<jackdaniel>
there is a library called split-sequence, you may use that
<jackdaniel>
(or write your own funciton)
monaaraj has joined #commonlisp
_ante_ has joined #commonlisp
<ksp>
I'm rather new to lisp
tanners has quit [Ping timeout: 256 seconds]
<jackdaniel>
you may find a manager to easily download libraries and quicklisp.org ; as for introduction
<jackdaniel>
minion: tell ksp about pcl
<minion>
ksp: please see pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<jackdaniel>
s/libraries and/libraries at/
tanners has joined #commonlisp
thomaslewis has joined #commonlisp
_ante_ has quit [Ping timeout: 240 seconds]
thomaslewis has left #commonlisp [#commonlisp]
cosimone has joined #commonlisp
<White_Flame>
ksp: the READ-LINE function does that from a stream.
<rotateq>
hi ksp, good to have you on board
mgl has joined #commonlisp
<White_Flame>
and WITH-INPUT-FROM-STRING can stream from a string
<rotateq>
White_Flame: i was about putting exactly that to your first sentence :)
<rotateq>
jackdaniel: and I no more confuse the other PCL abbreviation (Potable Common Loops)
<jackdaniel>
congratulations ,)
<jackdaniel>
on the other hand, having your pot full makes a dinner
<jackdaniel>
so I'm not sure whether it is /that/ good
<rotateq>
since some longer time now ^^ first I thought "hmm, what shall this sb-pcl module name stand for?"
lisp123 has quit [Remote host closed the connection]
Jing_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mcoll- has quit [Remote host closed the connection]
<rotateq>
jackdaniel: or when hearing "Flavors" not to only think of the quantum number :)
<jackdaniel>
both Pot(able) and Flavors comes up to me as food
jstoddard has joined #commonlisp
<rotateq>
yummy
<jackdaniel>
btw there is an interesting history behind "mixins" and "flavors" (so I've read somewhere) - there was an icecream shop on the campus where they were invented
<jackdaniel>
and they had this service, that they had a basic flavor and allowed to have a mixin - so you had a "vanilla" icecream with a "strawberry" mixin
<rotateq>
yes two physicists got the idea for naming it that way at that ^^
<rotateq>
but okay, also with mixins, funny :)
Catie has joined #commonlisp
lisp123 has joined #commonlisp
ns12 has quit [Quit: bye]
ns12 has joined #commonlisp
<lisp123>
Is there anything Sly is bad at? I'm about to make the jump..
<rotateq>
we had the topic of debugging some days ago
<rotateq>
but for in general
sloanr has quit [Remote host closed the connection]
sloanr has joined #commonlisp
<lisp123>
rotateq: thanks, i'll have a read
<rotateq>
it was said a good debugger is another thing needed in the future
<lisp123>
i see
<etimmons>
I recently discovered Sly stripped out Slime's integration with sb-sprof
<etimmons>
Only thing I've missed so far
<rotateq>
hmm
thomp has quit [Ping timeout: 256 seconds]
jeosol has joined #commonlisp
<rotateq>
today I build a game made with CL and SDL here, i saw it some times on youtube
<rotateq>
but maybe first i finish my baba is you or human resource machine clones
<rotateq>
hihi he has the game-loop function and first thing is a full garbage collect ^^
<phoe>
or in cl, (assert (eq *you* :baba))
<rotateq>
i still try doing some thought work on it
<lisp123>
rotateq: nice
<rotateq>
like how doing it "cleverly" when it gets "wall is you" and you become multiple objects at once
<rotateq>
and it gets me to think more and more, without CLOS capabilities, how do they even do it in Lua without it becoming too messy? ^^ not to talk about more complex games
<rotateq>
and doing some simple sentence analysis
<rotateq>
or not calling it "simple", would be too naive, it's hard
<rotateq>
phoe: in beginning of 2020 i stumbled upon this sucle engine minecraft clone
<lagash>
rotateq: I saw sucle, haven't messed with it yet, is it any good?
<jackdaniel>
it sucls
<rotateq>
lagash: more "just" an engine which needs more love
<rotateq>
jackdaniel: :D
thomp has joined #commonlisp
tanners has quit [Ping timeout: 240 seconds]
tanners has joined #commonlisp
tanners has quit [Client Quit]
Algernon91 has quit [Read error: Network is unreachable]
VincentVega has quit [Remote host closed the connection]
Algernon91 has joined #commonlisp
<rotateq>
but maybe minecraft players would get afraid when it becomes fasta
notzmv has joined #commonlisp
<rotateq>
like when a popular python tool is replaced but the API and superficial look leaves to be the same :)
azimut_ has quit [Ping timeout: 276 seconds]
Algernon91 has quit [Ping timeout: 250 seconds]
VincentVega has joined #commonlisp
cosimone has quit [Remote host closed the connection]
marcoxa has joined #commonlisp
cosimone has joined #commonlisp
<lisp123>
With sly, everytime I exit sly-db, it asks me whether I want to throw to the toplevel (y / n), is there a way to set this to y always?
<phoe>
how do you quit it?
<lisp123>
i press Q
<lisp123>
so I have to do Q y, which is 2x longer :(
<phoe>
I see - on Slime it simply invokes an ABORT restart
<phoe>
and that performs all the non-local exit stuff that is necessary
<lisp123>
Yeah Slime works well, this is just for Sly
<lisp123>
"a" seems to work well, ignore me :)
<phoe>
:O
<phoe>
TIL, thanks
<lisp123>
there's a clash between EVIL mode & Sly, so will need to fix that, but otherwise all good
jdz has quit [Ping timeout: 256 seconds]
flip214 has quit [Ping timeout: 256 seconds]
jdz has joined #commonlisp
flip214 has joined #commonlisp
wyrd has quit [Ping timeout: 276 seconds]
miique has quit [Read error: Connection reset by peer]
wyrd has joined #commonlisp
sloanr has quit [Remote host closed the connection]
sloanr has joined #commonlisp
miique has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
<Bike>
say we had the code (let ((a (foo))) (map nil #'print a) (aref a 0)), and at some particular time FOO returned a list rather than a vector. how would people feel about an implementation that signaled a type error as soon as the list was returned, i.e. before doing the map?
lisp123 has quit [Ping timeout: 256 seconds]
Volt has joined #commonlisp
<edgar-rft>
I would expect AREF to signal an error (after the MAP), not at the time of the the LET binding
miique has quit [Quit: Leaving]
flip214 has quit [Ping timeout: 256 seconds]
jdz has quit [Ping timeout: 256 seconds]
<Bike>
that's how it usually works now. i'm asking how people would feel if it worked as in the hypothetical.
jdz has joined #commonlisp
flip214 has joined #commonlisp
sloanr has quit [Remote host closed the connection]
sloanr has joined #commonlisp
morganw has joined #commonlisp
<White_Flame>
Bike: would that be because the type inference from aref hoisted up for the whole body?
<White_Flame>
eg a declaration on A
<White_Flame>
I think that would be the actual consequence of what "type inference" means. It's about A itself
<White_Flame>
hmm, but those usually aren't errors, are they?
<Bike>
it would be inferring backwards from the fact that (aref a 0) is undefined unless a is a vector, yes
<Bike>
as far as i'm aware, no actual implementation does what i'm describing. they might issue a type warning at compile time if foo is declared to never return a vector, and probably signal an error from aref if it receives a non vector
<White_Flame>
with high safety and debug, are there runtime warnings when type declared bodies are entered with the wrong value type?
thomaslewis has joined #commonlisp
waleee has quit [Ping timeout: 250 seconds]
thomaslewis has left #commonlisp [#commonlisp]
<Bike>
sbcl will signal an error if there's an explicit type declaration, but not for my example
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
<jeosol>
Good morning guys!
<jeosol>
When writing a paper about CL, what is the canonical reference for CLOS in terms of reference citation
<NotThatRPG>
jeosol: I imagine the specification?
sloanr has quit [Remote host closed the connection]
sloanr has joined #commonlisp
<NotThatRPG>
White_Flame: That would be up to the individual implementation
thomaslewis has joined #commonlisp
<jeosol>
NotThatRPG: Thanks, I think you are right. I remembered I have a copy of "OOP: The CLOS Perspective" and that is what they cited too for CLOS
thomaslewis has left #commonlisp [#commonlisp]
<NotThatRPG>
jeosol: I think it depends on whether you want to give credit to the people who developed CLOS, or just point someone at an explanation of what CLOS Is.
<jeosol>
good point. But it's more as a reference too for people to understand what I am refering too. Lispers probably does but it's making adding reference appropriately
Kyuvi has quit [Ping timeout: 256 seconds]
<jeosol>
I use SBCL primarily, so not sure if there is doc for SBCL CLOS(?) but I imagine since implementations are mostly compliant, I don't have to cite any specific to SBCL just that higher-level should cover everything
<NotThatRPG>
So if your readers are not familiar with CLOS the Keene book might be a better citation (or compromise and give both)
Oladon has quit [Quit: Leaving.]
<jeosol>
Yeah, that's true. I was thinking of that too, hmm, good point.
<jeosol>
Keene's book was what I read front to back to understand CLOS so it is definitely useful, guess for non CL folks
<jeosol>
Thanks
<rotateq>
jeosol: okay much to work through for me in this book too, not to mention AMOP
thomaslewis has joined #commonlisp
johnjaye has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
attila_lendvai has quit [Quit: Leaving]
attila_lendvai has joined #commonlisp
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
aartaka has quit [Ping timeout: 256 seconds]
thomaslewis has joined #commonlisp
thomp has quit [Ping timeout: 240 seconds]
marcoxa has quit [Quit: Time for bed...]
Oladon has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
Odin-FOO is now known as Odin-
<mfiano>
Does a SIMPLE-VECTOR require a fixed size?
<mfiano>
How would I specify the most specific type specifier for a vector of non-zero size?
<mfiano>
arbitrary element types
<White_Flame>
simple-vectoris always of type T
<White_Flame>
and no it doesn't require a fixed size
<mfiano>
RIght and that's what I want
<mfiano>
I want to specify a simple-vector of at least 1 in length
<mfiano>
as a type specifier
<Bike>
"at least 1 in length" is not something the type system can do (short of SATISFIES)
<mfiano>
I see, ok
<White_Flame>
yeah, you can declare a specific size or "any size" in the type
<mfiano>
So just 'simple-vector and a runtime check is fine then
<Bike>
if you want arbitrary element type, you'll have to use (simple-array * (*)) rather than simple-vector (which is (simple-array t (*)))
<mfiano>
What is the difference here?
<phoe>
specialization
<White_Flame>
T is already the arbitrary element type?
<mfiano>
Isn't T the top type?
<phoe>
it is
<phoe>
btu T and * are distinct in case of array types
<Bike>
(simple-array bit) is not a (simple-array t).
<phoe>
SIMPLE-ARRAY T means that it is specialized to hold any element
<phoe>
SIMPLE-ARRAY (UNSIGNED-BYTE 8) means that it's specialized to hold ub8s
<phoe>
these two types are distinct
<White_Flame>
hmm, true
<phoe>
check it yourself with your favorite implementation of SUBTYPEP!
<mfiano>
and SIMPLE-ARRAY *
<phoe>
then compare it with SIMPLE-ARRAY *
<phoe>
which is *any* SIMPLE-ARRAY, no matter the specialization
<pjb>
Bike: obviously, the bug is in aref: (let ((a (foo))) (map nil #'print a) (elt a 0)) will work for any sequence returned by FOO.
<mfiano>
In this case I'm storing pointers
<phoe>
pointers, hmmm
<phoe>
in case of SBCL they are boxed objects, right?
<mfiano>
struct types. These aren't immediates so I can't really store any simple-array that is not of type T. SBCL says it is a simple-vector
<phoe>
I assume you could store ub64s and convert from/to pointers for storage
<phoe>
but that's a hack of sorts
<mfiano>
By pointers I mean Common Lisp references
<mfiano>
I am storing struct instances
<phoe>
oooooh
<phoe>
then use a SIMPLE-ARRAY T all right
<mfiano>
TYPE-OF said simple-vector, so i was using that, but fair enough
<Bike>
you can also specify (simple-array your-struct-type).
<phoe>
that'll decay to T though, won't it?
<Bike>
probably
<mfiano>
Yes it will
<mfiano>
Any non-immediates will
<Bike>
but if it's full of structs, you may as well say that
<phoe>
Bike: yes
<mfiano>
I don'[t have a common ancestor type :)
<mfiano>
I could say struct-object, but...
<phoe>
;; you do, it's called T
* phoe
ducks
<Bike>
no, arrays with non-immediates can exist. unboxed doubles for one.
<mfiano>
Ah true. I guess anything non-numbers/characters, on SBCL at least.
<phoe>
but arrays of structs can't because of identity issues - I remember discussing that problem some time ago
<Bike>
it is unlikely that anything but numbers or characters will have specializations, due to how eq is defined. yes.
<mfiano>
fixnums at that.
<mfiano>
for the integral subset
<Bike>
i think sbcl has a specialization for (unsigned-byte 64).
<mfiano>
oh hmm. ui guess SBCL can handle ub64's
<mfiano>
i*
miique has joined #commonlisp
<Bike>
kind of the point of specialization is that tags aren't necessary.
<mfiano>
Yes I have cheated and boxed a ub64 return value inside a 0-d array when the caller couldn't inline the function...
<mfiano>
So how do the type specifiers SIMPLE-VECTOR and (SIMPLE-ARRAY T (*)) differ exactly?
<Bike>
they don't.
<mfiano>
Ok, as I expected. Thanks.
karlosz has joined #commonlisp
<rotateq>
i thought simple-vectors mustn't have fill-pointer and can't be adjustable
<mfiano>
Simple arrays must not either
<rotateq>
okay thanks, i'll fresh up :)
<mfiano>
Either feature automatically devolves to a VECTOR
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #commonlisp
<Bike>
it's a little bit more complicated. the standard says that a non-adjustable non-displaced array with no fill pointer is a simple array, but it doesn't say that a displaced array or etc is _not_ a simple array. so like, an implementation could say all arrays are simple.
<Bike>
i don't think any do, although sicl is planned to.
myrrh has joined #commonlisp
thomp has joined #commonlisp
attila_lendvai has quit [Ping timeout: 268 seconds]
rgherdt has quit [Ping timeout: 250 seconds]
<mfiano>
I suppose that's true.
sloanr has quit [Remote host closed the connection]
sloanr has joined #commonlisp
<mfiano>
Admittedly I am too used to static analysis of SBCL with regard to arrays of varying types, and it maps very well to my mind with what the machine code will look like.
waleee has joined #commonlisp
<mfiano>
Without satisfies couldn't I use (and simple-vector (not (simple-vector 0))) ?
<Bike>
hmm. i think you're right.
sloanr has quit [Remote host closed the connection]
sloanr has joined #commonlisp
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
<mfiano>
I'll probably stick with the runtime check though. I would have to greatly change the load order of my code, as this is for a struct definition that needs to be loaded earlier than the structure-objects the elements of this slot will contain
raeda_ has quit [Quit: Leaving]
<mfiano>
Normally I would use standard-objects, but this is very low-level code that I am doing the early 75% optimization that doesn't take too much time and will more than pay for itself. It's the other 25% that is not going to happen.
<mfiano>
That or I could have some sentinel initial value like #(nil)
<mfiano>
Which would still be a runtime check. I am getting into a hole I don't want to be in, so simple wins the race.
ksp has quit [Quit: WeeChat 3.4]
scymtym has quit [Ping timeout: 250 seconds]
<rotateq>
(make-array 0 :element-type 'nil)
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 256 seconds]
varjag has joined #commonlisp
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
nature has quit [Ping timeout: 250 seconds]
Oladon has quit [Quit: Leaving.]
Algernon69 has quit [Ping timeout: 252 seconds]
kevingal has joined #commonlisp
gaqwas has quit [Remote host closed the connection]
ec has quit [Ping timeout: 276 seconds]
scymtym has joined #commonlisp
form_fee- is now known as form_feed
pillton has joined #commonlisp
<morganw>
Hopefully this is not too much of an annoying beginner question, but I'm following exercises in a book and accidentally made a function which remembers its previous let binding values. Could anyone point me at the mistake? https://pastebin.com/R5x5DBtN
ec has joined #commonlisp
<theothornhill>
morganw: what does the input look like?
<morganw>
(count-bases '(a g t a c t c t)) or (count-bases '((g c) (a t) (t a) (t a) (c g))) are the given examples to work with.
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<morganw>
Basically, just count the symbols in either case and return the counts. I thought I was being smart and efficient by modifying the return list in-place, but apparently I'm not that smart... It does work on the first run but somehow the ret list is preserved for the next run.
<rotateq>
morganw: there's also #clschool :)
pve has quit [Quit: leaving]
<rotateq>
ahhh i did similar stuff as well some time ago playwise ^^
<rotateq>
is this from rosalind?
<morganw>
It is from "A Gentle Introduction to Symbolic Computing"
<rotateq>
just use (loop for symbol in list ...)
<rotateq>
ohh nice intro book
<morganw>
(in the chapter about iteration, so the function is meant to be iterative in how it works even when the problem doesn't naturally fit)
shka has quit [Ping timeout: 256 seconds]
<rotateq>
(loop named count-loop with as = 0 with cs = 0 with gs = 0 with ts = 0 for symbol in list when (eq symbol 'a) do (incf as) when (eq symbol 'c) do (incf cs) when (eq symbol 'g) do (incf gs) when (eq symbol 't) do (incf ts) finally (return-from count-loop (values as cs gs ts)))
<rotateq>
but watch out, the T will really be seen as the top-value too, but okayish in this case
<rotateq>
but don't try something like (let ((t ...)) ...)
<rotateq>
okay, value 'true' but highest system-class top or better ⊤, the T is just by accident similar taken as 'true
<rotateq>
'true' just in quotes i mean
<morganw>
Just to double-check, if you run my function does it also remember the previous runs? (just to check I haven't somehow broken the whole environment)
<rotateq>
ehm ..
<rotateq>
ah okay, it goes recursively as long as there is no cons anymore
<rotateq>
sorry just saw the link of yours now, let me see ...
<_death>
morganw: you shouldn't modify literals.. the result of '(a g t ...) is a literal. instead, you can use (list 'a 'g ...) or copy the list to create a fresh one, (copy-list '(a g t ...)) .. you can also use copy-tree to copy the sublists in the second one
<pillton>
morganw: You are using '((a 0) (t 0) (g 0) (c 0)) which is a literal.
<rotateq>
looks good :)
<morganw>
So the literal can persist as optimisation?
<pillton>
morganw: "The consequences are undefined if literal objects (including quoted objects) are destructively modified." from the CLHS entry for QUOTE.
<_death>
oh, I didn't look at the paste.. the literal you modify is '((a 0) ...) so you can use copy-tree, or simply variables and construct a list when returning
<morganw>
Ah right, thank you everyone for the help.
<rotateq>
i would have said, that better do it with (let ((%a 0) (%c 0) (%g 0) (%t 0)) ...) and you won't get a headache for your SETF forms
<rotateq>
then you can return with VALUES or LIST
<rotateq>
:)
<rotateq>
hmm, as a symbol i should use '|:)| ^^
VincentVega has quit [Ping timeout: 250 seconds]
VincentV` has joined #commonlisp
karlosz has quit [Quit: karlosz]
Catie has quit [Quit: Going home]
Algernon91 has quit [Ping timeout: 268 seconds]
occ has quit [Ping timeout: 250 seconds]
kevingal has quit [Ping timeout: 240 seconds]
<rotateq>
today i had a thought to something of mine "so this is the prototype for the prototype" :D
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
<NotThatRPG>
rotateq: Is that Touretzky's book?
<NotThatRPG>
If so, not sure I would recommend it.
cosimone has quit [Ping timeout: 250 seconds]
sloanr has quit [Remote host closed the connection]
<morganw>
It is that book. But it seems that part of the learning process is being restricted to certain methods in each chapter.
sloanr has joined #commonlisp
<rotateq>
NotThatRPG: the "gentle intro"?
<NotThatRPG>
Yes.
<NotThatRPG>
Who wrote it?
<rotateq>
yes morganw, maybe as in SICP, just in lecture 5 they start with assignment
<rotateq>
ehm don't know from memory now ^^
<rotateq>
but they provide a CAR and CDR spelling advise :)
<morganw>
Order of chapters is first learn about applicative methods, then recursion, then iteration.
<rotateq>
:)
<rotateq>
and what conses are, with picturing!
<morganw>
I imagine after this chapter I'd actually be free to pick the most appropriate way to suit the problem. No mention of loop yet though.
<rotateq>
there's a small nice package by bagger "draw-cons-tree"
<rotateq>
morganw: yes take your time, LOOP is a complex beast like FORMAT
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 256 seconds]
<NotThatRPG>
TBQH I prefer to use the ITERATE macro over LOOP because it's not a separate language like LOOP (also LOOP has some specific defects in terms of conditionals and handling multiple values)
NotThatRPG is now known as NotThatRPG_away
<rotateq>
i don't really have experience with iterate (yet)
<rotateq>
maybe then use the SICL LOOP module :)
karlosz has joined #commonlisp
mgl has quit [Ping timeout: 256 seconds]
VincentV` has left #commonlisp [ERC (IRC client for Emacs 27.2)]