Re: I wonder if I'm missing something...
"Marco Antoniotti (as marco dot antoniotti at unimib dot it)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <CAG0Nw2nOi1HCa2OGbTK6i3U_Ltc4EE5qBn0jO1pJ_+zadGKKhw@mail.gmail.com> |
Hi everybody... interesting (and still unresolved after decades: we are getting old) issue. I have recently wor... ahem, wasted an inordinate amount of time on Emacs Lisp. I had to deal with similar issues and eventually used the bindat library, which I found interesting w.r.t. its interface. Any thoughts about it? All the best Marco On Sat, Nov 8, 2025 at 10:19 AM Tim Bradshaw (as tfb at tfeb dot org) < [email protected]> wrote: > I think your approach is equivalent to mine except: > > - the transducers are explicitly symbols rather than opaque objects which > the implementation gets to define (and there are potentially hundreds of > distinct ones) > > - 'it should also support custom data types' turns it from a small soluble > problem to a huge one with no general solution at all. > > On and the displaced array thing: (a) ick, just no, (b) this already > solves David's problem (just make the displaced array be an array of > (unsigned-byte 8)s and write-sequence does what you want. > > If you want C I hear that C compilers are quite commonly available now. > > --tim > > > On 7 Nov 2025, at 20:01, Yuri Davidovsky <[email protected]> wrote: > > > > > > > >> On 7 Nov 2025, at 20:21, Tim Bradshaw <[email protected]> wrote: > >> > >> Here is a sketch (which I may have mentioned here previously) of how > functionality could be added to CL which would enable fast I/O of, for > instance, vectors of floats without destroying the language by allowing > arbitrary type punning, and also dealing with things like ensuring things > are written in defined byte orders. > > > > Interesting. I was thinking of something different. Essentially any byte > stream could be read (and written to) arbitrary data types using primitives > like: > > > > (read-byte stream) — as is now. > > (read-byte stream :uint32) — will read an unsigned 32 bit int. > > (read-byte stream :float) — you start to get the idea. > > > > You could do the same with read-sequence by supplying the type of data > to read and an array of appropriate type. It should also support custom > data types. > > > > Also when creating a displaced array it should allow casting to a > different type. > > > _______________________________________________ > Lisp Hug - the mailing list for LispWorks users > [email protected] > http://www.lispworks.com/support/lisp-hug.html > -- Marco Antoniotti, Professor, Director tel. +39 - 02 64 48 79 01 DISCo, University of Milan-Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY REGAINS: https://regains.disco.unimib.it/