hughperman / pure-lang

Automatically exported from code.google.com/p/pure-lang
0 stars 0 forks source link

[0..6] not equal [0, 1, 2, 3, 4, 5, 6] ?? #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
def ShortWeekdays = ["so", "mo", "di", "mi", "do", "fr", "sa" ];
let DayDict::dict = dict (zipwith (=>) ShortWeekdays [0..6]);

What is the expected output? What do you see instead?
Intuitively I would say it should work like in Q. But it works only if I use 
[0, 1, 2, 3, 4, 5, 6] ... bug or feature ?

What version of the product are you using? On what operating system?
0.51, Windows

Please provide any additional information below.

Original issue reported on code.google.com by loo6...@gmail.com on 13 Feb 2012 at 9:56

GoogleCodeExporter commented 8 years ago
This is not Q or Haskell. Use (0..6) instead of [0..6] and everything should be 
fine. Note that .. is just an ordinary infix operator in Pure, so the syntax 
for arithmetic progressions works a bit differently from Haskell, see 
http://docs.pure-lang.googlecode.com/hg/pure.html#primary-expressions and 
http://docs.pure-lang.googlecode.com/hg/purelib.html#..

Original comment by aggraef@gmail.com on 13 Feb 2012 at 10:33

GoogleCodeExporter commented 8 years ago
Sorry, GC messed up the second link, here's the right one: 
http://docs.pure-lang.googlecode.com/hg/purelib.html#...

Original comment by aggraef@gmail.com on 13 Feb 2012 at 10:35

GoogleCodeExporter commented 8 years ago
And, just for the record, here's how you'd write that little example in Pure:

let ShortWeekdays = ["so", "mo", "di", "mi", "do", "fr", "sa" ];
let days = record (zipwith (=>) ShortWeekdays (0..6));

days!"so"; // yields 0

Original comment by aggraef@gmail.com on 13 Feb 2012 at 10:38