1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 06:01:48 +02:00

Merge pull request #762 from ctheune/ctheune-floats

Implement floats
This commit is contained in:
Eelco Dolstra 2016-02-12 12:49:59 +01:00
commit b3e8d72770
27 changed files with 231 additions and 37 deletions

View file

@ -12,7 +12,9 @@ builtins.fromJSON
"Width": 100
},
"Animated" : false,
"IDs": [116, 943, 234, 38793, true ,false,null, -100]
"IDs": [116, 943, 234, 38793, true ,false,null, -100],
"Latitude": 37.7668,
"Longitude": -122.3959,
}
}
''
@ -28,5 +30,7 @@ builtins.fromJSON
};
Animated = false;
IDs = [ 116 943 234 38793 true false null (0-100) ];
Latitude = 37.7668;
Longitude = -122.3959;
};
}

View file

@ -1 +1 @@
"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3}"
"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44}"

View file

@ -8,4 +8,5 @@ builtins.toJSON
g = [ 1 2 3 ];
h = [ "a" [ "b" { "foo\nbar" = {}; } ] ];
i = 1 + 2;
j = 1.44;
}

View file

@ -1 +1 @@
[ true false true false true false true false true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ]
[ true false true false true false true false true true true true true true true true true true true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ]

View file

@ -8,6 +8,16 @@ with builtins;
(isString [ "x" ])
(isInt (1 + 2))
(isInt { x = 123; })
(isInt (1 / 2))
(isInt (1 + 1))
(isInt (1 / 2))
(isInt (1 * 2))
(isInt (1 - 2))
(isFloat (1.2))
(isFloat (1 + 1.0))
(isFloat (1 / 2.0))
(isFloat (1 * 2.0))
(isFloat (1 - 2.0))
(isBool (true && false))
(isBool null)
(isAttrs { x = 123; })

View file

@ -45,5 +45,8 @@
<attr name="x">
<int value="123" />
</attr>
<attr name="y">
<float value="567.89" />
</attr>
</attrs>
</expr>

View file

@ -2,6 +2,8 @@ rec {
x = 123;
y = 567.890;
a = "foo";
b = "bar";