freenode/#lisp - IRC Chatlog
Search
2:25:23
pjb
Ok, so it's for a default path to some data. When you run your binary, that data file (in the quri source directory) may not exist anymore.
2:25:42
jmercouris
right yeah, that's exactly the problem, I wish it would have been just embedded in the code
2:26:20
pjb
You would have either to copy that data file as resources for your program, and then initialize *default-etld-names* at run-time to point to that copied resource file, or reset it to some default value such as "/dev/null".
2:26:55
pjb
Unfortunately, not lisp library programmers have ever generated executable images,so they don't all realize the special situation there.
2:28:52
pjb
It looks like this resource file is needed in any case, so you would have to package it and install it with your binary.
2:29:03
pjb
(defvar *default-etld-names* (asdf:system-relative-pathname :quri #P"data/effective_tld_names.dat"))
2:29:21
jmercouris
I don't need all of that logic though, I literally just need the ability to take "google.com" and turn it into http://www.google.com" if necessary
2:30:44
pjb
neachdainn: it's a convention to denote variables that will be bound by the pattern matching function.
2:39:09
pjb
(well, perhaps there was already something like that in NSS, but let's say that LISP is the child of NSS and FLPL).
2:45:07
neachdainn
So, don't tell me totally how to do this, but what's a hint for how I could find a pattern in a list of items
2:50:04
neachdainn
My career is in robotics - almost all of my programming is C/C++. Lisp is something I'm trying to learn
2:52:26
pjb
But what you want is to define a function that can distinguish symbols whose name starts with "?" and the other symbols.
2:56:28
pjb
(defun simple-match (pattern list) (mapcan (lambda (pattern item) (cond ((variable-symbol-p pattern) (list (list pattern item))) ((eql pattern item) '()) (t (match-fail pattern item)))) pattern list)) (simple-match '(on ?a ?b) '(on the table)) #| --> ((?a the) (?b table)) |#
2:56:52
neachdainn
So, if I'm reading this correctly, variable-symbol-p return T if the first char of symbol is '?', and nil otherwise. Right?
2:56:56
pjb
Of course, it must be more sophisticated: when you have collected all the bindings, you must check they are unified. You cannot have both (?a the) and (?a a) in the result!
2:57:57
pjb
You will have functions for repeated matches, optional matches, alternative matches, etc…
2:58:59
pjb
The macro would be more sophisticated, since it'd do compile-time work to expand to a let with the bindings…
3:00:09
neachdainn
I think that's getting far more sophisticated than my fourth Lisp function needs to be. Hahah
3:35:29
neachdainn
Is there a way to zip lists? E.g., (zip '(1 2 3) '(4 5 6)) => ((1 4) (2 5) (3 6))
4:22:32
minion
beach, memo from Bike: there are instructions for converstions between float types but no primops/asts; i was going to add them with two types so you'd write like (cleavir-primop:coerce single-float double-float x). also, there's one for "unboxed integers", does this mean fixnums with tag shifted out to take advantage of machine instructions?
4:32:10
drmeister
I should (1) identify the minimal set of generic functions that may need their call histories edited to remove entries that have selectors that match the redefined class and and remove those entries and (2) I should invalidate the dispatchers for those generic functions.
4:33:28
drmeister
I need to invalidate the dispatchers because their code contains the old stamp for the class.
4:34:07
beach
And you can either recompute the dispatcher on the fly, or you can set it so something that will.
4:34:32
drmeister
Honestly, I've been wracking my brains for hours why I might need to remove the entries from the call history - I can't recall. I also can't recall how to obtain the minimal set of generic functions that need invalidation. I was wondering if you could point me in the right direction.
4:37:38
drmeister
ensure-class-using-class calls the function that invalidates dispatchers that are effected by the class change.
4:38:11
drmeister
How does that function use specializer-direct-generic-functions given the class PRETTY-STREAM to get the generic function INITIALIZE-INSTANCE.
4:38:45
drmeister
Do I accumulate all of the generic functions that are specializer-direct-generic-functions of the class-precedence-list of PRETTY-STREAM?
4:39:11
drmeister
Because the only specializer that INITIALIZE-INSTANCE is a specializer-direct-generic-functions of is (find-class 'T)
4:39:51
drmeister
I can't recall why I was removing the call history entries - if I don't have to that is a relief and I will stop trying.
4:41:21
drmeister
As I said - I don't recall - it's just there in my code that I do it - but I wrote no comment why I was doing it. I wrote a fair amount of code to achieve it - so I assumed there was a reason. If there is no reason - then I will remove the code.
4:42:22
drmeister
That being said - it seemed harmless to remove the entries - because they would be added back in the next dispatch miss.
4:42:25
beach
Certainly, when a class is redefined so that its class precedence list changes, then whether some methods are applicable or not to a particular signature may change.
4:43:11
beach
And not only the entries for a particular class that is being modified, but also for all of its subclasses.
4:44:22
drmeister
But see what I wrote above about not finding all of the generic functions that needed to be updated when I simply append together the results of calling specializer-direct-generic-functions on the subclasses of the specializer.
4:45:12
beach
I think you need something similar to SPECIALIZER-DIRECT-GENERIC-FUNCTIONS but that keeps track of what is in the call history instead.
4:46:46
beach
I think you need a function called (say) SPECIALIZER-CALL-HISTORY-GENERIC-FUNCTIONS that takes a class and returns a list of all generic functions that specializer in its call history.
4:50:16
drmeister
Yes - that is what I need to write - I'm trying to figure out how to do it efficiently.
4:50:38
drmeister
I could search every generic function - that's a no-brainer - I was looking for something a bit more ... focused.
4:52:48
drmeister
Would that be better than calculating it on the fly? In the worst case it's a loop over all call-histories for every generic function.
4:53:24
drmeister
I can get every generic function by calling specializer-direct-generic-functions on every class - bleh.
4:54:20
drmeister
But maybe better than keeping specializer-call-history-generic-functions up to date?
4:58:28
drmeister
Nope - no reasons - just anxiety over updating state like specializer-call-history-generic-functions would require. Especially in a multi-threaded environment - every specializer will need a lock won't it?
5:03:03
drmeister
I'm just exploring options. I'm starting to warm to the idea of maintaining a specializer-call-history-generic-functions and a mutex to protect it in each class.
5:04:26
drmeister
There are only two functions that modify call histories in Clasp, one that adds to them and another that removes from them.
5:05:55
drmeister
I talked with scymtym about his implementation - he doesn't handle class changes yet. Interestingly - he doesn't use integer stamps. He uses the address of sbcl's 'layout' object in some sbcl mode where layouts don't move in memory.
5:27:04
drmeister
Well, I'm off to bed. I'll think about specializer-call-history-generic-functions and probably implement it tomorrow.
12:54:05
drmeister
What is the relationship between specializers and classes? There is a specializer class and class classes.
13:03:01
drmeister
Huh is right. Adding slots to specializer slides all of the class slots indices up.
13:41:05
drmeister
I do have it in two places - it's in C++ and it's in Common Lisp. There is a sanity check that causes the build to fail if the information gets out of sync.
14:06:18
beach
If you can make a sanity check, why can't you automatically generate one of the instances?
14:09:47
beach
A significant fraction of my time is spent coming up with techniques to avoid having a particular piece of information in more than one place.
14:11:44
beach
No, I think the opposite would be a maintenance nightmare, especially for people coming after me.
14:19:23
beach
I meant: No, I think having a particular piece of information in more than once place would be a maintenance nightmare, especially for people coming after me.
14:20:38
scymtym
ACTION thinks beach is talking about duplication in source code while ralt is talking about duplication at runtime (hence "caching")
14:21:21
beach
scymtym: You are definitely right that I am talking about duplication in source code.