freenode/#lisp - IRC Chatlog
Search
17:01:33
jasom
one of my former profs had a great article on how to insult CS researchers. https://www.cs.purdue.edu/homes/dec/essay.criticize.html
17:08:01
jasom
I took a class taught by him after spending two summers working on ATM (the protocol, not the bank machine) switches; his shelf looks like this: https://www.cs.purdue.edu/homes/dec/books.html ... there may have been some culture clash there.
17:25:15
dim
PAIP also introduces a notion of Data Driven Programming that has nothing to do whatsoever to https://en.wikipedia.org/wiki/Data-driven_programming ; are there other public references to the idea?
17:30:22
dim
“This style of programming is called date-driven programming, because the data (the list of rewrites associated with a category) drives what the program does next. It is a natural and easy-to-use style in Lisp, leading to concise ans extensible programs, because it is always possible to add a new piece of data with a new association without having to modify the original program.” PAIP, p. 41
17:31:12
dim
I would like to compare that to proper database modeling, so public references of the same idea (not the one in the wikipedia page with the same name) would be good. Ideas?
17:43:02
didi
How would you write a ZIP function that continues until it consumes the largest list? e.g. (zip '(1 2) '(3)) => '((1 3) (2))
17:43:03
_death
dim: the wikipedia article is pretty bad, but I wouldn't say the two notions have "nothing to do whatsoever" with each other
17:45:17
dim
table-driven is more like what I had in mind apparently, from a couple refs on the top of a google search, thx
17:47:13
jasom
didi: if it were fixed arity it's easy enough: (loop for a on l1 b on l2 while (or a b) ...)
17:48:40
dim
didi: create an extended list/array of the right size first? make-array ... then replace?
17:49:38
jasom
didi: non-fixed arity (loop for lists = args then (mapcar #'cdr lists) while (member-if-not #'not lists) ...)
17:50:46
jasom
didi: untested, but possibly complete: (loop for lists = args then (mapcar #'cdr lists) while (member-if-not #'not lists) collect (mapcar #'car (remove nil lists))
17:53:55
jasom
the fact that it worked on the first try without me even opening it in emacs to write it makes me think it's not too bad
17:54:49
jasom
I'm open to suggestions for "contains at least one non-nil" tests that are less cute than (member-if-not #'not ...)
17:56:05
jasom
line by line: "set lists to all of the lists, then the cdr of all of the lists" "while there is no item in the list for which #'not returns false" collect the car of all non-nil lists
17:58:43
jasom
until (every #'null lists) might also be a clear test; open to suggestions for which is better
17:59:57
jasom
A well written loop should read quite closesly to how you would explain what the code does, and I think this follows that rule.
18:11:46
mfiano
(some #'identity '(nil nil nil "contains at least 1 non-NIL" 1 2 3)) => "contains at least 1 non-NIL"
18:15:03
jasom
http://paste.lisp.org/display/355759#3 ; "set lists to args then the cdr of each arg" "while lists contains some non-nil items" "collect the car of all non-nil items"
18:16:35
jasom
didi: yeah, and performence is likely not a concern since you're not going to be zipping up hundreds of lists (I hope)
18:17:57
jasom
and it's reasonable to assume that the lists will be similar in size, so just one test for the majority of iterations
18:56:00
didi
I've read PCL's chapter on conditions and restarts many times, but I think this is the first time I will actually use the feature.
19:45:37
phoe_
you can (STRING-TO-OCTETS string :EXTERNAL-FORMAT :UTF-8) and this will produce a sequence of bytes for you that you can then dump into a file.
21:17:08
jmercouris
hello everyone, I'm having a strange error using clos: https://pastebin.com/EVfTeSbP
21:17:31
jmercouris
it says unknown initialization option :X, but I have defeined :initarg X in my class
21:18:35
green_
question: I am creating a stand-alone lisp app with buildapp (which dumps an sbcl image). The application needs the contents of a file at runtime. I would like to load that file into a variable at compile time so it will be built into the image, and I don't have to read it at runtime. I've tried variations of eval-when, but just get mystery errors.. any pointers on how to accomplish this?
21:19:39
Bike
(defvar *file*) (eval-when (:compile-toplevel) (setf *file* (read-in-contents))) sorta thing
21:32:29
Shinmera
green_: shouldn't just regular defvar work too? I mean, the sources of your application are LOADed before the image is dumped.
21:42:25
green_
Shinmera, oh, you mean (defvar *FILECONTENTS* (read-file-contents)) ? I ... guess........... hmm.. yes?
21:44:39
Shinmera
Well, when else would the variable receive its value except at its latest at load time
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 :-)