freenode/#lisp - IRC Chatlog
Search
2:28:35
jmercouris
what's the reccomended way of working with trees in common lisp? do you guys roll your own structure every time?
2:29:59
jmercouris
it's a simple tree, but I want to be able to traverse in both directions, which is why I didn't really want to do it that way
2:31:07
Bicyclidine
"both ways" as in up and down? yeah, that's something i'd use something else for.
2:32:10
jmercouris
unfortunately I'm also looking for a non-binary tree implementation, most of them are binary only
2:34:30
jmercouris
I just want every node to have a children function to return all direct children, and a parent function to return the parent
2:34:57
jmercouris
aeth: yeah, I was thinking about using objects, an adjacency matrix would be too sparse
2:36:04
aeth
ways I can think of just now: lists (put a cons in the cdr), maybe a size 3 vector, a CLOS object, a struct object, even a lambda (more of a Scheme thing, though)
2:38:13
aeth
I tend to use structs. There is a downside, though. Some implementations don't like you recompiling structs.
3:19:21
neachdainn
jmercouris: That's me distinguishing between my text and code. Habit from other languages... Probably not the best in a Lisp context
3:19:58
aeth
Unfortunately you won't (afaik) be able to e.g. define an array type with deftype unless you have something more specific than number (which depends on the implementation).
3:22:01
aeth
That is, (upgraded-array-element-type 'number) will probably be T but (upgraded-array-element-type 'single-float) will probably be single-float. So you can work with arrays, but only if the elements are all of the same, implementation-supported type. (Almost all implementations will support many integer sizes and single-float and double-float)
3:23:54
neachdainn
I.e., (let (c (first mono) (x (rest (first mono)) (i (rest (rest (first mono)))))
3:26:07
aeth
Personally, I would use an array and use (elt foo 0) (elt foo 1) and (elt foo 2) but it probably doesn't matter at that size.
3:36:39
stylewarning
If I have foreign pointers wrapped in a struct, is there a way I can recreate these objects if I save an image?
3:36:40
aeth
If *foo* is special, I think (let ((*foo* 42)) (bar)) will change the *foo* within the function bar, if bar uses *foo*
3:37:11
stylewarning
I'm almost looking for a make-load-form but for executable saving of foreign data (in SBCL)
3:42:17
neachdainn
This is giving me the "X must be a number" error... I'm not sure why? https://pastebin.mozilla.org/9032357
4:21:46
alandipert
jmercouris does it still stack overflow if you remove the print calls from the top?
4:24:28
alandipert
no problem. i think i just successfully answered my first lisp question here, so thank you for the opportunity :-)
5:09:58
beach
nancy: It tells the compiler not to issue a warning when there is a variable that is defined but never used.
5:36:11
iqubic
Yesterday my ban was lifted. Today I appear to be banned from #emacs again. So, either freenode is screwing me over, or someone wants to keep me out of #emacs.