freenode/#lisp - IRC Chatlog
Search
2:07:06
Xach
www.xach.com/tmp/wobble.gif is some output from (hacked vecto)+skippy that i think looks neat
4:02:14
fc2020apt[m]
Lack of motivation to program or do much else except gaming, and mostly used to C derivatives
4:59:05
easye
Alright. I am going to try to touch base with Didier today, and see if we can get something going to give him a deserved break.
5:00:11
easye
So, practically maybe the call for papers would be delayed a couple months at worse case.
5:38:43
beach
But this is a typical case where exploiting the properties of the domain can improve performance a lot.
5:39:46
beach
Also, another property to exploit might be the frequency of the modification of the mapping.
5:52:20
ldbeth
beach: yes. the integer domain is continous (from 0 to n), and charactor is limited to 245 ascii code
5:54:37
beach
ldbeth: Then, for the characters, it is faster to have a vector of length 245 (256?), but that assumes the character domain is compact, which you haven't told us about. If it is not, but it doesn't change very often, a binary search is faster than a hash table, so a vector with the sorted character keys in it.
5:55:15
beach
And if the character domain doesn't change very often at all, the fastest way is to compile a function that executes a decision tree.
5:55:47
beach
ldbeth: There are just too many options to be able to say anything general without knowing all these characteristics.
5:57:28
ldbeth
beach: my intention is to represent an acyclic finite state automata for spell checking against a large dictionary
6:03:28
beach
Anyway, don't do a hash table for the characters. For spell checking, I would do a full-size vector on the top level and a binary search on the following levels.
6:09:37
ldbeth
since the words in dictionary are at least 3 chars long, I can make 2 levels of full-size vector and then do tree search
6:23:22
beach
That would waste a lot of space I am afraid. I am guessing that already at the second level, the domain is no longer very compact.
7:05:41
lotuseater
beach: about 27 calls of CHANGE-CLASS in the current (master) Cleavir source code :)
7:07:44
no-defun-allowed
Without CHANGE-CLASS, you can't write OVERWRITE-INSTANCE, which is a very fun thing to have around.
7:12:40
no-defun-allowed
OVERWRITE-INSTANCE is a function I wrote somewhere in Netfarm, so that I could...overwrite an instance. It is not too complicated.
7:13:24
no-defun-allowed
Here it is: https://gitlab.com/cal-coop/netfarm/netfarm/-/blob/master/Code/Objects/MOP/rewrite-references.lisp#L34
7:13:48
no-defun-allowed
I hope I don't use it ever; it probably handles unbound slots wrong, and also probably shouldn't call INITIALIZE-INSTANCE again. But it was quite fun.
7:14:40
no-defun-allowed
I would have used it to store a "reference" object with the hash of an object I actually wanted to put in place, so that I can overwrite them lazily.
7:16:29
no-defun-allowed
Yes, using closer-mop is preferable over the MOP package of your implementation.
7:57:35
nij
Why doesn't (equal (vector 1 2 3) (vector 1 2 3)) return 'T? I'm confused with the logic behind 'equal.
7:58:00
nij
(I'm aware that I probably should use 'equalp to compare arrays.. just curious about why.)
7:59:59
beach
nij: Common Lisp proposes a set of predefined equality predicates that were deemed useful.
8:00:15
nij
By the DOC you posted, they shouldn't EQUAL. The two vectors are constructed at different addresses.
8:00:21
beach
nij: If you don't find them useful in your situation, then you need to define your own.
8:01:23
beach
But if the two arguments to EQUAL happen to be EQ, then obviously a true value is returned.
8:04:42
beach
nij: The phone company thinks me and my wife are equal because we have the same phone number.
8:06:45
beach
nij: The mathematical equality you are referring to works only in the very restricted universe of mathematicians, where most things are numbers, or isomorphic to numbers.
8:10:16
nij
Highlight: There is no uniquely determined equality function for complex structures--there are only arbitrary ones.
8:11:15
beach
If you want strict mathematical sense, you need to use numbers as your only data type.
8:12:56
no-defun-allowed
It is impossible to decide if two terms in the lambda calculus are equivalent, so I am sure mathematicians get into hairy situations too. "where most things are numbers, or isomorphic to numbers" doesn't hold for those situations, of course.
8:13:10
beach
nij: Imagine you have several graphs of objects. Now you want to check whether two objects are "equal in the strict mathematical sense". Are you suggesting that this equality predicate will then have to solve the graph isomorphism problem?
8:13:58
beach
no-defun-allowed: Sure, though mathematicians are not that much into decidability. That's mainly for CS people.
8:14:30
no-defun-allowed
Ouch, I was going to mention graphs, but NP isn't quite undecidable. /me needs graph isomorphism for her idea of approximating protocol equivalence.
8:15:47
nij
How then would one really decide which to use? By reading the source code of all of them?
8:17:13
beach
nij: Again, you will usually have to define your own equality predicate. If what you need happens to correspond to the definition of one of the existing ones, then use it.
8:17:26
no-defun-allowed
Yes, the Common Lisp HyperSpec defines the semantics of such predicates, as well as everything else in Common Lisp (except the parts it leaves undefined for whatever reason).
8:19:39
no-defun-allowed
Indeed, but I was expecting someone to say "no, the standard leaves some behaviour undefined", so I put the part in parens in.
8:21:24
adlai
nij: keep an eye out for :test and :test-not keyword arguments that are taken by many of the sequence functions, and allow you to supply your own customized equality predicates
8:22:20
no-defun-allowed
Oh, speaking of protocols, how would you define a protocol in a rigorous, but hopefully not too tedious, manner? I am currently thinking operations (with optional argument and return types), some test cases, and some representation of how I should expect the state of objects to change, should there be state.
8:23:18
no-defun-allowed
phoe: Well, a type is a bundle of operations that can be applied to an object of that type, in my head.
8:23:33
no-defun-allowed
beach: Yes, from memory you define a protocol as a set of types and functions?
8:24:46
beach
The more you can refer to other protocol operations, the better. Like, A can be applied to an object O only if B returns true for O.
8:25:28
no-defun-allowed
Additionally speaking of Netfarm (with OVERWRITE-INSTANCE), I want to have a go at using definitions of protocols to create glue logic between protocols that are not compatible, but could be made compatible with such logic.
8:27:03
no-defun-allowed
beach: In a short article I wrote, I imagined a finite state machine, where each state had a predicate that would return true if the object was in that state, and some functions to transition between them. But that does not help for your operation A, which may not cause a transition, and it is also no good for modelling a stack.
8:28:12
beach
Yes, things might be more complicated than that. Transitions might depend on the history of operations applied.
8:28:31
no-defun-allowed
Well, I don't like the other approaches to developing protocols in a decentralised way, because they are too concerned with representations and not operations.
8:29:01
lotuseater
oh damn, coming back short to the equal question, seems like SXHASH just hashes on the array dimension. interesting
8:29:25
no-defun-allowed
If you concern yourself with operations and not representation, you already get some leeway, but translating operations somehow seems less hopeless than representation.
8:31:36
no-defun-allowed
Suppose I have a server which implements protocol A, and you make a server which implements an extension of A, call it A'. Now what should I do if I receive an object from your protocol? I can either just drop your extensions, or see how much of your extension I can present to the client. (I want to do the latter, but in my opinion that's the less interesting question of this one and the next one.)
8:33:20
no-defun-allowed
Now what if, somewhere on Equivalent Earth, an equivalent no-defun-allowed creates an implementation of protocol B, and I somehow find their objects laying around somewhere. For some definition of "isomorphic", if those protocols are isomorphic, then I could use those objects like they were from protocol A.
8:36:40
no-defun-allowed
adlai: Perhaps, but I think a sufficiently good answer would save everyone from forwards, backwards and cross -compatibility woes.
8:36:41
srandon111
guys does sbcl statically compiles by default? if not, how can i build a standalone statically compiled executable ?
8:37:30
no-defun-allowed
As opposed to "dynamic compilation" (also "just-in-time compiling"), SBCL would be mostly "static", I suppose.
8:38:18
beach
srandon111: The semantics of a Common Lisp program can be defined by a suite of interactions, starting with the initial image.
8:38:26
srandon111
beach, do you know about the dynamic libraries (in gnu/linux are the .so, whilee on Windows are the .dll), well instead of relying on these ones, you basically put everything in the executable image...
8:38:58
no-defun-allowed
I don't know of a way to create static executables with SBCL; SAVE-LISP-AND-DIE usually creates dynamically linked executables.
8:39:17
beach
srandon111: If you just use save-lisp-and-die in SBCL, you can generate an executable from the current state of your system.
8:39:34
no-defun-allowed
srandon111: "static compilation" would be the opposite of https://en.wikipedia.org/wiki/Dynamic_compilation, where code is recompiled with type information observed at runtime.
8:41:35
no-defun-allowed
Er, you use lld to see the libraries an executable depends on under Linux, right?
8:44:02
no-defun-allowed
Phew, lld told me to use ld.lld, which did not want anything to do with my SBCL image.
8:45:38
no-defun-allowed
srandon111: SBCL does create dynamically-linked executables, and there aren't any relevant arguments to save-lisp-and die that would cause it to create statically-linked executables. You might want to ask in #sbcl, but using the phrase "statically-linked executable" instead of "static compilation".
8:46:54
beach
ACTION could not, as usual, have guessed what was meant from the terminology that was used.
8:47:36
no-defun-allowed
I am hoping "static linking" and "dynamic linking" are more familiar? I don't usually discuss Unix executables.
8:48:53
beach
Speaking of which, I just noticed I have a signed copy of "Linkers and Loaders" by John Levine.
8:50:49
beach
I especially enjoyed the chapter on the consequences of dynamic linking in Unix to the complexity of the entire system, which GOTs and whatnot.
8:55:08
srandon111
no-defun-allowed, ok so you know no wy to create a statically-linked executable with sbcl ?
9:08:21
lotuseater
for commercial use cases implementations like LispWorks may have better built-in support for it
10:03:36
nij
Hello, I tried to loop over an array and collect some computed stuff into a 'tmplist using 'nconc.. but after evaluating the loop, 'tmplist remains its initial value. Why so? https://bpa.st/JYGQ
10:06:05
no-defun-allowed
You should use the return value of NCONC, and not use it "for effect". And you should not use destructive functions on quoted datum.
10:08:02
no-defun-allowed
Er, does M-q indent? I thought it wraps your text to 72 columns, which is ridiculous for code.
10:08:13
beach
But in fact, your entire IF expression is evaluated for side effect only as far as I can tell.
10:08:26
nij
no-defun-allowed: forgot how I set it up but it did some indenting while in lisp mode.. not optimal
10:09:16
no-defun-allowed
From memory, isn't "for n being the elements of" a SBCL extension for the extensible sequence protocol?
10:11:08
no-defun-allowed
(loop for n <some-iteration-keyword> sequence for nth-entry = ... for next-entry = ... when (friday-p nth-entry) collect ...)
10:11:36
no-defun-allowed
What is 'tmplist? I wouldn't expect evaluating (quote tmplist) to ever return a different value.
10:15:21
no-defun-allowed
You could write something like https://plaster.tymoon.eu/view/2188#2188 which doesn't require additional variables.
10:16:28
no-defun-allowed
I fear that it is a consing way of writing (loop for n below (1- (length spdata)))
10:16:44
no-defun-allowed
Hey, if spdata is a sequence, how would (- spdata 2) work in (make-seq (length (- spdata 2)))?
10:17:30
nij
no-defun-allowed: Yes there are many looping hack but it's the first time I'm using it.. I will come back and fix the style later.
10:17:55
no-defun-allowed
(There are many many bad styles.. any suggestions on styles would be appreciated to!)
10:19:48
no-defun-allowed
The description does not help my case, but it is usually considered bad style.
10:20:01
beach
no-defun-allowed: Isn't NCONC one of the functions with a mandatory side destructive side effect.
10:22:39
no-defun-allowed
I am wondering how you got anything to happen still, as (length (- spdata 2)) could not possibly return a value if SPDATA is an array.
10:26:08
nij
Now I should try to fix the style. As you suggested, no-defun-allowed, I should use "loop.. under" and "collect"?
10:26:45
mfiano
Yes this is undefined behavior, and bad style all over the place. But undefined behavior could do anything at all.
10:27:23
mfiano
'(0 0) is a list literal and the compiler can choose to do anything if you modify it.
10:27:45
beach
nij: "Undefined behavior" means that it may work on some implementations and not on others.
10:27:51
no-defun-allowed
nij: And on someone else's system, it is allowed to send them nasal demons instead.
10:28:03
mfiano
Or it may work on one implementation, and may not work at another time on the same implementation.
10:28:07
beach
nij: In this case, if you are using SBCL and you stick your code in a function it won't work the second time you run it.
10:28:36
no-defun-allowed
For the avoidance of doubt, that is not a very nice thing to send someone.
10:29:30
mfiano
Start by forgetting SETQ even exists, and use SETF. Secondly, make proper use of lexical variables. You do not need global state here.
10:29:41
no-defun-allowed
You could use (list 0 0) to create a fresh list, or (ideally, in my opinion) use COLLECT in LOOP to create the list. But the latter won't produce the (0 0) prefix.
10:31:29
no-defun-allowed
Oh, if you don't use COLLECT but you create a list (without cleverly holding a reference to the end of the list somewhere), appending to the end will result in O(n^2) time complexity.
10:34:47
nij
So.. lessons learned: 1. Use (list 1 1) instead of '(1 1) if it is to be modified. 2. Use 'collect and "loop .. below". 3. Use 'setf instead of 'setq.
10:38:00
Alfr_
nij, usually (nconc list lists) will modify list and you can skip the setf, but if list is nil, then list will still be nil and nconc's result may differ.
10:44:07
dim
mfiano: I think we can say this: setf is a macro that uses setq when needed, so any time you write setq, you can write setf and have the exact same effects ; then in some cases you can use setf where setq would not be supported
11:38:17
harlchen
whats the easiest way to only get local package warnings/errors on test-op's in (asdf:defsystem '.../tests ... ) instead of redefining of external defgenerics e.g. 'WARNING: redefining LOG4CL-IMPL::PROPERTY-ALIST in DEFGENERIC' and 'cl-fad.asd" contains definition for system "cl-fad-test". Please only define "cl-fad" and secondary systems ....' ?
13:59:41
minion
srandon111: look at sicp: The Structure and Interpretation of Computer Programs, a CS textbook using Scheme. Available under the CC-BY-NC Licence at <http://mitpress.mit.edu/sicp/> (HTML), <http://www.neilvandyke.org/sicp-texi/> (Texinfo), and <http://twb.ath.cx/ebooks/sicp.pdf> (PDF). Video lectures are available under the CC-BY-SA licence at <http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/>