<div dir="auto">I had thought about doing something like that, except about 80% of the time the words in the file won't have a delimitor such as in "theblueskythegreenearth" but I still need to be able to count "the" or the ordered sequence of [ t, h, e ] within such a character string (or [ b, l, u, e ] or whatever)<div dir="auto"><br></div><div dir="auto">Again, thank you for your time & thanks in advance.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 22, 2021, 4:03 AM <<a href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Beginners mailing list submissions to<br>
<a href="mailto:beginners@haskell.org" target="_blank" rel="noreferrer">beginners@haskell.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:beginners-request@haskell.org" target="_blank" rel="noreferrer">beginners-request@haskell.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:beginners-owner@haskell.org" target="_blank" rel="noreferrer">beginners-owner@haskell.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Beginners digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Count Words from File (A. Mc.)<br>
2. Re: Count Words from File (Francesco Ariis)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 21 Jan 2021 09:49:03 -0800<br>
From: "A. Mc." <<a href="mailto:47dragonfyre@gmail.com" target="_blank" rel="noreferrer">47dragonfyre@gmail.com</a>><br>
To: <a href="mailto:beginners@haskell.org" target="_blank" rel="noreferrer">beginners@haskell.org</a><br>
Subject: [Haskell-beginners] Count Words from File<br>
Message-ID:<br>
<CAOsti3mkiq+z=<a href="mailto:cC3ZSGsKUmZsF7jivpTkNcyACRfYC01ExPPtg@mail.gmail.com" target="_blank" rel="noreferrer">cC3ZSGsKUmZsF7jivpTkNcyACRfYC01ExPPtg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello,<br>
<br>
I apologize in advance if this is crossposting. My IRC client did not<br>
appear to be working properly.<br>
<br>
I am new to Haskell and I need to find a way to count specific words in a<br>
file. File could contain spaces between words, no spacing, uppercase,<br>
lowercase, etc so I've standardized it to once the file is taken in,<br>
convert to lowercase and remove the spacing. I've also read the postings<br>
about using ByteString instead of [Char] so I am trying to use that. But,<br>
as it still seems to either view all elements as fused or each letter as<br>
individual, I'm not entirely sure how to tackle this. The input after<br>
transforming would be something like "theblueskyisveryblue" for uniformity<br>
and would need to count "the" and "blue". Feels like I should be able to<br>
do a map and foldr(?) but I'm not sure how to get Haskell to recognize<br>
'the' for example and not count all the t's, h's, e's etc in the file, nor<br>
am I entirely sure how to properly compose a map-fold for character arrays<br>
like this.<br>
<br>
Thanks in advance and thank you for your time.<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.haskell.org/pipermail/beginners/attachments/20210121/56633de9/attachment-0001.html" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/pipermail/beginners/attachments/20210121/56633de9/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 21 Jan 2021 18:53:12 +0100<br>
From: Francesco Ariis <<a href="mailto:fa-ml@ariis.it" target="_blank" rel="noreferrer">fa-ml@ariis.it</a>><br>
To: <a href="mailto:beginners@haskell.org" target="_blank" rel="noreferrer">beginners@haskell.org</a><br>
Subject: Re: [Haskell-beginners] Count Words from File<br>
Message-ID: <20210121175312.GA23139@extensa><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
Il 21 gennaio 2021 alle 09:49 A. Mc. ha scritto:<br>
> I am new to Haskell and I need to find a way to count specific words in a<br>
> file. File could contain spaces between words, no spacing, uppercase,<br>
> lowercase, etc so I've standardized it to once the file is taken in,<br>
> convert to lowercase and remove the spacing. I've also read the postings<br>
> about using ByteString instead of [Char] so I am trying to use that. But,<br>
> as it still seems to either view all elements as fused or each letter as<br>
> individual, I'm not entirely sure how to tackle this. The input after<br>
> transforming would be something like "theblueskyisveryblue" for uniformity<br>
> and would need to count "the" and "blue". Feels like I should be able to<br>
> do a map and foldr(?) but I'm not sure how to get Haskell to recognize<br>
> 'the' for example and not count all the t's, h's, e's etc in the file, nor<br>
> am I entirely sure how to properly compose a map-fold for character arrays<br>
> like this.<br>
<br>
Have you considered using `words`?<br>
<br>
λ> :t words<br>
words :: String -> [String]<br>
λ> words "Chiare, fresche e dolci acque"<br>
["Chiare,","fresche","e","dolci","acque"]<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Beginners Digest, Vol 150, Issue 10<br>
******************************************<br>
</blockquote></div>