Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #20350

SP-Forth: reduce or fold a list

From "WJ" <w_a_x_man@yahoo.com>
Newsgroups comp.lang.forth
Subject SP-Forth: reduce or fold a list
Date 2013-03-06 18:11 +0000
Organization A noiseless patient Spider
Message-ID <kh80t5$ec8$1@dont-email.me> (permalink)

Show all headers | View raw


REQUIRE list-all ~ygrek/lib/list/all.f
list ALSO!
REQUIRE RANDOMIZE ~af/lib/random.f

0 VALUE biglist

: reduce-test
  \ Build list of 9999 random integers.
  %[ 9999 0 DO  5000 CHOOSE %  LOOP ]%
  TO biglist
  S" Length of list is " TYPE  biglist length .
  \ Sum the list.
  0 biglist ['] + iter
  CR S" Sum of list is " TYPE  .
  biglist free
;

reduce-test
Length of list is 9999
Sum of list is 25009246  Ok

Back to comp.lang.forth | Previous | NextNext in thread | Find similar | Unroll thread


Thread

SP-Forth: reduce or fold a list "WJ" <w_a_x_man@yahoo.com> - 2013-03-06 18:11 +0000
  Re: SP-Forth: reduce or fold a list "Charles Childers" <crc@retroforth.org> - 2013-03-06 16:42 -0500
  Re: SP-Forth: reduce or fold a list "WJ" <w_a_x_man@yahoo.com> - 2013-03-06 23:24 +0000
    Re: SP-Forth: reduce or fold a list "WJ" <w_a_x_man@yahoo.com> - 2013-03-06 23:50 +0000

csiph-web