Re: I wonder if I'm missing something...
"Tim Bradshaw (as tfb at tfeb dot org)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
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