freenode/lisp - IRC Chatlog
Search
9:21:07
beach
[sigh] Another library to extract, improve, document, and test. But that's a good thing I think. This time, it's from Gsharp. It splits a sequence into optimal subsequences. And it can do it incrementally as the original sequence is modified.
9:43:07
malice
More precisely, my objective is to change one of the object's slots, but I don't really know what the interface is.
9:48:55
beach
malice: This one ↑ gives you a list of the methods that have a particular specializer.
9:49:57
beach
Because a method might be applicable to a subclass that does not appear explicitly as a specializer.
9:54:41
malice
beach: Yes, I always forget about the nomenclature. I learned OOP first in C++, so I often call it methods (since there are no generic functions in C++).
10:06:49
malice
beach: I am sorry, but I am unable to find this information. How do I provide specializer?
10:17:03
beach
Also, this is MOP stuff, not Common Lisp HyperSpec stuff, so you will either need to :USE the MOP package, or provide an explicit package prefix.
10:27:12
beach
malice: Also, "it does not work" is not very helpful. It is best to provide the error message, or the incorrect output that you observe.
10:31:26
malice
beach: but I didn't really know what arguments to use. find-class was exactly what I needed. Thank you.
10:32:06
malice
If I want all the methods, should I also map the #'specializer-direct-generic-functions over all superclasses and their superclasses?
11:01:11
rk[ghost]
aye.. and it also has, a reasonable hyperlink schema.. so i can likely find what i want by mangling the url with the right fucntion name
11:02:05
rk[ghost]
i do not know any PHP (nor have any interest), but if you want any help with your project i could set aside some cycles..
11:03:44
phoe
rk[ghost]: I will, thanks! I need to fix my real life up a bit more and then I'll probably get back to working on CLUS.
11:08:36
rk[ghost]
i am also at the point of fixing up my `real life`, but i should be migrating within a couple weeks and stablized within a month likely
15:08:55
phoe
Lisp is an interactive programming language and SLIME is a toolkit that allows the programmer to leverage this.
15:16:37
pjb
slime contains a nice debugger that works the same with all the implementations, so you don't have to learn the debugger of each implementation.
16:16:23
beach
Ah, the one on CLOS programming. More than one year. The first one to come out is called "Concrete and Abstract Data Types with Algorithms".
16:17:16
beach
I use self publishing. It gives better margins and I don't have to listen to the crap of a publisher.
16:20:29
beach
I use a self-publishing company that uses print-on-demand technology, so there is no bulk cost associated with a book. Just a per-unit cost.
16:26:59
beach
The interesting part about the book on data types is that I implemented and tested all my data types and all my algorithms in Common Lisp and wrote a translator that converts the Common Lisp code to something that looks more like a traditional algorithmic language.
16:27:37
beach
The advantage is that 1. the algorithms can be tested. 2. People who are allergic to parentheses can still buy the book.
16:30:52
beach
Either they were written by people who don't know that pointers exist, so they use integers and tables in their algorithmic language.
16:31:14
beach
Or they are written by people who have not followed the evolution of computer architectures for the past decades.
16:32:18
beach
Apparently, the majority of books on the subject get something simple like binary search wrong.
16:34:00
beach
One question is what happens if there is no object corresponding to the one being searched for.
16:34:20
beach
The other is that the published algorithms make many more key comparisons than are needed.
16:35:29
beach
And the book makes things more realistic. Existing books assume that all objects are integers.
16:36:15
beach
So readers of traditional books don't see the difference in cost between a key comparison and an index comparison in terms of cost. Both are integers after all, right?
16:38:17
beach
For "stack" they either suggest a list, so if you have a stack of DNA letters, you waste 64 bits for each bit represented.
16:38:46
beach
Or else they suggest an array, which blows real-time properties because you have to re-allocate when it is full and there is no bounded size for that.
16:40:18
beach
I refer to whether I can realistically suggest such a data structure in a library without being ridiculed, and I don't think so.
18:01:24
samlamamma
I'm in the debugger after a break, I wanna check the value of a dynamic variable. How do I do so? Is there a way of getting a REPL while in the SLIME debugger?
18:06:56
|3b|
hit i on one of the backtrace entries to "inspect in frame" and enter the variable name (probably including package), or e to "eval in frame", d for "pprint eval in frame"
18:24:00
pjb
samebchase: dynamic variables may have different bindings in different threads. If you want to inspect the value in the thread that is in the debugger, use e on the frame where you want to evaluate the expression.
18:49:14
learning_
I want to do (+ "hello" "world") => "helloworld" i tried defining + as a generic function but i get "Error: The function + is defined as something other than a generic function." When continued, the image removes the previous definition for + at which point lisp breaks because it can't do addition lol.
18:52:11
pjb
(defun your-package:+ (&rest args) (if (every 'numberp args) (apply (function cl:+) args) (do-whatever-you-want args)))
18:54:48
pjb
https://gitlab.com/com-informatimago/com-informatimago/blob/quicklisp/common-lisp/invoice/invoice.lisp#L399
18:55:22
pjb
In this file, we define a dispatching reader macro #m to read money amounts in specific devises.
18:56:09
pjb
https://gitlab.com/com-informatimago/com-informatimago/blob/quicklisp/common-lisp/invoice/invoice.lisp#L180
18:57:20
learning_
ok. sorry for the slow response just took me a while to understand. had to play around with it in the terminal. that's really cool
18:58:30
pjb
That's the advantage of IRC over phone or video: there's a level of asynchronism that is well adapted to these kind of technical discussions.
18:59:10
pjb
Notice that there's already a concatenate function: (concatenate 'string "hello" "world") #| --> "helloworld" |#
19:00:06
pjb
(defun ! (&rest string-designators) (apply (function concatenate) 'string (mapcar (function string) string-designators))) (! :hello #\space "world") #| --> "HELLO world" |#
19:00:49
pjb
It the first programming language I learned, the concatenation operation was denoted with infix ! "Hello"!" "!"world!" --> "Hello world!"
19:04:03
learning_
i used a lambda. i didn't know apply could be used like that. (reduce (lambda (a b) (concatenate 'string a b)) args)
19:06:02
pjb
Actually, there's a little problem as I used it: if we pass more than (- call-arguments-limit 2) arguments to !, then it's possible that an implementation break on this apply call.
19:07:50
learning_
but won't the number of args passed to concatenate be limited by the number of args passed to !
19:07:55
pjb
Since we can pass call-arguments-limit arguments to !, and I prefix one argument for concatenate, concatenate may receive (1+ call-arguments-limit) arguments, which would break.