Nix (language): Difference between revisions
imported>Rovanion Did some proofreading. |
imported>Rovanion More language paralells. |
||
Line 75: | Line 75: | ||
| Lists || Items are separated by space, not comma. Each item can be a value of any other type || <syntaxHighlight lang=nix>[ 1 ./example.bin { hello="world"; }] </syntaxHighlight> | | Lists || Items are separated by space, not comma. Each item can be a value of any other type || <syntaxHighlight lang=nix>[ 1 ./example.bin { hello="world"; }] </syntaxHighlight> | ||
|- | |- | ||
| Sets || In other languages called <code>dicts</code>( | | Sets || Associative data structures. In other languages called <code>dicts</code>(Python),<code>objects</code>(JavaScript) <code>hashes</code>(Ruby) or <code>maps</code>(Java). Essentially a list of key-value pairs || <syntaxHighlight lang=nix>{ key1="value1"; key2="value2"; }</syntaxHighlight> | ||
Access values through dot-notation:<syntaxHighlight lang=nix>{ hello="world"; }.hello | Access values through dot-notation:<syntaxHighlight lang=nix>{ hello="world"; }.hello | ||
> "world"</syntaxHighlight> | > "world"</syntaxHighlight> |