Last active
August 29, 2015 14:26
-
-
Save yurrriq/747b6195b43755da4aec to your computer and use it in GitHub Desktop.
LFE map issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (let ((m #m(a 1 b (2 3 4) c #(a b))) | |
| (x 'a)) | |
| ;; Fail | |
| ;; (mref m x) | |
| ;; (map-get m x) | |
| ;; Work | |
| (list | |
| (maps:get x m) | |
| (mref m 'b) | |
| (map-get m 'c))) |
Author
Ah, I see. Thanks for raising the issue!
I will comment this in the issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
map-get seems to be just an alias for mref (https://github.com/rvirding/lfe/blob/develop/src/lfe_eval.erl#L133), so they should behave consistently.
mref seems to be a macro that doesn't evaluate the key but only the map argument (https://github.com/rvirding/lfe/blob/develop/src/lfe_eval.erl#L122).
That should maybe read
but maybe not. The documentation is a bit thin about the intended semantics and even the reasoning why this should be a macro and not just a function.
lfe/lfe#136