Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #23600
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: how to osrt 5 numbers |
| Date | 2013-06-14 15:20 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <kpfcb7$958$1@dont-email.me> (permalink) |
| References | <b58af4d3-e05e-43bf-b867-fcf763655bf3@googlegroups.com> <kgoipn01jja@enews2.newsguy.com> |
WJ wrote:
> the_gavino_himself wrote:
>
> > 5 3 33 22 333 smallest to largest
> >
> > I have not mastered shallow stack!
> >
> > How is this done?
>
> Factor:
>
> USE: make
>
> : sort5 ( a b c d e -- seq )
> ! Move the numbers into a sequence.
> [ , , , , , ] { } make
> [ <=> ] sort ;
Ruby:
[5, 3, 33, 22, 333].sort
==>[3, 5, 22, 33, 333]
[5, 3, 33, 22, 333].sort_by{|n| -n}
==>[333, 33, 22, 5, 3]
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar
Re: how to osrt 5 numbers "WJ" <w_a_x_man@yahoo.com> - 2013-06-14 15:20 +0000 Re: how to osrt 5 numbers the_gavino_himself <visphatesjava@gmail.com> - 2013-06-16 01:42 -0700
csiph-web