Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #56446
| From | "Robert L." <No_spamming@noWhere_7073.org> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Collections processing |
| Date | 2017-03-29 11:51 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <obg732$1g3p$1@gioia.aioe.org> (permalink) |
| References | <47e67d0c-b5b7-4c2a-8fce-551956ad05d6@googlegroups.com> |
On 3/11/2017, franck.bensusan@gmail.com wrote:
> 0 #+ [ 1, 2, 3, 4, 5 ] apply .
> 15 ok
Ruby:
[1, 2, 3, 4, 5].reduce :+
==>15
>
> 0 #isUpper #[ drop 1+ ] "AbCdEf" applyIf .
> 3 ok
"AbCdEfGHI".scan(/[[:upper:]]/).size
==>6
> #yourself [ 12, 13, 15, 16 ] maxFor .
> 16 ok
[12, 13, 15, 16].max
==>16
>
> #yourself "kqjskdoAKJqjs" maxFor .
> 115 ok
"kqjskdoAKJqjs".each_byte.max
==>115
>
> #[ 5 mod ] [ 12, 13, 15, 16 ] maxFor .
> 13 ok
[12,13,15,16].max_by{|n| n.modulo 5}
==>13
>
> #yourself [ "abcd", "abce", "adca" ] maxFor .
> adca ok
%w(abcd abce adca).max
==>"adca"
>
> #last [ "abcd", "abce", "adca" ] maxFor .
> abce ok
%w(abcd abce adca).max_by &:reverse
==>"abce"
>
> 0 #[ second + ] { "aaa" : 1.2 , "bbb" : 2, "ccc" : 1.4 } apply .
> 4.6 ok
{aaa: 1.2, bbb: 2, ccc: 1.4}.reduce(0){|x,(k,v)| x+v}
==>4.6
{aaa: 1.2, bbb: 2, ccc: 1.4}.values.reduce :+
==>4.6
>
> "" #[ first + ] { "aaa" : 1.2 , "bbb" : 2, "ccc" : 1.4 } apply .
> aaabbbccc ok
{aaa: 1.2, bbb: 2, ccc: 1.4}.keys.join
==>"aaabbbccc"
--
[T]he number of Jews killed there was 800,000,000.... [T]he Talmud makes it all
clear by informing us that the blood of the holocausted Jews ran to the sea in
a huge tidal wave that swept boulders in its path and was so deep that it
reached the nostrils of the Romans' horses.
nationalvanguard.org/2014/09/disillusioned-part-1/
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
Collections processing in Oforth franck.bensusan@gmail.com - 2017-03-11 04:56 -0800
Re: Collections processing in Oforth minforth@arcor.de - 2017-03-11 05:27 -0800
Re: Collections processing in Oforth franck.bensusan@gmail.com - 2017-03-12 01:41 -0800
Re: Collections processing in Oforth hughaguilar96@gmail.com - 2017-03-12 20:03 -0700
Re: Collections processing in Oforth hughaguilar96@gmail.com - 2017-03-11 15:36 -0800
Re: Collections processing in Oforth franck.bensusan@gmail.com - 2017-03-12 03:49 -0700
Re: Collections processing in Oforth Ron Aaron <rambamist@gmail.com> - 2017-03-12 13:02 +0200
Re: Collections processing in Oforth franck.bensusan@gmail.com - 2017-03-12 05:06 -0700
Re: Collections processing in Oforth Ron Aaron <rambamist@gmail.com> - 2017-03-13 08:05 +0200
Re: Collections processing in Oforth franck.bensusan@gmail.com - 2017-03-13 05:25 -0700
Re: Collections processing in Oforth Ron Aaron <rambamist@gmail.com> - 2017-03-13 15:29 +0200
Re: Collections processing in Oforth hughaguilar96@gmail.com - 2017-03-12 20:01 -0700
Re: Collections processing "Robert L." <No_spamming@noWhere_7073.org> - 2017-03-29 11:51 +0000
csiph-web