Hi Mark,
One other comment, you mentioned not knowing yet how to define tuple
classes in custom syntax. Here's an approach to learning how parts of
Factor like that work.
1) You can see how TUPLE: is defined:
IN: scratchpad \ TUPLE: see
USING: classes.tuple classes.tuple.parser ;
IN
Hi Mark,
You can pretty much do anything you want, defining a tuple class is
relatively simple. I'm not a huge fan of making magical words (meaning
creating "read-scData" is a side effect and you can't grep the source tree
for it, but that might be okay for your use case).
Below is one way where
That is amazing and does actually make sense to me.. Thanks! Can the
syntax expression define the tuple too? I see there is a compiler word for
that but I'm not sure how to fit it in.
--
Download BIRT iHub F-Type - The Fre
A different approach that is more self-documenting might be to use
accessors instead of a boa-constructor (perhaps just a tad less efficient,
although likely not that you'd ever notice):
scData new
test "SC" get-chunk first {
[ 4 7 bsread-string >>creator ]
[ 4 7 bsread-str
Thanks very much for your help. I'm now getting into unpacking data
structures from the bitstreams, but this is getting me some horrible code,
to whit stuff like this:
TUPLE: scData creator type ver num name reverb-character reverb-prelpf
reverb-time reverb-delay reverb-predelay reverb-level
re
1. What else are mailing lists for? :)
2. John's suggestion is good (to just rework the program), but in the
future / other situations, it may also make sense to look into the right
dataflow combinator (
http://docs.factorcode.org/content/article-dataflow-combinators.html). For
instance, instead o
Well, you have a few things you could try off the top of my head for that:
4 7 bitreader bsread-string
8 7 bitreader bsread-string
[ [ 4 7 ] dip bsread-string ]
[ [ 8 7 ] dip bsread-string ] bi
[ 4 7 rot bsread-string ]
[ 8 7 rot bsread-string ] bi
[ 4 7 8 7 ] dip [
That's very helpful, but the thing is that what I really want to do is to
pull a series of fields from the bitreader and store them in a tuple via
boa. Something like bitreader [ 4 7 bsread-string ] [ 8 7 bsread-string ]
tri boa . The problem is that to do that I need a version of bsread-string
tha