Thanks, Doug!

That's really elegant. This sort of thing is why I'm switching from
Common Lisp to Factor.

Larry

On Tue, Aug 16, 2011 at 8:01 PM, Doug Coleman <doug.cole...@gmail.com> wrote:
> You can do something like this:
>
> : stats>item-info ( stats -- item-info)
>    { 0 1 3 } swap nths \ item-info slots>tuple ;
>
> Doug
>
> On Tue, Aug 16, 2011 at 4:57 PM, Larry Coleman
> <all.are.wond...@gmail.com> wrote:
>> This works, but I'm pretty sure it's not idiomatic factor, and I'll
>> need to do something similar at least twice more, so there must be a
>> better way:
>>
>> TUPLE: item-info longitude latitude speed ;
>>
>> C: <item-info> item-info
>>
>> : stats>item-info ( stats -- item-info )
>>    {
>>        [ 0 swap nth ]
>>        [ 1 swap nth ]
>>        [ 3 swap nth ]
>>    } cleave <item-info> ;
>>
>> So what is the idiomatic way to get a items out of an array based on a
>> sequence of indexes?
>>
>> Thanks in advance,
>>
>> Larry Coleman
>>
>> ------------------------------------------------------------------------------
>> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
>> user administration capabilities and model configuration. Take
>> the hassle out of deploying and managing Subversion and the
>> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to