Erlang prints (some) lists as strings

Craig Dickson crd@REDACTED
Thu Nov 11 00:43:25 CET 1999

Well, you could write your own function to print it out however you like,
and pass your list to it:

    format_list(L) when list(L) ->

    fnl([H]) ->
        io:format("~p", [H]);
    fnl([H|T]) ->
        io:format("~p,", [H]),
    fnl([]) ->

That's about what it will take, since Erlang doesn't have a "character" data
type, and the shell has to guess whether any given integer in a list is
meant to be a number or text.

I haven't tested the above code, by the way, but if it doesn't work as
written, you get the idea, I'm sure...


----- Original Message -----
From: Lenny <lkneler@REDACTED>
To: <erlang-questions@REDACTED>
Sent: Wednesday, 10 November 1999 03:25 pm
Subject: Erlang prints (some) lists as strings

> How do I tell Erlang not to print the first list as "ooo"?
> Eshell V47.4.1  (abort with ^G)
> 1> [111,111,111].
> "ooo"
> 2> [-111,-111,-111].
> [-111,-111,-111]
> Thanks,
> -Lenny-
> lkneler@REDACTED

More information about the erlang-questions mailing list