I think map concat is a simpler approach:

CONSTANT: R2460 $[
    { "LL" "DL" "FWL" "BLL" "ULL" "LR" "VP" "MP" "LP" "AT" "VT" "SS" }
    [ 64 iota [ "%s[%02d]" sprintf ] with map ] map concat
]



On Wed, Sep 16, 2015 at 7:15 AM, Alexander Ilin <ajs...@yandex.ru> wrote:

> Hi, John!
>
>   Here's my code up to the map-flat point.
>
> : num>str ( n -- string )
>   number>string 2 CHAR: 0 pad-head ;
>
> : idx[] ( n -- string )
>   num>str "[" "]" surround ;
>
> : idx ( name n -- seq )
>   iota [ idx[] dupd append ] map nip ;
>
> : R2460 ( -- seq )
>   { "LL" "DL" "FWL" "BLL" "ULL" "LR" "VP" "MP" "LP" "AT" "VT" "SS" } [ 64
> idx ] map-flat ;
>
>   What I need is a list of strings containing
>   "LL[00]"
>   "LL[01]"
>   "LL[02]"
> ...
>   "LL[63]"
>   "DL[00]"
>   "DL[01]"
> ...
>   "DL[63]"
>   "FWL[00]"
>   "FWL[00]"
> ...
>   "FWL[63]"
> ...
>   "SS[63]"
>
>   This list after some more transformations becomes an XML configuration
> file for Matrikon OPC Explorer, and R2460 is one of the device types
> supported by my configuration generator in Factor.
>
> 16.09.2015, 17:00, "John Benediktsson" <mrj...@gmail.com>:
> > Hi Alexander,
> >
> > I'm not quite clear what functionality you are looking for, could you
> provide a quick example?
> >
> > Also, compiler.utilities isn't really a very public vocabulary so those
> things might change or move around depending on what the compiler needs are.
> >
> > Thanks,
> > John.
> >
> > On Wed, Sep 16, 2015 at 2:04 AM, Alexander Ilin <ajs...@yandex.ru>
> wrote:
> >> Hello!
> >>
> >>   When two functions (effectively) produce the same end result, I often
> prefer to use the one that is lighter on the computer resources.
> >>
> >>   The following two functions are equivalent in my use case:
> >>   map compose
> >>   map-flat
> >>
> >>   The latter one is from compiler.utilities, and it seems more
> complicated in its implementation than the former. Please, help me decide
> which is better performance- and memory-wise.
>
> ---=====---
> Александр
>
>
> ------------------------------------------------------------------------------
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to