<phoe>
(defun xor (&rest booleans) (let ((result nil)) (dolist (x booleans result) (when x (setf result (not result))))))
<phoe>
that's what I came up with at 1:30 AM
<phoe>
I should rather go to sleep though
* phoe
does so
<jcowan>
Yes, I may have to fall back on that. BTW, that is variadic recursion and you don't want to do that, because even though CLHS doesn't require "booleans" to be copied, most implementations do.
fortitude has quit [Ping timeout: 240 seconds]
baby_yo12 has quit [Quit: -a- Connection Timed Out]
baby_yoda_squadr has joined #lisp
<LdBeth>
jcowan: what if you “coerce” the bool list?
<jcowan>
Works for me, but to what?
<LdBeth>
Symbol?
* jcowan
is confused
<jcowan>
What's the benefit of that, then?
<LdBeth>
You said “booleans” could be copied as a implementation defined behavior
fortitude has joined #lisp
brettgilio has quit [Ping timeout: 268 seconds]
haziz has quit [Ping timeout: 240 seconds]
parjanya has joined #lisp
fortitude has quit [Ping timeout: 258 seconds]
varjag has quit [Ping timeout: 265 seconds]
oni-on-ion has quit [Ping timeout: 260 seconds]
fortitude has joined #lisp
oni-on-ion has joined #lisp
ebrasca has quit [Read error: No route to host]
doublex_ has quit [Read error: Connection reset by peer]
<jcowan>
I was figuring that out from the WP article. But what's the extension to eqv? Dyadic eqv is the complement of xor, but I don't think that's true of polyadic eqv.
ebrasca has quit [Read error: Connection reset by peer]
milanj has quit [Quit: Leaving]
ebrasca has joined #lisp
<edgar-rft>
jcowan: I have no idea what dyadic or polyadic means.
<jcowan>
sorry: with {two, many} arguments.
<edgar-rft>
jcowan: you're talking about Scheme's eqv? (what is in principle CL's EQL but can also compare strings in some Scheme implemntations).
<jcowan>
no, I mean eqv as in logeqv or boole-eqv; the equivalence operator
<pjb>
jcowan: for bits, there's already bit-and etc.
haziz has joined #lisp
<jcowan>
Indeed. Alas, they accept only two arguments.
<pjb>
edgar-rft: (evenp 0) #| --> t |#
<pjb>
edgar-rft: (defun boolean-xor (&rest args) (reduce (function xor) args :initial-value t)) (list (boolean-xor) '/ (boolean-xor nil) (boolean-xor t) '/ (boolean-xor nil nil) (boolean-xor nil t) (boolean-xor t nil) (boolean-xor t t) '/ (boolean-xor nil nil nil) (boolean-xor nil nil t) (boolean-xor nil t nil) (boolean-xor nil t t) (boolean-xor t nil nil) (boolean-xor t nil t) (boolean-xor t t nil) (boolean-xor t t t)) #| --> (t / t
<pjb>
t nil nil t / t nil nil t nil t t nil) |#
<pjb>
oh, right, xor is com.informatimago.common-lisp.cesarum.utility:xor …
<pjb>
how often do you need an xor with less or more than 2 arguments?
<edgar-rft>
pjb: we're talking about (boolean-xor T NIL NIL T NIL) where I have to admit that BOOLAN-XOR as a function name was a bad choice here
<pjb>
For example, there's the case of mutually exclusive parameters. Then you don't want this oddp definition of xor, but exactly 1.
<pjb>
In graphics, there's a definition for self crossing paths, that directly involves the oddness of crossings…
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
baby_yoda_squadr has joined #lisp
haziz has quit [Ping timeout: 258 seconds]
brettgilio has joined #lisp
<jcowan>
That *is* useful, but it isn't the associative generalization of xor.
bitmapper has quit [Ping timeout: 240 seconds]
<edgar-rft>
Is there any valid generalisation of XOR at all? I mean outside of logic and integer numbers.
toorevitimirp has joined #lisp
<jcowan>
So xor is true iff an odd number of the arguments are true, as we see above.
<jcowan>
And eqv is true/false if an odd number of the arguments are true and the number of arguments is odd/even.
<edgar-rft>
what I meant was what is the result of (XOR <toothbrush> <catpoop>)?
<jcowan>
I don't think you can do that, unless your universe of discourse contains only a toothbrush and cat poop.
<edgar-rft>
It does :-)
<jcowan>
In which case it is true if you have both toothbrush and cat poop, or neither.
<jcowan>
But I'll settle for generalizing to any number of arguments.
<jcowan>
This definition also assigns a meaning to xor with 0 or 1 arguments.
ebrasca has quit [Ping timeout: 265 seconds]
<jcowan>
so (xor) => nil, (xor t) => t, (xor nil) => t
ebrasca has joined #lisp
<jcowan>
and (eqv) => nil, (eqv t) => nil, (eqv nil) => t
<edgar-rft>
My concern is that EQV contains some meaning of equality. Does that mean that all "true" or "false" arguments must be EQ, EQL, EQUAL, or EQUALP?
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
hsaziz has quit [Ping timeout: 265 seconds]
baby_yoda_squadr has joined #lisp
Frobozz has joined #lisp
Frobozz has quit [Client Quit]
hsaziz has joined #lisp
pjb has quit [Ping timeout: 246 seconds]
toorevitimirp has quit [Ping timeout: 248 seconds]
Lord_of_Life_ has joined #lisp
pjb has joined #lisp
Lord_of_Life has quit [Ping timeout: 260 seconds]
Lord_of_Life_ is now known as Lord_of_Life
akoana has left #lisp ["Leaving"]
Josh_2 has quit [Ping timeout: 240 seconds]
ealfonso7 has joined #lisp
ealfonso has quit [Ping timeout: 240 seconds]
pjb has quit [Remote host closed the connection]
abhixec has quit [Ping timeout: 240 seconds]
pjb has joined #lisp
abhixec has joined #lisp
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
atgreen has joined #lisp
baby_yoda_squadr has joined #lisp
ealfonso6 has joined #lisp
ealfonso7 has quit [Ping timeout: 258 seconds]
<beach>
Good morning everyone!
clothespin__ has quit [Read error: Connection reset by peer]
vms14 has joined #lisp
<vms14>
guys
<vms14>
(overhead-p CLOS)
<beach>
vms14: CLOS is everywhere. Every Common Lisp object is an instance of a class.
<phadthai>
depends on implementation and what you do with it (and there may be greater overhead in dynamic things like adding methods if the implementation performs a lot of optimizations for faster general calls after)
<beach>
Some implementations have slow implementations of generic dispatch, but it would be sad to avoid an excellent software-engineering tools such as generic functions because of that, especially now that we are developing techniques for improving dispatch.
<vms14>
then there is no really "overhead", but more the fact it's dynamic?
<vms14>
well, being dynamic implies overhead
<beach>
vms14: If all you are interested in is overhead, and not developer time/convenience, then you should use C or assembler instead.
<phadthai>
there will be some overhead over structs and functions, but is it acceptable for your needs?
<vms14>
beach: not really
<beach>
vms14: It does not!
<vms14>
but I mean abusing CLOS or making a big program that uses CLOS as lot as possible, could be a problem?
<beach>
vms14: We are very lucky in that we always have the entire code available, and that the standard says the compiler has to be present.
<beach>
vms14: So we can take advantage of that situation to eliminate overhead of the dynamic aspects of (say) generic functions.
<phadthai>
indeed, or you could use ruby if you didn't care at all (the common lisp standard evolved with compilers in mind despite lisp being very dynamic)
<beach>
vms14: I use generic functions a lot, and I have no problems.
<vms14>
I want lisp
<vms14>
no more
<beach>
vms14: More important than overhead is to choose the right data structures.
<vms14>
I'm just curious about those things, because usually once you learn this kind of things you can learn more how lisp "works"
ahungry has joined #lisp
<beach>
vms14: Many newbies worry a lot about performance and then micro-optimize as a result. At the same time, they are capable of using inefficient data structures that give them quadratic rather than linear algorithms.
<vms14>
beach: my code is usually very bad written, so there is no point in caring about performance, and most of my "programs" are really only little scripts or tests, so meh
<beach>
vms14: Then you can forget about "CLOS overhead".
<vms14>
but I also have read that for a lisp newbie is very easy to make slow lisp programs
<vms14>
like consing a lot, and much more stuff I'm not aware of
<beach>
vms14: Oh, wait, aren't you the one with the recent MERGE program?
<vms14>
beach: no, I guess
<beach>
Oh, sorry!
reverse_light has joined #lisp
<beach>
It is very easy for a newbie to write slow programs in any language, because they don't understand about algorithmic complexity.
<vms14>
I was the guy who didn't want to indent the lisp code when I started
<beach>
It is true that Common Lisp gives them tools to make things worse.
<no-defun-allowed>
Consing in Lisp is very, very cheap. It's not free, but it's less necessary to micro-optimise memory usage than in other languages like C or even Python.
<beach>
vms14: Right, I confused you with shangul.
<no-defun-allowed>
(Indeed I said "C or even Python", the latter is garbage collected but still uses slow malloc.)
<beach>
vms14: As no-defun-allowed is hinging, a lot of work went into making it possible to compile Common Lisp into very efficient code, and that includes generic functions and standard classes.
<beach>
vms14: Some implementations have not had enough maintainer time to fully take advantage of this possibility, but you should not let that fact influence your programming style.
<no-defun-allowed>
I think that the overuse of lists in Lisp is probably the worst thing one can do. They are not very good substitutes for classes, structures, hash tables or arrays.
<beach>
Yes, that is one example of newbies choosing the wrong data structure because of ignorance of algorithmic complexity.
<no-defun-allowed>
But I have heard that some introductory courses about things like symbolic AI in (Common) Lisp do use lists where they don't belong. I will probably take such a course in university in two years, so I can comment on it then.
<phadthai>
I tend to use them more in macros/compile-time than at runtime myself, except where they're very suitable
<no-defun-allowed>
In this (possible) case, I feel the course is as much at fault as the newbie.
<phadthai>
yes many examples, especially in introductory texts, focus on lists and cons, for a basic understanding
<phadthai>
and maybe by tradition
<beach>
no-defun-allowed: University graduates should learn to think for themselves and read up on their own. There is a lot of teacher incompetence at universities worldwide. Some day when I have time, I can explain to you why that is so.
<vms14>
no-defun-allowed: I'm using symbols and abusing gensym
<vms14>
to make something like a simple oop
<no-defun-allowed>
beach: If it's an symbolic AI course, I think students and course writers would have a lot to write about in little time.
<vms14>
setf'ing the property lists of those symbols
<no-defun-allowed>
They would have to learn Lisp and whatever AI techniques they use.
<no-defun-allowed>
But that is all based on one internal forum post from 2014 asking for a "LISP interpreter" for the AI course.
<no-defun-allowed>
vms14: That is a very odd representation.
<beach>
no-defun-allowed: I see.
<beach>
vms14: Here is my advice: Learn about how Common Lisp operators would typically be implemented, and about the complexity of such implementations. And given what you already do, you can safely forget about "CLOS overhead".
SaganMan has joined #lisp
<vms14>
yes, I was a bit worried about CLOS, and even trying to avoid it for simple stuff, which is mainly what I do with lisp, but I won't worry more, and use it whenever I think I'll need it
madrik has joined #lisp
<no-defun-allowed>
It is also possible they would also have to put up with suboptimal tools then, since the only reply was just a link to CLISP without any mention of an editor or IDE or anything like that.
<beach>
Wow!
<beach>
no-defun-allowed: If I were you, I would suggest to the teacher that you give a "guest lecture" on Emacs+SLIME+SBCL.
<beach>
You can explain that you have been using Common Lisp for a few years now.
<no-defun-allowed>
Sure. It is still in two years though.
<beach>
Of course.
<no-defun-allowed>
AI: A Modern Approach is on the book list though, which is nice.
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
<no-defun-allowed>
Let's see, there's some LISP (sic) and PROLOG (double sic) on the course description.
baby_yoda_squadr has joined #lisp
whiteline has quit [Remote host closed the connection]
ealfonso6 has quit [Ping timeout: 240 seconds]
<vms14>
no-defun-allowed: there is a second course following this one?
dddddd has quit [Remote host closed the connection]
hsaziz has quit [Ping timeout: 260 seconds]
<vms14>
it seems you'll be bored at the first one, but if there is a second one, maybe you'll like it
<vms14>
or maybe you're lucky and only get bored at first time, but then they focus more on ai and those concepts
<no-defun-allowed>
vms14: There is only one AI course, but it covers many disciplines and implementations of AI (neural networks and real AI) and it is two years away.
<vms14>
I think it's a great idea that they'll teach lisp and prolog
<vms14>
it will make you understand why those boths languages are so well suited for ai, and why they have that "ai reputation"
<no-defun-allowed>
I found an old exercise and it looks...okay. The formatting is good, but they use lists too much and use LOAD instead of systems. Eh well.
<no-defun-allowed>
There's a total of 4 weeks of learning "AI languages".
<vms14>
no-defun-allowed: you have read some peter norvig's books?
<no-defun-allowed>
Just PAIP.
<vms14>
even if it results to be boring, you should try to get the most you can of that teacher/course
<vms14>
even if you have much better skills than the teacher
<no-defun-allowed>
Perhaps an exaggeration, but most of nothing is not very much.
<vms14>
I usually try to get all the knowledge of the teacher I can, but if it has not much knowledge I loose a big part of what I wanted of that course, which is steal all the knowledge I can
<vms14>
but you can take much more benefit of the course even if the teacher has not much to teach
<vms14>
which are the advantages/disadvantages between lisp/scheme related with having different namespaces for functions and names or not?
<ebrasca>
vms14: I think copy is not stealing.
<beach>
vms14: The advantage of a Lisp-2 is that you can give reasonable names to your function parameters, like LIST.
ebrasca has quit [Remote host closed the connection]
<beach>
vms14: The disadvantage is that you need operators to pass from one namespace to the other, like FUNCTION and FUNCALL.
ebrasca has joined #lisp
<ahungry>
I agree lisp-2 is nice in that there is less chance of unintended consequences (giving a function parameter that intends to receive a function the name of 'fn' in clojure is an easy mistake to make, and then overshadows the built in 'fn' definition, which can come back to bite you), but if you get a "feel" for a lisp-1 or language with single namespace first class functions (javascript) it can be hard to get used to all that verbosi
<ahungry>
again
Oladon has joined #lisp
<beach>
ahungry: I believe your utterance was cut off after "that verbosi".
enrio has joined #lisp
<ahungry>
ah ,bummer, shows on my client that it went through
ahungry has quit [Remote host closed the connection]
Oladon has left #lisp [#lisp]
<vms14>
ebrasca: by stealing knowledge I mean to have some one who knows about, and make him/her teach you all they know/have experienced, specially if it's a teacher (because that's for what a teacher get's paid)
Oladon has joined #lisp
<vms14>
never meant copying, but squeeze that person's knowledge, like if you're making juice with the knowledge of that person
<Xach>
knowledge juice
<vms14>
yes :D
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
<Xach>
knowl god jul ce
baby_yoda_squadr has joined #lisp
<ebrasca>
vms14: You shall not steal
<vms14>
:O
<no-defun-allowed>
Well, if you copy someone's code, they still have theirs.
<vms14>
I was just saving this string into a database while you said one of the commandments: "The fear of the Lord-that is wisdom, and to shun evil is understanding"
zaquest has quit [Quit: Leaving]
atgreen has quit [Ping timeout: 258 seconds]
doublex_ has quit [Read error: Connection reset by peer]
doublex_ has joined #lisp
shangul has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
abhixec has quit [Ping timeout: 265 seconds]
Oladon has joined #lisp
vlatkoB has joined #lisp
fortitude has quit [Ping timeout: 268 seconds]
shangul has quit [Read error: Connection reset by peer]
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
vms14 has quit [Remote host closed the connection]
jello_pudding has joined #lisp
_whitelogger has joined #lisp
torbo has quit [Remote host closed the connection]
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
baby_yoda_squadr has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
raghavgururajan has joined #lisp
<no-defun-allowed>
Is there a Common Lisp or MOP function for "overwriting" the class and contents of one standard instance with those of another instance?
hsaziz has joined #lisp
_whitelogger has joined #lisp
<beach>
That's what CHANGE-CLASS does.
<beach>
Oh, sorry.
<no-defun-allowed>
Can I replace the slot contents with CHANGE-CLASS?
<beach>
Yes.
<beach>
Just pass the initargs.
<beach>
You would have to access the slots of the model explicitly.
<no-defun-allowed>
Right. I don't have any initargs, just one instance and another instance I wish to overwrite into.
<beach>
Er, no initargs?
ebzzry has quit [Read error: Connection reset by peer]
<beach>
Initargs and accessors are the stable diet of a CLOS protocol.
<no-defun-allowed>
Indeed, but I'm currently working at a sub-CLOS level.
<beach>
So how do you know where to find the information in the model and where to put it in the copy?
<no-defun-allowed>
Hmm. I'll have to think about that.
<beach>
I suppose since the copy is an instance of the same class as the model, you can use slots.
<beach>
So just change class, and then loop over the slots.
ebzzry has joined #lisp
<beach>
(loop for slot in (class-slots <class>) do (setf (slot-value-using-class <class> <copy> slot) (slot-value-using-class <class> <model> slot)))
<no-defun-allowed>
That looks good.
<beach>
Great!
<no-defun-allowed>
Figure I'll use that then. Thankyou.
<beach>
Let me know how it turns out.
Oladon has joined #lisp
enrioog has joined #lisp
<no-defun-allowed>
I agree it's a weird place to work in, I'm trying to figure how to lazily resolve references to other objects in my distributed object store. My current plan is to overwrite any references in a slot's value when it is accessed for the first time.
<beach>
My brain is too small to understand about explicitly storing objects to secondary memory.
enrio has quit [Ping timeout: 258 seconds]
<beach>
I mean, you store a pointer to some object, and then the GC moves that object in memory. What happens to your pointer on secondary memory?
<no-defun-allowed>
Don't worry about it then. I've dug myself into a very strange place with this recently.
<no-defun-allowed>
(I do have two ideas that involve objects and non-primary memory: this networked/distributed object system and an object database. The former is certainly not going to
<no-defun-allowed>
come close to an implementation of CLOS, mostly because it deals with immutable values and marshals objects through a plain-text format.)
* no-defun-allowed
bumped the Enter key too early
<beach>
So identity is not preserved?
<beach>
That's another thing for which my brain is too small.
<beach>
I can no longer program without this property.
<LdBeth>
I’d assume it’s an object store
<beach>
LdBeth: Except I don't know what that means, as I explained.
<no-defun-allowed>
Identity is defined somewhat differently for a client of a distributed hash-table. Those don't really have "pointers", and instead they address data by a hash of that data.
<beach>
OK, so that completely changes the entire programming model.
<beach>
That's what my brain is too small to deal with.
Necktwi has quit [Ping timeout: 268 seconds]
karlosz has joined #lisp
<no-defun-allowed>
The main problem with that is that mutability is very difficult, which is why I'm trying to come up with a way to add "after the fact" values to that data, so a client can retrieve the newest state of an object.
<LdBeth>
no-defun-allowed: just make it immutable
Oladon1 has joined #lisp
<no-defun-allowed>
LdBeth: I could, but what's the fun in that?
<LdBeth>
Idk
Oladon has quit [Ping timeout: 265 seconds]
<no-defun-allowed>
It would be impossible to create references to objects "forwards in time" immutably, which severely limits the uses of such an object system.
hsaziz has quit [Ping timeout: 240 seconds]
<LdBeth>
Then a modification could be a signal to multiple clients
<LdBeth>
Vice versa
<no-defun-allowed>
The kludge I have in mind for that is that given an immutable object, it is possible to run a deterministic program to generate a set of "side effects", which can then be attached in an unhashed section of the object, and verified by other nodes by running that program again.
Arcaelyx has quit [Ping timeout: 258 seconds]
ebrasca has quit [Remote host closed the connection]
<LdBeth>
It’s essentially two interpretations to the same phenomena
* LdBeth
pass args to function/send a message/modify a variable
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
Oladon1 has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
baby_yoda_squadr has joined #lisp
ggole has joined #lisp
mathrick has quit [Ping timeout: 240 seconds]
orivej has quit [Remote host closed the connection]
orivej has joined #lisp
vlatkoB_ has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
vlatkoB has quit [Ping timeout: 268 seconds]
mathrick has joined #lisp
gabiruh_ has joined #lisp
jello_pudding has quit [Quit: Quit]
gabiruh has quit [Ping timeout: 258 seconds]
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
baby_yoda_squadr has joined #lisp
Oladon has joined #lisp
mathrick has quit [Ping timeout: 268 seconds]
Oladon has quit [Read error: Connection reset by peer]
karlosz has quit [Quit: karlosz]
Arcaelyx has joined #lisp
Oladon has joined #lisp
_whitelogger has joined #lisp
dale has quit [Quit: My computer has gone to sleep]
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
mathrick has joined #lisp
nanoz has joined #lisp
varjag has joined #lisp
enrioog has quit [Ping timeout: 240 seconds]
gravicappa has quit [Ping timeout: 260 seconds]
gravicappa has joined #lisp
madrik has quit [Remote host closed the connection]
baby_yoda_squadr has quit [Quit: -a- Connection Timed Out]
mathrick has quit [Ping timeout: 265 seconds]
decent-username has joined #lisp
baby_yoda_squadr has joined #lisp
madrik has joined #lisp
<MichaelRaskin>
no-defun-allowed: once upon a time, I have wondered how to store mutable data in an immutable store, there is actually a pretty simple way that requires logarithmic number of requests (in the number of updates since last seen) to obtain the newest state, which is also provably optimal
<no-defun-allowed>
MichaelRaskin: Is it anything like a skip list?
kritixilithos has joined #lisp
kritixilithos has left #lisp [#lisp]
nowhere_man has quit [Ping timeout: 252 seconds]
<no-defun-allowed>
I intend to write a program that creates all the forwards-in-time references given an object and its backwards-in-time references, which would allow for O(log n) lookup time.
* no-defun-allowed
can only find information about immutable stores in Redux; what's that and why does it appear in searches for "mutable data in immutable store"?
hsaziz has joined #lisp
<eeeeeta>
no-defun-allowed: JavaScript bollocks I think
<eeeeeta>
afaik it's a state store for UI purposes
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
xvx has joined #lisp
Oladon has joined #lisp
ebrasca has joined #lisp
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
tryhard21 has joined #lisp
rippa has joined #lisp
vap1 has joined #lisp
vap1 has quit [Read error: Connection reset by peer]
<MichaelRaskin>
no-defun-allowed: well, of course it is kind of like skip lists for the optimisation part
<MichaelRaskin>
Not much choice here
<MichaelRaskin>
The idea is you have write-once key-value store, then you have origin key, and use Hash(origin,update-number) as a key for updated versions
<MichaelRaskin>
Then you can binsearch without an explicit skip-list
fookara has joined #lisp
mooch has joined #lisp
mooch has quit [Read error: Connection reset by peer]
<no-defun-allowed>
Ooh, interesting.
william1 has joined #lisp
<no-defun-allowed>
I think the approach I have might still be useful because it allows for other structures like trees to form in the context of a multi-"user" system.
<decent-username>
Yo, I wanted to ask a question over in #clschool, but whenever I send something I get the following message: *** #clschool: Cannot send to channel
<phoe>
decent-username: are you registered with nickserv?
<phoe>
that could be one case
<decent-username>
yes, I'm pretty sure
<decent-username>
How do I check that?
<decent-username>
I'm using this account already for so long, that I forgot what email address I used to register.
<phoe>
/msg nickserv status
nanoz has quit [Ping timeout: 240 seconds]
<MichaelRaskin>
no-defun-allowed: depending on what exactly you want, of course, you can mix the approaches. Store-an-interepreted-program approach has some overhead issues versus store-signed-precomputed-updates (which you walk to find one you are ready to trust)
<decent-username>
phoe, I've typed the wrong password when I logged in.
<decent-username>
hehe, thanks for the help.
<phoe>
decent-username: then type the correct one and it should help
decent-username has quit [Quit: ERC (IRC client for Emacs 26.3)]
decent-username has joined #lisp
Oladon has quit [Quit: Leaving.]
mathrick has joined #lisp
<no-defun-allowed>
MichaelRaskin: Absolutely. In the context of my distributed hash table, my next headache will arise when I need to communicate side effects between nodes to ensure they have all of those, even though the effects are created from objects they don't store.
<no-defun-allowed>
eeeeeta: I am reminded of Haskell's state monad and the method-hooks library I provided an example implementation for by that, somehow.
<eeeeeta>
no-defun-allowed: aha, I haven't managed to get round to tackling Haskell yet
* eeeeeta
probably isn't smart enough
<no-defun-allowed>
I don't think anyone is, but it has that kind of reduction pattern that I saw in the example code.
ArthurStrong has joined #lisp
<no-defun-allowed>
Like, that monad takes a function that goes (state, effect) -> new state, and REDUCE goes (new value, last reduction) -> reduction.
ArthurStrong has quit [Client Quit]
ArthurStrong has joined #lisp
ebrasca has quit [Remote host closed the connection]
william1 has quit [Quit: WeeChat 1.9.1]
ghard`` has joined #lisp
<phoe>
Is it permitted for MAKE-INSTANCE to return a non-fresh instance? I'm asking since I looked at cl-singleton which has (eq (make-instance 'some-child) (make-instance 'some-child)) ; => T
ghard` has quit [Ping timeout: 248 seconds]
<phoe>
CLHS says, "The generic function make-instance creates and returns a new instance of the given class." It doesn't mention what "new" means though.
<phoe>
Neither does the glossary.
<phoe>
If I assume "new" as in "not EQ to any other instance", then we have a protocol violation.
<MichaelRaskin>
no-defun-allowed: true, my interest was primarily about maintaining traversability of self-sufficient storage units (like a DVCS server, where only the things that have already been synced here matter)
brown121407 has quit [Read error: Connection reset by peer]
<froggey>
phoe: CLHS says make-instance returns "a fresh instance of class class" (in the "arguments and values" subsection)
brown121408 has joined #lisp
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
<phoe>
froggey: ha! "fresh" is defined in the glossary.
<phoe>
thanks.
insilications has joined #lisp
insilications has quit [Remote host closed the connection]
insilications has joined #lisp
vidak` has joined #lisp
EvW has joined #lisp
atgreen has joined #lisp
whiteline has joined #lisp
insilications has quit [Remote host closed the connection]
smokeink has joined #lisp
smokeink has quit [Remote host closed the connection]
_whitelogger has joined #lisp
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 260 seconds]
ebzzry has quit [Read error: Connection reset by peer]
_whitelogger has joined #lisp
hsaziz has quit [Quit: hsaziz]
rozenglass has joined #lisp
rotucer has joined #lisp
bitmapper has joined #lisp
Lord_of_Life_ has joined #lisp
doublex_ has quit [Read error: Connection reset by peer]
doublex_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life_ is now known as Lord_of_Life
dddddd has joined #lisp
rotucer has quit [Read error: Connection reset by peer]
rotucer has joined #lisp
hsaziz has joined #lisp
random-nick has joined #lisp
EvW has quit [Ping timeout: 248 seconds]
hsaziz has quit [Quit: hsaziz]
X-Scale has quit [Read error: Connection reset by peer]
hsaziz has joined #lisp
rotucer has quit [Read error: Connection reset by peer]
rotucer has joined #lisp
rotucer has quit [Read error: Connection reset by peer]
rotucer has joined #lisp
rotucer has quit [Read error: Connection reset by peer]
rotucer has joined #lisp
bitmapper has quit [Remote host closed the connection]
bitmapper has joined #lisp
rozenglass has quit [Ping timeout: 240 seconds]
Ampws has joined #lisp
hsaziz has quit [Ping timeout: 240 seconds]
brown121408 has quit [Ping timeout: 260 seconds]
gabiruh_ has quit [Ping timeout: 240 seconds]
<phoe>
I want to check if a list contains no more than four elements that are equal by FOO=. Is there any idiomatic way of doing this?
<phoe>
I'd use a hash table for that, but I have a custom equality predicate.
brown121408 has joined #lisp
ebzzry has joined #lisp
<_death>
count-if?
<phoe>
_death: what kind of predicate do I serve it?
<phoe>
I have a list, and I want to ensure that no five or more elements are FOO= to each other.
<phoe>
I could do it on O(n²) by iterating over the whole list and calling COUNT-IF, but I want to know if there exists an idiomatic linear solution.
reverse_light has quit [Remote host closed the connection]
<ggole>
There's some library for hash tables with custom equality iirc
<_death>
yeah, my thought was (loop for x on list thereis (>= (count-if (lambda (y) (foo= (car x) y)) (cdr x)) 4))
<_death>
you could of course do it more efficiently.. I'm sure you know how :)
<phoe>
_death: I *know* how, that is correct. I just don't want to reinvent the wheel by writing my own implementation if one already exists in some commonly used utility library.
<_death>
(should be 3..)
<_death>
well, fset could make it easy
<_death>
it reminds me of union-find
rotucer has quit [Read error: Connection reset by peer]
<phoe>
_death: I think I'll go for your solution, except (loop for x on (remove-duplicates list :test #'foo=) ...)
rotucer has joined #lisp
<phoe>
The list is always short enough for me to say "quadratic is fine" here.
<MichaelRaskin>
Sometimes you still can easily split the list into obviously-unequal classes, but maybe it is not worth it in your case
<ggole>
Does FOO= admit an ordering? You could sort the list and count the length of equal runs.
<phoe>
ggole: that would be FOO<, but still, it's kind of an overkill here.
<_death>
inefficiency doesn't matter (until it matters) if you have a clean abstraction
<ggole>
Well, I really meant that you could do that if FOO< could be sensibly defined.
<ggole>
It would certainly be more code than the quadratic one.
rotucer has quit [Ping timeout: 240 seconds]
lemoinem has joined #lisp
rotucer has joined #lisp
brown121408 has quit [Read error: Connection reset by peer]
EvW1 has joined #lisp
brown121407 has joined #lisp
lxpnh98 has joined #lisp
khisanth_ has quit [Ping timeout: 240 seconds]
brown121407 has quit [Ping timeout: 260 seconds]
brown121407 has joined #lisp
EvW1 has quit [Ping timeout: 245 seconds]
brown121407 has quit [Read error: Connection reset by peer]
brown121407 has joined #lisp
khisanth_ has joined #lisp
rotucer has quit [Ping timeout: 268 seconds]
hsaziz has joined #lisp
hsaziz has quit [Client Quit]
rotucer has joined #lisp
hhdave has joined #lisp
brettgilio has quit [Quit: Quit]
lxpnh98 has quit [Quit: Leaving]
jonatack has quit [Ping timeout: 248 seconds]
jonatack has joined #lisp
Oladon has joined #lisp
_whitelogger has joined #lisp
atgreen has quit [Ping timeout: 268 seconds]
mn3m has quit [Ping timeout: 265 seconds]
fookara has quit [Read error: Connection reset by peer]
xvx has quit [Remote host closed the connection]
xvx has joined #lisp
madrik has left #lisp ["Sleep"]
bitmapper has quit [Read error: Connection reset by peer]
<pjb>
equivalence-classes is basically O(n*c) with n = (length list) and c = number of equivalence classes.
mn3m has joined #lisp
ebzzry has quit [Read error: Connection reset by peer]
enrio has joined #lisp
<stylewarning>
pjb: why not optionally take a hash function
<pjb>
stylewarning: there's no optimization here.
<stylewarning>
Do u like slow code
<pjb>
Well, depends on the number of classes, right. If you have a lot of classes, a hash-table might be better.
<pjb>
But the problem is that we're considering a foo=, and there's no hash-table for foo=.
<pjb>
And there's not necessarily a foo< either.
<MichaelRaskin>
There could be a conservative hash-approximation
<MichaelRaskin>
(optional)
<stylewarning>
Or just provide it optionally! Fall back to quadratic if it’s not there. (:
<MichaelRaskin>
I.e. something easy to calculate, such that different values guarantee lack of foo=
<MichaelRaskin>
With it, it is still kind of quadratic, but only per-bucket
<stylewarning>
MichaelRaskin: that’s a nice kernel of an idea for a broader concept of sieving. False positives and no false negatives.
<stylewarning>
You could imagine a tower of such functions
<MichaelRaskin>
I guess if the question is «are there four equivalent entries», there _are_ indeed a lot of classes in typical input
<MichaelRaskin>
Well, relative to n
<MichaelRaskin>
stylewarning: sure, one-sided errors are useful
fortitude has joined #lisp
ebzzry has joined #lisp
rotucer has quit [Quit: Quit]
ArthurStrong has quit [Quit: leaving]
cosimone has joined #lisp
brettgilio has joined #lisp
parjanya has quit [Ping timeout: 252 seconds]
hhdave has quit [Quit: hhdave]
<phoe>
I need a MULTIPLE-VALUE-OR. Is it available in some sort of a library?
<_death>
slime
<phoe>
...of all the utility libraries I am aware of, I did not expect to find it in swank
<ggole>
Hmm, does (m-v-or (values nil 1) (values t 2)) => t, 2 or t, 1?
<phoe>
ggole: t, 2
<phoe>
the OR checks the primary value
<phoe>
the MULTIPLE-VALUE- ensures that all values are returned from the form whose primary value is true
<ggole>
Right, that makes more sense for short-circuiting
william1 has joined #lisp
EvW has joined #lisp
kark has joined #lisp
fanta1 has joined #lisp
<phoe>
Okay. Now my method combination is more like I wanted it to be.
<phoe>
...I think I am starting to grasp method combinations in general now.
atgreen has joined #lisp
ggole has quit [Quit: Leaving]
pfdietz50 has joined #lisp
william1 has quit [Ping timeout: 260 seconds]
<pfdietz50>
phoe: for an arbitrary equality operation, there would be no better way than an O(n^2) algorithm for that problem. Consider the case where there are exactly four that are = to any other element in the list, and they are equal to each other.
atgreen has quit [Ping timeout: 265 seconds]
<pfdietz50>
The whole problem of equality (and copying, and hashing) smells very categorical to me.
<phoe>
pfdietz50: yep, that's correct.
atgreen has joined #lisp
gravicappa has quit [Ping timeout: 268 seconds]
fortitude has quit [Ping timeout: 240 seconds]
<pfdietz50>
Now, if the problem is to find if there are at most four that are not equal to some other value, then that can be done in O(n) time (assuming the equality relation is transitive.)
<pjb>
ok, but since it takes only the time to type it, it's faster than to ask on irc for it, to look for a library, or even locate it in swank and copy-paste it…
fortitude has quit [Ping timeout: 258 seconds]
<phoe>
pjb: I'm trying to avoid NIH when I'm writing my code. I first look in the libraries I'm aware of (in this case, alexandria, serapeum, uiop), then I ask if anyone knows if it's already in some library. Only in the last resort I write it myself.
fanta1 has quit [Quit: fanta1]
brettgilio has quit [Ping timeout: 260 seconds]
william1 has joined #lisp
EvW has quit [Ping timeout: 245 seconds]
learning has joined #lisp
anewuser has joined #lisp
william1 has quit [Ping timeout: 240 seconds]
raghavgururajan has quit [Remote host closed the connection]
gravicappa has joined #lisp
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 260 seconds]
EvW1 has joined #lisp
torbo has joined #lisp
Josh_2 has joined #lisp
fortitude has joined #lisp
scymtym__ has quit [Ping timeout: 245 seconds]
ym has quit [Ping timeout: 268 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Oladon has quit [Read error: Connection reset by peer]
decent-username has left #lisp ["ERC (IRC client for Emacs 26.3)"]
Oladon has joined #lisp
cosimone has quit [Quit: Terminated!]
didi has joined #lisp
brettgilio has joined #lisp
ym has joined #lisp
cosimone has joined #lisp
cosimone has quit [Client Quit]
<didi>
Why does function `subseq' have a positional parameter and not keyword parameters instead?
<aeth>
Probably because keywords would be unnecessary there.
<aeth>
They'd just lengthen every call
<pfdietz50>
There is a single optional argument. Keywords make sense if you have > 1 optional argument and either could reasonably be omitted.
<didi>
aeth: Yeah, maybe. But I'm also curious about the positional parameter, start. Why not both optional?
<Shinmera>
what would the first argument default to?
<didi>
pfdietz50: I see.
<aeth>
Subseq with no arguments would just be a copy?
<didi>
Shinmera: 0.
<didi>
aeth: I guess.
<Shinmera>
that's what copy-seq is for.
<didi>
Shinmera: Indeed.
<Shinmera>
Right, so why would you want that argument to be optional again?
<pfdietz50>
One might ask why copy-seq is there.
<_death>
subseq is a simple function.. one could imagine a subseq-on-steroids with start, step, end, count, etc.
<aeth>
copy-seq behaving like that would make more sense imo
<pfdietz50>
It's also an accessor. Not sure if that has any implication here though.
<_death>
I think about a decade ago I wrote such a function called extract-subsequence
<didi>
One could also use the first parameter as an end if no optional parameter has been passed, but that's just crazy.
<_death>
the javascript way
<didi>
I think Python does it too.
gravicappa has quit [Ping timeout: 240 seconds]
<jcowan>
beach: I wish you would stop spreading the notion that Lisp-1s don't allow you to use LIST as a lexical variable name. They do, unless you are using the LIST function in the same scope. I understand not going into hygiene issues with newbies.
fortitude has quit [Ping timeout: 260 seconds]
Josh_2 has quit [Remote host closed the connection]
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
slyrus has joined #lisp
<no-defun-allowed>
jcowan: From my experience in other languages with single namespaces (like Python), it is very frowned upon to use names of built-in functions as local variables, and linters will scream at you if you do.
slyrus__ has quit [Ping timeout: 260 seconds]
enrio has quit [Ping timeout: 260 seconds]
nullniverse has joined #lisp
nullniverse has joined #lisp
nullniverse has quit [Changing host]
atgreen has quit [Ping timeout: 265 seconds]
<aeth>
Conventionally, Scheme tends to use l or lst, at least in the example code I've seen.
<aeth>
Even if list is possible.
learning has quit [Remote host closed the connection]