Hey Tzach, If I understand what you're trying to do, you want something like this:
[ :uint32 :ubyte ;; or bit-seq, depending (delimited-block (prefix uint24 #(- % 5) #(+ % 5))) ] And then you'll need to parse the final block separately. I've left defining the uint24 as an exercise for the reader (sorry, long day), but using (compile-frame [:uint16 :uint8] ...) should be pretty straightforward. Hope that helps, happy to answer any followup questions. Zach On Saturday, January 3, 2015 11:51:14 PM UTC-8, Tzach wrote: > > I'm trying to work with Gloss binary encoder/decoder, and need some help > to kick start. > > My first task is simple(not for me ;) > I have the following binary buffer to read/write: > > - 4 byte (32 bit) - code (uint) > - 8 bit - misc flags > - 3 byte (24 bit) - the entire buffer length > - 4 byte (32 bit) uint value - optional, depending on on of the flags. > - List of 4 byte (uints) data elements - size dependent on the overall > size > > How should I represent this structure? > Clearly I need to use *prefix* and *repeated* for the last element, but I > failed to understand how. > I also struggle with the optional element and how to represent a 3 byte > element. > > Thanks! > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.