Key-value pairs is a misnomer. Records are name-value pairs, the same way that you can give names to members of a Python objects. So while the docs need to be fixed, I think the use of the term "key-value" pair is the problem.
In Python, you can do myObject.foo, but not myObject."foo" or myObject.3 or such. The same is true of Elm records: each field has a name, but you're not doing lookup with arbitrary values. So I think the object metaphor is much more accurate than the dictionary one. Records in Elm are basically tuples where you give a name to each element. You generally use them when you know ahead of time exactly which fields (names) you will have. Elm also has Dictionaries, which are much closer to Python dicts: http://package.elm-lang.org/packages/elm-lang/core/latest/Dict These you can add and take elements from at runtime, without changing the type of the dict. On Wed, Jul 13, 2016 at 11:17 PM, Nir Galon <[email protected]> wrote: > Thank you very much! > > On Thursday, July 14, 2016 at 8:55:09 AM UTC+3, Janis Voigtländer wrote: >> >> I would appreciate any help on how to find the source code so I can do a >> PR and fix this. >> >> https://github.com/evancz/guide.elm-lang.org >> >> >> 2016-07-14 7:20 GMT+02:00 Nir Galon <[email protected]>: >> >>> Hi, >>> I'm a Python developer, and I"m just getting into elm. >>> I start by reading the documentation and I notice an error in >>> core_language <http://guide.elm-lang.org/core_language.html> page. I >>> try to find the website source code and do a PR, but with no success (found >>> the website source code, but the docs isn't there). >>> The error is in `Records` section, when it says `A record is a set of >>> key-value pairs, similar to objects in JavaScript or Python.` - It's >>> actually not true in Python, In Python key-value pairs called >>> `dictionaries`. >>> So the true sentence should by: `A record is a set of key-value pairs, >>> similar to objects in JavaScript and dictionaries in Python`. >>> >>> I would appreciate any help on how to find the source code so I can do a >>> PR and fix this. >>> Nir Galon >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Elm Discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
