A Pythonista's Impressions of Erlang
Wed Jan 12 09:33:00 CET 2005
I think either string:stubstr/2,3 (that can operate on
any-element-lists as well), or lists:split/2 can do
what you want.
By the way, the 'string' module has got a lot of
C-style string handling functions. Many of them do
not bother about the list elements being characters.
When doing a quick readthrough of 'string' it seems as
words/1,2, sub_word/2,3, left/2,3, and right/2,3
require that the elements are integers. I do not
see why this requirement could not be relaxed.
(Corrado Santoro) writes:
> Dominic Williams wrote:
> > Given what is already in the lists module,
> >> a="Hello, World"
> >> a[5:-3] --> ", Wo"
> > slice("Hello, World", 5, -3) -> ...
> > must be a one- or two-liner.
> why not including such a function in "lists"?
> > Why bother with the syntactic sugar?
> I agree :-))
> Eng. Corrado Santoro, Ph.D.
> University of Catania - Engineering Faculty
> Department of Computer Science and
> Telecommunications Engineering
> Viale A. Doria, 6 - 95125 CATANIA (ITALY)
> Tel: +39 095 7382380 Fax: +39 095 7382397
> +39 095 7382365
> +39 095 7382364
> Personal Home Page:
> NUXI Home Page:
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions