Erlang on Windows List Comprehension multiply gives “\f”

后端 未结 2 1469
春和景丽
春和景丽 2021-01-25 22:23

Hi i have a weird problem with Erlang on Windows i am running 16B and WinXP.

I have the following code

-module(test).
-export([cost/1,total/1]).
cost(ora         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-25 22:36

    Note your cost/1 function returns a number. But total/1 returns a list (of numbers). The results on that list are ok, this is just how erlang happens to display lists of small integers. See http://www.erlang.org/faq/problems.html 9.3

    to see what I mean, try with larger numbers

    test:total([{orange,2000}]).
    

    Again, this is just a display issue, the value in the lists are what you expect. Try it:

    [Value] = test:total([{orange,2}]).
    Value.
    

提交回复
热议问题