Streams and Strings

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Streams and Strings

Alex Peake
Is there any concept of a Stream on a String, or an "in-memory" stream in Erlang?

(Or perhaps string concatenation is much more efficient in Erlang than in (many) other languages?)

Alex




Reply | Threaded
Open this post in threaded view
|

Streams and Strings

Kent Boortz-2

"Alex Peake" <apeake> writes:
> Is there any concept of a Stream on a String, or an "in-memory"
> stream in Erlang?
>
> (Or perhaps string concatenation is much more efficient in Erlang
> than in (many) other languages?)

String concatenation is not more efficient in Erlang than other
languages, like Lisp and Prolog.

I don't know what "Stream on a String" means but one solution used by
for example the GS application is to use "deep strings", i.e. a
concatenation is just a cons

  [String1,String2]

You can send deep strings to ports, the port will flatten it out,

kent