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 [ bsread-string ] curry 2bi@

    [ 4 7 8 7 ] dip '[ _ bsread-string ] 2bi@

    dup '[ 4 7 _ bsread-string 8 7 _ bsread-string ] call

I would use whichever felt simplest and most descriptive to what was
actually happening.  If you run into places where stack shuffling seems
awkward, locals are not a bad solution necessarily, or fried quotations,
and sometimes its a combination of finding abstraction that might work
(e.g., curry 2bi@) and changing the order of stack effect operations.

An example on that last one is ``nth`` which is ( n seq -- elt ).  There
are plenty of times that you feel the need to use ``swap nth``, which feels
awkward, but it is the less common case that the sequence is under the
index.

Best,
John.





On Sun, Dec 14, 2014 at 8:54 AM, Mark Green <m...@antelope.nildram.co.uk>
wrote:
>
> 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
> that takes the bitreader argument as the deepest rather than the
> shallowest, and I don't see any way of doing that (other than using locals)
> because it's hard to reach down 3 steps on the stack. Is there any way of
> doing this?
>
> Mark
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to