[erlang-questions] Printed list to Erlang function

Felix Gallo felixgallo@REDACTED
Tue Mar 29 19:14:30 CEST 2016


if you don't mind massaging your text file into erlang term format, then
you could use file:consult() to pull it into erlang in a fairly nice and
seamless way.  If your list might get big, your disk storage is slow, or
you might check it at a high rate of speed, you might cache the result of
file:consult in ETS and check that before loading from disk.

F.

On Tue, Mar 29, 2016 at 9:59 AM, <lloyd@REDACTED> wrote:

> Hello,
>
> So, I have a printed list of stop words:
>
> http://www.ranks.nl/stopwords
>
> I'd like to turn this list into an Erlang function that I can query---
>
> stopwords() ->
>    ["word1", "word2" ... "wordN"].
>
> is_stopword(Word) ->
>    List = stopwords(),
>    lists_member(Word, List).
>
> All my efforts so far have evolved into ugly kludges. Seems to me there
> must be an elegant method that I'm overlooking.
>
> Some kind soul point the way?
>
> Many thanks,
>
> LRP
>
> *********************************************
> My books:
>
> THE GOSPEL OF ASHES
> http://thegospelofashes.com
>
> Strength is not enough. Do they have the courage
> and the cunning? Can they survive long enough to
> save the lives of millions?
>
> FREEIN' PANCHO
> http://freeinpancho.com
>
> A community of misfits help a troubled boy find his way
>
> AYA TAKEO
> http://ayatakeo.com
>
> Star-crossed love, war and power in an alternative
> universe
>
> Available through Amazon or by request from your
> favorite bookstore
>
>
> **********************************************
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160329/a0e0f32b/attachment.htm>


More information about the erlang-questions mailing list