map anomaly
- Posted by bugmagnet Aug 04, 2012
- 1222 views
So a map is an atom. Ok, have got that down pat. So how does Euphoria tell the difference between an atom created with map and a normal atom? In the following code, the map and the atom resolve to the value of 1. map() claims that both are maps. And pairs gives me the same pairs that x has when given the value of y. Anomalous, no?
include std/map.e map x = new() atom y = 1 printf( 1, "x(a map)=%d, y(an atom)=%d\n", {x,y}) printf( 1, "map(x)=%d, map(y)=%d\n", {map(x),map(y)}) sequence xpairs sequence ypairs xpairs = pairs(x) ypairs = pairs(y) if equal(xpairs, ypairs) then puts(1, "anomaly" ) else puts(1, "expected" ) end if
>maptest.ex x(a map)=1, y(an atom)=1 map(x)=1, map(y)=1 anomaly
Kind regards,
Bruce/bugmagnet
P.S. If this is a bug, I'm demonstrating my magnetism