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


Groups > comp.lang.forth > #20174

Re: Filtering

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From "Charles Childers" <crc@retroforth.org>
Newsgroups comp.lang.forth
Subject Re: Filtering
Date Sat, 02 Mar 2013 11:18:40 -0500
Organization ForthWorks
Lines 33
Message-ID <op.wtbt9eof6ef20b@denney-2466a6df> (permalink)
References <kgsasr0ibq@enews6.newsguy.com>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Content-Transfer-Encoding 7bit
Injection-Info mx05.eternal-september.org; posting-host="5b20b174a0794e5496b0041dfb3a55de"; logging-data="18286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LL01vZvgiPVaBK2KAFNyP"
User-Agent Opera Mail/12.13 (Win32)
Cancel-Lock sha1:K6l3UMAwyf90UYyEhk7tPHJW7xc=
Xref csiph.com comp.lang.forth:20174

Show key headers only | View raw


On Sat, 02 Mar 2013 02:48:43 -0500, WJ <w_a_x_man@yahoo.com> wrote:

> Given a sequence of numbers, keep those that are odd and
> multiply them by 100.
>
> Factor:
>
>
> USE: sequences.extras
>
> { 1 1 2 3 5 8 13 21 } [ odd? ] [ 100 * ] filter-map
> { 100 100 300 500 1300 2100 }


Parable:

[ #1 #1 #2 #3 #5 #8 #13 #21 ] array-from-quote
[ odd? ] array-filter [ #10 * ] array-map


Retro:

needs array'
needs math'
with| array' math' |

create results 100 allot
new{ 1 1 2 3 5 8 13 21 }
[ dup odd? [ 100 * @results results + 1+ ! results ++ ] ifTrue ] apply
results display


-- crc

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


Thread

Filtering "WJ" <w_a_x_man@yahoo.com> - 2013-03-02 07:48 +0000
  Re: Filtering mhx@iae.nl (Marcel Hendrix) - 2013-03-02 11:17 +0200
  Re: Filtering "Charles Childers" <crc@retroforth.org> - 2013-03-02 11:18 -0500
    Re: Filtering "A. K." <akk@nospam.org> - 2013-03-02 17:55 +0100
      Re: Filtering Marc Olschok <nobody@nowhere.invalid> - 2013-03-03 22:11 +0000

csiph-web