Hello, John!

  Great!

  I wish that was mentioned in { $link tuple-constructors }.

  I now see there is >tuple, which could be equally useful.

  Thank you, John!

23.09.2015, 18:29, "John Benediktsson" <mrj...@gmail.com>:
> You can use slots>tuple.
>
> TUPLE: em id name path ;
> C: <em> em
>
> : make-em-all ( -- seq )
>   {
>     { 1 "x" "path" }
>     { 2 "y" "math" }
>     { 3 "z" "bath" }
>   } [ em slots>tuple ] map ;
>
> IN: scratchpad make-em-all .
> {
>     T{ em { id 1 } { name "x" } { path "path" } }
>     T{ em { id 2 } { name "y" } { path "math" } }
>     T{ em { id 3 } { name "z" } { path "bath" } }
> }
>
> On Wed, Sep 23, 2015 at 8:25 AM, Alexander Ilin <ajs...@yandex.ru> wrote:
>> Hello!
>>
>>   I'd like to return a sequence of tuples. How do I approach this?
>>   Here's what I tried (and failed) so far:
>>
>> TUPLE: em id name path ;
>> C: <em> em
>>
>> : make-em-all ( -- seq )
>>   {
>>     { 1 "x" "path" }
>>     { 2 "y" "math" }
>>     { 3 "z" "bath" }
>>   } [ <em> ] map ;
>>
>>   The problem here was that <em> expects three items on stack, but receives 
>> a sigle sequence object with three items inside.
>>   I tried to find a way to dump sequence onto the stack, but the following 
>> code failed to even compile due to stack effect reasons:
>>
>> ...
>> } [ [ dup ] each <em> ] map ;
>>
>>   Any advice? Basically, I wanted to declaratively setup a bunch of objects 
>> in a sort of init-word, put them onto stack as a sequence, and deal with 
>> them interactively afterwards, possibly saving to an Sqlite DB for future 
>> use.
>>
>> ---=====---
>>  Александр
>>
>> ------------------------------------------------------------------------------
>> 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


---=====---
Александр

------------------------------------------------------------------------------
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