Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  Outdated examples - data_types

def
Posted: Sat Jun 16, 2007 11:07 pm Reply with quote
Joined: 14 Jun 2007 Posts: 4 Location: South Africa
Quote:
Hi,

I'm just trying to help to get the documentation improved for future users; I will report anything that I find.

As in another topic, there are some things that can be hyperlinked liked the references to man(x) pages, like "erlang(3)".


I've noticed in the html docs: /doc/reference_manual/data_types.html
Some of the examples that are given don't give the same output on my Erlang R11B via the Erlang emulator/shell v 5.5.4, for example,
Quote:
5> list_to_binary("hello").
<<104,101,108,108,111>>

Instead I get
Quote:
56> list_to_binary("hello").
<<"hello">>


What's the correct behaviour? Or is the output of an array of integers just automatically being converted to a string by the "print"ing to the console/shell?

I tried this on a windows xp machine.


<<104,101,108,108,111>> and <<"hello">> are the same, as the string datatype does not exist. It is represented as a list of ascii by the VM. The output, I would guess, is not defined between releases.

With strings, the shell will notice if a list consists of ascii and print it out as a string. That is obviously not the case with binaries.
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum