Looks really good. Thanks for another great library!

On 23 November 2010 21:12, Moritz Ulrich <ulrich.mor...@googlemail.com>wrote:

> I would go for the vector. It's easier than writing (ordered-map ...) all
> the time. If you want to generate structs dynamically, you would even simply
> create a vector of alternating pairs and do (apply ordered-map my-vec).
>
> Btw: Great library! I think I will rewrite my binary-parser from a project
> of mine to use this library!
>
>
> On Tue, Nov 23, 2010 at 9:24 PM, Zach Tellman <ztell...@gmail.com> wrote:
>
>> Good question.  The solution didn't make the cut for my initial
>> release, but will be added soon.  My plan is to have an (ordered-
>> map ...) frame which encodes and decodes the keys in the given order.
>> So for C interop, the frame would be
>>
>> (ordered-map :a :int16, :b :float32)
>>
>> An alternative would be to just turn any vector which is alternating
>> keys and types into an ordered-map, but that seems a bit too magical.
>>
>> Zach
>>
>> On Nov 23, 12:12 pm, Chris Perkins <chrisperkin...@gmail.com> wrote:
>> > On Nov 23, 12:03 pm, Zach Tellman <ztell...@gmail.com> wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > When writing Calx [1], I discovered it was a huge pain to deal with
>> > > mixed C datatypes in Java.  When writing Aleph [2], I discovered the
>> > > problem increases by a factor of ten when dealing with streams of
>> > > bytes.  In an attempt to alleviate my own pain, and hopefully help a
>> > > few other people out, I've written Gloss, which can transform a simple
>> > > byte-format specification into an encoder and streaming decoder.
>> >
>> > > A full writeup can be found athttps://github.com/ztellman/gloss/wiki.
>> >
>> > > A few people have already asked me how this differs from protocol
>> > > buffers, so I'll preemptively answer that protocol buffers are a fixed
>> > > format that cannot be used to interface with external systems.  Gloss
>> > > is less performant than protocol buffers, but is also much less picky
>> > > about formats.
>> >
>> > > If anyone has any questions, I'd be happy to answer them.
>> >
>> > Looks very useful, Zach. Thanks.
>> >
>> > I have a question.
>> >
>> > I have only taken a quick look, so maybe I'm misunderstanding the
>> > intent, but it's not clear to me how you would use this for sending
>> > and receiving structured data from, say, a C program.
>> >
>> > Taking your example from the wiki:
>> >
>> > (def fr (compile-frame {:a :int16, :b :float32}))
>> >
>> > Let's say I want to talk to a C program that speaks in structs, like
>> > this:
>> >
>> > struct Foo { short a; float b; }
>> >
>> > The problem is, the C program cares about order - the short comes
>> > before the float. How does the Clojure program know what order I need
>> > the fields in, since I have specified the format with a map; an
>> > unordered data structure? Is there another way to specify a structure
>> > where order of the fields matters? If so, why have two ways of doing
>> > it? Or am I just missing something?
>> >
>> > Thanks,
>> >
>> > - Chris
>>
>> --
>> 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<clojure%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>
>
> --
> Moritz Ulrich
> Programmer, Student, Almost normal Guy
>
> http://www.google.com/profiles/ulrich.moritz
> BB5F086F-C798-41D5-B742-494C1E9677E8
>
> --
> 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<clojure%2bunsubscr...@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 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

Reply via email to