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


Groups > comp.lang.forth > #60212

Re: Forth's list : the multo.

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject Re: Forth's list : the multo.
Date 2017-06-03 01:49 +0000
Organization Aioe.org NNTP Server
Message-ID <ogt4ir$bq8$1@gioia.aioe.org> (permalink)
References (2 earlier) <87r2z5odge.fsf@nightsong.com> <d1763bd2-6fb8-46aa-9bfb-23afa972d64b@googlegroups.com> <d9fe7e35-1144-4837-90be-2c3a278c9308@googlegroups.com> <1e9243f9-d63c-4c8c-aa42-e7ff394f99b0@googlegroups.com> <bbe432b5-c68a-4c54-b475-a9af7ffa1fed@googlegroups.com>

Show all headers | View raw


On 5/31/2017, NN wrote:

> Examples such as map, filter and fold allow you to
>   replace loops and control structures with functions.

Let's split that on non-word characters.

(define words
  (string-split
    "Examples such as map, filter and fold allow you to
    replace loops and control structures with functions."
    #/\W+/))

words
 ===>
("Examples" "such" "as" "map" "filter" "and" "fold" "allow" "you"
 "to" "replace" "loops" "and" "control" "structures" "with" "functions" "")

Remove any empty strings:

(define words (filter #/./ words))

words
 ===>
("Examples" "such" "as" "map" "filter" "and" "fold" "allow" "you"
 "to" "replace" "loops" "and" "control" "structures" "with" "functions")

The lengths of the words:

(map string-length words)
 ===>
(8 4 2 3 6 3 4 5 3 2 7 5 3 7 10 4 9)


Average word length:

(/ (fold + 0 (map string-length words)) (length words))
 ===>
5


-- 
Professor Goldman ... claimed that he and "most historians" regarded history
as a "weapon" to be used for "determining people's ideas and attitudes."
 --- Revilo P. Oliver, "The Price of the Head"

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


Thread

Forth's list : the multo. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-30 11:22 +0200
  Re: Forth's list : the multo. minforth@arcor.de - 2017-05-30 07:34 -0700
  Re: Forth's list : the multo. Julian Fondren <julian.fondren@gmail.com> - 2017-05-30 10:57 -0700
  Re: Forth's list : the multo. lehs <skydda.barnen@gmail.com> - 2017-05-30 11:13 -0700
    Re: Forth's list : the multo. Paul Rubin <no.email@nospam.invalid> - 2017-05-30 21:30 -0700
      Re: Forth's list : the multo. lehs <skydda.barnen@gmail.com> - 2017-05-30 22:09 -0700
        Re: Forth's list : the multo. Julian Fondren <julian.fondren@gmail.com> - 2017-05-30 23:25 -0700
          Re: Forth's list : the multo. lehs <skydda.barnen@gmail.com> - 2017-05-31 01:36 -0700
            Re: Forth's list : the multo. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-31 10:49 +0200
              Re: Forth's list : the multo. lehs <skydda.barnen@gmail.com> - 2017-05-31 02:16 -0700
                Re: Forth's list : the multo. Paul Rubin <no.email@nospam.invalid> - 2017-06-01 01:11 -0700
                Re: Forth's list : the multo. NN <november.nihal@gmail.com> - 2017-06-01 03:55 -0700
                Re: Forth's list : the multo. foxaudioresearch@gmail.com - 2017-06-02 07:33 -0700
                Re: Forth's list : the multo. obi65537@gmail.com - 2017-06-02 11:15 -0700
          Re: Forth's list : the multo. lehs <skydda.barnen@gmail.com> - 2017-05-31 01:38 -0700
            Re: Forth's list : the multo. NN <november.nihal@gmail.com> - 2017-05-31 03:29 -0700
              Re: Forth's list : the multo. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-31 11:18 -0500
              Re: Forth's list : the multo. "Robert L." <No_spamming@noWhere_7073.org> - 2017-06-03 01:49 +0000
                Re: Forth's list : the multo. Julian Fondren <julian.fondren@gmail.com> - 2017-06-02 20:46 -0700

csiph-web