freenode/#lisp - IRC Chatlog
Search
6:27:01
Harag1
aeth: that is the only reason i use any methods ... to give the chance to tweak/customize
6:29:07
Harag1
aeth: I dont need to dispatch on type for this project, was just curious for another project... but that is a long way from ready for quicklisp.... if ever
6:38:37
aeth
Harag1: AoS ("arrays of structs") pattern isn't particularly efficient in CL, SoA ('structs of arrays") pattern can be very efficient, if you can use :element-type (mostly numeric/character types). Obviously, a C programmer named those patterns
6:43:35
ggole
AoS gives you all the elements of the struct close together in memory, which is great if you are going to be touching all/most of them
6:44:42
aeth
ggole: CL doesn't have AoS, though, because it would be semantically difficult to have :element-type on an instance of a standard- or structure-class
6:45:06
aeth
It's possible that implementations could implement it as a separate data structure, though
6:45:19
Grue`
don't worry about portability, just wait until someone sets up a SBCL-only quicklisp, that's what I do
6:51:29
aeth
ggole: they could, as long as the array itself was immutable (not necessarily the structs contained within
6:52:22
aeth
of course, to usefully work with them, you'd need some sort of scheme to handle that sort of thing... You'd probably want to preallocate it to a fixed size, but make it adjustable, and to delete from the middle, the simplest solution is to copy the last element into the element you're removing
6:52:33
aeth
the problem with that is that there's no copy-into constructor generated by structures, only copy
6:52:34
ggole
That would still be a problem, since initialising the array with preexisting structs couldn't copy them into place without losing identity
6:56:00
ggole
Note that the existing choices of array element types avoid those problems by a combination of immutability of elements and explicit license in the standard about the behaviour of eq on those types.
6:58:17
aeth
ggole: you'd need GC support for it... because you'd want to create the struct with the array, but you'd also want to be able to reference it, and GC it if no reference exists to it directly, or to the array indirectly
7:07:58
Harag1
beach: so when you have multiple .asd files do you put them in the projects main directory or with the module/extension code in their own directories?
7:08:13
aeth
ggole: The thing that makes it complicated is that (struct-aref foo 42) wouldn't always refer to the same thing if you wanted it to be a useful array concept. It could be invalid, it could be the same thing, or it could be a new thing. and (struct-aref foo 42) is probably isn't too far from 42*sizeof(your_foo_struct) in memory... so you'd need to be aware that the pointer could move all of the time
7:17:53
jackdaniel
aeth: I don't think there would be much utility in such agreement. most implementations already have reasonable limits above dictated by a standard, so we could put artificial flag: this is the minimum on the lowest one
7:18:11
jackdaniel
but nothing guarantees that Newly Implemented Lisp (NIL) doesn't have lower limits
7:18:56
jackdaniel
so from practical standpoint you already have such guarantees, from theoretical enforcement of it wouldn't be "de facto" standard but would rather require making a new standard
7:20:06
jackdaniel
but I take it as a compliment about approachability, thanks ;) that said there are other implementers here who do not shy away from being approached
7:27:59
pjb
aeth: struct or arrays implies copying the structures into the arrays. Therefore if you want to put the same structure in two places in the arrays, you end with 2 copies. You could use an array of indices into the arrays of the structure of arrays to place the same structure index at two or more places in the array of indices.
7:44:13
aeth
jackdaniel: well, yes, but it would be conforming in the same sense that an implementation without bordeaux-threads or
7:45:53
MichaelRaskin
I think CFFI uses #+implementation-name, which means that a really fresh implementation won't have CFFI
7:47:01
jackdaniel
aeth: as I said, from factual point of view all implementations have reasonable defaults, so they are indeed conforming to this imaginary requirement
7:47:25
jackdaniel
as MichaelRaskin said libraries are a different story, they are portability layers
7:48:12
jackdaniel
I think ABCL settles at a minimum wrt array dimensions, but I don't remember that well enough to be sure
7:54:22
aeth
MichaelRaskin: right, that was my point, that it would just be a thing that's expected but obviously not required
7:55:35
MichaelRaskin
I would say we also have a problem here, that you cannot meet that expectation immediately even if you implement FFI and threads in a way existing implementations do.
8:04:36
jackdaniel
de facto standard is something like pln extension (in constrast to portability layer)
9:04:44
refpga
Hi, do labels allow me to use local variables defined (outside but) within the same (parent) function?
9:05:49
refpga
so if I use labels to define functions within a let body, can I use the variables I defined using let, inside the labels functions?
15:01:55
gjvc
could someone point me at an example for reading very simple (not deeply nested) xml from a stream (file on disk) and dumping the resulting lisp form (total beginner here)
15:05:02
beach
gjvc: I would imagine the technique would be recursive descent, and similar to the code in a different language.
15:09:41
p_l
gjvc: I'd recommend using cxml, and maybe for actually doing something with the data, cxml-stp as it gives a nice recursive interface
15:12:22
moldybits`
why cxml, btw? it's easy to find a list of xml libraries, but it's hard to tell them apart.
15:13:09
p_l
moldybits`: it had pretty complete XML support, and it has cxml-stp as well as other (dom, etc) interfaces, plus a bunch of other code (I think xuriella xpath library works with it)
15:13:30
p_l
I'm aware of newer libraries, but for me cxml is kinda "tried and trusted" solution I take first when it comes to xml
15:14:38
moldybits`
i couldn't figure out how to specify the path to the dtd in cxml, so i ended up using plump which supposedly is more "lenient". (note: i'm a complete newbie wrt to xml)
15:16:23
p_l
(XML Schema isn't, and I find it superior in its limitations on what could be done with schema)
15:37:08
p_l
either I parsed XML differently in the past (lost source :( ) or I forgot how I specified dtd
15:39:11
p_l
had to download the dtd to home directory, but got this to pretty much output me a serialized form in S-expressions:
16:26:27
jgkamat
In case anyone was curious to my question yesterday, you need to have ps:lisp return a valid ps string, so (ps:lisp (push 'list my-list)) works for lists
17:31:39
p_l
my example included loading the DTD for apparently CXML didn't deal well with HTTP URIs in DTD specs
17:33:45
gjvc
yep got that and all working instaling into a project-local .quicklisp/ directory -- it's very neat
17:34:17
gjvc
i also have sbcl running via a bash wrapper to read the project-local sbcl initialisation file to make it take note of said project-local .quicklisp/ directory
17:39:05
gjvc
I have no interest in bootstrapping from them every run, given that the data is so simple
17:40:00
gjvc
but this is a more educational approach that just doing a big search and replace. (although i could write something in python to read the xml and emit lisp hmmm ...:-))
17:40:25
p_l
gjvc: then I think STP might offer a simple interface to rewrite them into whatever you want (it provides something akin to recursive descent where you plug your functions using STP methods to do things)
17:53:15
rumbler31
ok, I'm too dumb for this apparently. I want to generate and write a very long string to a file, constructed letter by letter. (dotimes (i large) (write #\E)) writes #\E, I am looking for the character itself to be read without the #\. Various attempts have failed. I suppose I could just use (format... but I'd like to learn what is going on here
17:54:31
rumbler31
assumption that was false is that I need to print pretty. that doesn't change the output unless I invoked it wrong
17:55:19
rumbler31
I assume that #\ is necessary for the reader to treat the form as a character and not a sybmol
17:57:00
pmai
FWIW write is very flexible, you can specify what you want using the keyword args or through the normal printer variables
17:57:52
rumbler31
write-char... of course. Also fwiw I was having a hard time understanding how the various flags to write relate to make thi shappen