libera/#commonlisp - IRC Chatlog
Search
1:44:59
NotThatRPG
jeosol: I have looked at a lot of Fare's code and it is superhuman. His ability to keep track of the idiosyncrasies of all the different implementations is astounding.
1:46:37
jeosol
@NotThatRPG: I agree with you. I started asking him questions many years ago, and even now that he moved to Gerbil scheme, he is still able to give me good pointers regarding asdf and poiu. His advice and pointers have been helpful
3:21:05
beach
cheers: With respect to SICL, I don't like to give estimates. You should definitely not try it yet. Most of the code is written. Register allocation is done. Code generation is next. And there are some parts of bootstrapping that still need to be designed.
3:30:20
jeosol
I was in the weeds a few weeks ago, looking into parallel build with poiu and google's bazelisp systems - the latter too heavy from what I told by goggle guys
3:31:08
jeosol
beach: I started delving more deep into program internals, following some MIT courses, and one topic with Julia about auto-boxing at all. I then remember your callsite optimization paper
3:35:52
beach
It's a strange feeling in that I execute SICL code every day, so most of the code has been "tested" in that it goes through the bootstrapping steps that we currently have. Yet, we have no executable to show to the world yet.
3:38:09
beach
I mean, the bootstrapping code does some pretty essential stuff like all the MOP machinery of computing effective slots, class precedence lists, effective methods, and discriminating functions. And it does this for a large number of generic functions.
3:42:47
beach
And SICL uses the MOP machinery everywhere, because only a handful of classes are not standard classes. SICL classes such as SYMBOL, PACKAGE, ARRAY, are all standard classes. And functions such as EQUAL and EQUALP, and also all the slot accessors like SYMBOL-NAME etc. are generic functions.
3:43:00
beach
I know _death said EQUAL and EQUALP should not be extensible, but they are written this way for reasons of modularity.
3:45:03
jcowan
I understand why not: if you are allowed to add methods to EQUALP, you break its contract.
3:45:06
beach
Not that large actually. Currently, the bootstrapping code consists of around 4kLOC, including a GUI-based backtrace inspector.
3:46:52
beach
And the bootstrapping code contains a lot of duplication that we will eventually get rid of.
3:54:07
jeosol
@beach: Great list of things that have been implemented. This will help the language see some resurgence in some fashion given it could be a good general base for the other implementations (with time) and development efforts can be pushed in other directions
3:54:51
jcowan
As an example, NUMBERP's signature is "numberp object => generalized-boolean". You don't want to permit a method on it that maps pairs to T, or worse yet to "What, me worry?"
3:55:07
jcowan
so anything with that signature or a related signature needs to be considered for sealing.
3:55:33
beach
jeosol: Thanks. Yes, I think I need to make the bootstrapping technique applicable to other implementations.
3:58:15
Bike
nothing. that's my interpretation of "you have to seal every function from T to generalized-boolean"
3:58:35
Bike
like, "for every function with an argument of type T and return value of type generalized boolean, that function must be sealed"
3:59:04
jcowan
On the other hand, if you want to add classes that actually represent numbers (quaternions, Gaussian integers, etc.) you may indeed want to unseal NUMBERP to include them.
4:00:13
Bike
several have extended sequences, but i dunno if there are ones with other stuff like that
4:01:54
Bike
but on the other hand if you could do that it might screw up safety, which you don't want
4:02:03
Bike
like if a compiler definition gets out of sync with the actual runtime definition or something
8:13:51
flip214
Help, please. What's the difference between these forms? (intersection r l) (remove-if-not (lambda (l) (member l r)) l)
8:14:14
flip214
r and l are lists of structures; the first form returns the expected 10 results, the second only 6 values.
8:43:38
pjb
(let ((r '(1 2 3 4 1 2 3)) (l '(3 4 5 6 4 5))) (values (intersection r l) (remove-if-not (lambda (l) (member l r)) l))) #| --> (3 4 3) ; (3 4 4) |#
8:44:56
pjb
What is missing is only (defun seq-equal (a b) (and (subsetp a b) (subsetp b a))) ; perhaps more efficiently.
8:44:58
gin
Need some advice with this code: https://plaster.tymoon.eu/view/2558 - I am comparing two approaches here. (1) ex-1: A single LET for all lexical variables. (2) ex-2: Multiple nested LETs for defining lexical variables only where they are needed.
8:45:39
pjb
a set-equal function would make it more concrete that there's a set type based on list, like subst and copy-tree make it clear there's a tree type based on lists.
8:47:07
gin
pjb: If I assume compiler can optimize things out, then I can stick with ex-1 where a single LET contains all lexical variables, couldn't I?
8:47:55
beach
gin: It is not a question of compiler optimizations. It is a matter of how much code the person reading your code has to consider for an occurrence of the variable.
8:47:57
gin
beach: thanks! I was thinking that too. But then does it bother anyone that it may lead to multiple nested-LETs making the code harder to parse with eyes? Or is that not a valid concern?
8:52:28
gin
beach: thanks! I have mentioned in comments at the top that I am making a contrived example to compare my LET-approaches. could not make a more sensible example. I understand that LOOP COLLECT is appropriate here and COUNT is not required.
8:54:04
_death
gin: the nested LETs make it easier to pull the forms out into their own function, for example.. they also make it easier for the reader to know the value of the bindings, considering the alternative is a variable that changes over time
8:54:26
beach
(loop for article in articles for newline-position = (position #\Newline article) collect (subseq article 0 newline-position)) with appropriate newlines inserted.
8:57:34
beach
gin: A general rule of programming is that a function should do one single thing. The computation of the length makes the function do two things, which is not good.
8:58:26
beach
gin: You might see that more easily if you consider this function as also computing the reverse of the list, the Fibonacci number of the length, etc.
9:05:08
beach
So you must already know those rules, i.e., minimize the scope to make life easier for the person reading your code, and make each function do one thing.
9:31:40
gin
thanks shka. Is that true in general too? does it take constant time for any proper sequence?
9:34:01
beach
gin: If you think about how lists are represented, you can see that it has to traverse every CONS cell as shka is saying, so there is no way it can be O(1).
9:36:39
beach
gin: And if you don't know how lists are represented, it is time to learn that part. Otherwise, may things will likely confuse you in the future.
9:38:06
beach
... like why (defun push-it (element list) (push element list)) won't "work" as expected.
9:40:04
beach
shka: Indeed. But a significant number of newbies here don't seem to find it useful to read about things like that.