freenode/lisp - IRC Chatlog
Search
15:22:42
python476
right now I'm off computing (electronics), a bit before that I was trying to write a tiny lisp in pascal :)
15:24:58
beach
I was working for a company that had a rule that everything had to be written in Pascal.
15:27:25
malice`
I also wanted to get clever with format and do something like (format t "~{~A~}~%" (make-list 25 :initial-element #\=)) but that's longer
15:51:57
p_l
malice`: ... somehow I got from there to (princ (make-array 15 :element-type 'standard-char :initial-element #\=))
16:04:31
malice`
I have a tree. I want to provide a generic function that would allow for using a function on each element of the tree (let's call it maptree). I also want for the user to be able to provide the traversal method from the default - e.g. in-order, post-order, ... - or instead pass a custom function that would walk the tree.
16:06:08
malice`
I think that's quite okay; however, my concern is that I define it as a generic function, but traversal methods might be different for different classes (some class might want to have a method with e.g. :fast traversal implemented that would be unique to it), but documenting the method isn't that useful in CL imho, then documentation isn't helpful on the matter of traversal method. Is my concern valid?
16:07:35
phoe
what you describe looks like a name collision for two classes that want the :fast keyword to mean different things
16:08:20
malice`
I define a general "trie" class, then "standard-trie" (or something like that) that derives from trie
16:08:27
phoe
malice`: that's what my question meant; good, then you can freely use generic functions.
16:08:57
malice`
that would behave a little bit different with its keys, and write new methods for them
16:10:13
malice`
I was thinking more of a scenario where e.g. standard-trie has (:default) as list of possible traversal methods
16:10:26
malice`
and someone implements nonstandard-trie which has (:default :fast) as traversal methods
16:11:13
phoe
(defmethod traverse ((tree randomly-sorted-tree) (traversal-method default-traversal)) ...)
16:11:27
phoe
(defmethod traverse ((tree randomly-sorted-tree) (traversal-method run-around-in-circles)) ...)
16:17:00
pjb
malice`: have a look at the two tree posts referenced from http://informatimago.com/articles/usenet.html#Forms--Lists--Trees--and-Data-Types
16:25:11
Bike
you can define a normal fnction like that and then have it pass its arguments to a generic function, though
16:26:53
malice`
pjb: I looked at them. This looks nice and I might consider defining the methods by means of walk-tree, but I would like to provide a simpler interface to the methods
16:44:10
otjura
is there a way to pass arguments to lisp scripts when running like sbcl --scripts foo.lisp
17:34:44
fiveop
`(defun foo ()\n "bar\n(baz)"\nnil)` (with \n proper line breaks) causes problems with indentation (after the doc string) and with top-level form recognition of slime (e.g. with C-c C-c), because of the doc string line starting with a (
18:50:59
shrdlu68
I have a logging function in a library, and I want to give users the option to define their own function to do logging. From what I've gathered so far, this is done using generic functions, where the users specialze the said function. Is this conventional? Would simply redefining the function work?
18:56:19
Grue`
yeah, a downstream project can redefine any function in your library. i do that sometimes
18:58:34
Grue`
for example if you change the api and user's function is not compatible with your library anymore
18:58:51
Bike
references to #'foo would still be the old function. another library could redefine something and then a user would want to redefine it themselves while letting the other library ocntinue to work
19:05:55
shrdlu68
Above, I meant that the function will reside within a specific package, so it wouldn't cause conflict with other libraries and such.
19:09:51
Bike
What I'm saying is you have two systems that both use your library and both want to redefine the function so they can use your logger.
20:24:14
holycow
AeroNotix: what would it take to add numbered link shortcuts like in conkeror to lispkit?
20:30:16
emaczen
phoe: I guess not... loop is really good, but I get the thoughts that it isn't complete
20:31:57
emaczen
you can loop over vectors with (loop ... across ....) but I'm only aware of returning with collect
20:34:56
Bike
accumulating a vector means repeatedly resizing it, which is less than efficient. map can figure out the size before it calls anything
22:53:45
holycow
AeroNotix: amazing work on lispkit dude. finally had time to actually use it. amazing what you guys managed to do with a small bit of code
23:12:13
AeroNotix
holycow: thanks! I need to find time to work on it more. Let me know what issues you come across.
23:12:53
AeroNotix
e.g. if there are things in conkerer you are missing, some features aren't implemented like I would like. The link higlighting for example
23:18:46
holycow
AeroNotix: overall, only two things really would help and i can drop conkeror: lispkit hangs often (it looks like a thread hangs, i can still switch to a tab and browse a lot of times) and link hints. outside of that totally there.
0:07:32
AeroNotix
The hangs are pretty much why I stopped working on it so much. I think the hangs are due to the link hints.