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


Groups > comp.lang.forth > #49228

Let's play golf

From "WJ" <w_a_x_man@yahoo.com>
Newsgroups comp.lang.forth
Subject Let's play golf
Date 2016-07-19 11:29 +0000
Organization A noiseless patient Spider
Message-ID <nml2tv$bfm$1@dont-email.me> (permalink)

Show all headers | View raw


Task:

Convert "Cat ate mouse." to "Mouse ate cat.", using
chop, split, reverse, join, capitalize, and
string-concatenation.

"Cat ate mouse.".chop
    ==>"Cat ate mouse"
"Cat ate mouse.".chop.split
    ==>["Cat", "ate", "mouse"]
"Cat ate mouse.".chop.split.reverse
    ==>["mouse", "ate", "Cat"]
"Cat ate mouse.".chop.split.reverse.join(" ")
    ==>"mouse ate Cat"
"Cat ate mouse.".chop.split.reverse.join(" ").capitalize
    ==>"Mouse ate cat"
"Cat ate mouse.".chop.split.reverse.join(" ").capitalize + "."
    ==>"Mouse ate cat."

Can it be shorter in ANS Forth?

-- 
If confirmed, Garland would be the fourth Jewish justice on the nation's
highest court, which is comprised entirely of Jews and Catholics. The three
current Jewish members of the Supreme Court are Ruth Bader Ginsburg, Elana
Kagan, and Stephen Breyer.
www.jta.org/2016/03/16/news-opinion/united-states/obama-to-name-jewish-federal-judge-to-supreme-court

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


Thread

Let's play golf "WJ" <w_a_x_man@yahoo.com> - 2016-07-19 11:29 +0000
  Re: Let's play golf hughaguilar96@gmail.com - 2016-07-19 14:07 -0700
    Re: Let's play golf "HAA" <someone@microsoft.com> - 2016-07-21 18:31 +1000
    Re: Let's play golf Doug Hoffman <glidedog@gmail.com> - 2016-07-22 08:59 -0400
      Re: Let's play golf hughaguilar96@gmail.com - 2016-07-22 14:04 -0700
        Re: Let's play golf Doug Hoffman <glidedog@gmail.com> - 2016-07-23 03:19 -0400

csiph-web