Hey Alex, Hey John,
Thanks for your great explanations! They are really helpful!
Best regards,
Marc
Am Freitag, 16. Januar 2015 schrieb John Benediktsson :
> You almost got it right in your original question, and you found the
> answer, but I wanted to explain further what was broken:
>
> This will break the same way your first version did:
>
> IN: scratchpad { "factor" "is" "awesome" } 0 [ length + ] each
>
> The problem is if you look at the stack effect for ``each``, it expects
> the sequence and then the quotation to be on the stack expressed as the
> stack effect ``( seq quot -- )``, and the quotation expects the current sum
> and the element on the stack ``( sum elt -- newsum )``. You can fix it a
> couple ways:
>
> IN: scratchpad { "factor" "is" "awesome" } 0 swap [ length + ] each
>
> IN: scratchpad { "factor" "is" "awesome" } 0 [ length + ] reduce
>
> IN: scratchpad { "factor" "is" "awesome" } [ length ] map-sum
>
> etc.
>
> Best,
> John.
>
>
>
> On Fri, Jan 16, 2015 at 7:27 AM, Marc Hanisch <marc.hani...@googlemail.com
> <javascript:_e(%7B%7D,'cvml','marc.hani...@googlemail.com');>> wrote:
>
>> Thanks,
>>
>> USING: io.directories.search io.files.info
>> home f recursive-directory-files [ link-info size>> ] map sum
>>
>> did it! Better idea is to test with a small directory ;-)
>>
>> Best regards,
>> Marc
>>
>> 2015-01-16 15:19 GMT+01:00 mr wzrd <wzr...@gmail.com
>> <javascript:_e(%7B%7D,'cvml','wzr...@gmail.com');>>:
>>
>>> On 01/16/2015 04:46 AM, Marc Hanisch wrote:
>>> > I'm trying to create a word which recursive loops over all files in a
>>> > directory and sums the filesizes. I entered the following steps into
>>> > the listener:
>>> Try this ...
>>>
>>> home f recursive-directory-files [ link-info size>> ] map sum
>>>
>>> - mrw
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
>>> GigeNET is offering a free month of service with a new server in Ashburn.
>>> Choose from 2 high performing configs, both with 100TB of bandwidth.
>>> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
>>> http://p.sf.net/sfu/gigenet
>>> _______________________________________________
>>> Factor-talk mailing list
>>> Factor-talk@lists.sourceforge.net
>>> <javascript:_e(%7B%7D,'cvml','Factor-talk@lists.sourceforge.net');>
>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>
>>
>>
>>
>> --
>> ★ Esperanto - Lingvo internacia ▪ http://www.esperanto.de ▪
>> http://www.esperanto.berlin ★
>>
>>
>> ------------------------------------------------------------------------------
>> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
>> GigeNET is offering a free month of service with a new server in Ashburn.
>> Choose from 2 high performing configs, both with 100TB of bandwidth.
>> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
>> http://p.sf.net/sfu/gigenet
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> <javascript:_e(%7B%7D,'cvml','Factor-talk@lists.sourceforge.net');>
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>
--
★ Esperanto - Lingvo internacia ▪ http://www.esperanto.de ▪
http://www.esperanto.berlin ★
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk