Skip to content

Commit

Permalink
deploy: 6442b77
Browse files Browse the repository at this point in the history
  • Loading branch information
facebook-github-bot committed Feb 13, 2025
1 parent fcd5590 commit f5b613e
Show file tree
Hide file tree
Showing 158 changed files with 388 additions and 328 deletions.
4 changes: 2 additions & 2 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v3.6.3">
<title data-rh="true">Page Not Found | ELP</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://whatsapp.github.io/erlang-language-platform/404.html/"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docusaurus_tag" content="default"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docsearch:docusaurus_tag" content="default"><meta data-rh="true" property="og:title" content="Page Not Found | ELP"><link data-rh="true" rel="icon" href="/erlang-language-platform/img/elp_icon_color.svg"><link data-rh="true" rel="canonical" href="https://whatsapp.github.io/erlang-language-platform/404.html/"><link data-rh="true" rel="alternate" href="https://whatsapp.github.io/erlang-language-platform/404.html/" hreflang="en"><link data-rh="true" rel="alternate" href="https://whatsapp.github.io/erlang-language-platform/404.html/" hreflang="x-default"><link rel="stylesheet" href="/erlang-language-platform/assets/css/styles.b2e943a4.css">
<script src="/erlang-language-platform/assets/js/runtime~main.9dd3b7de.js" defer="defer"></script>
<script src="/erlang-language-platform/assets/js/main.fca1e2c3.js" defer="defer"></script>
<script src="/erlang-language-platform/assets/js/runtime~main.bb427e62.js" defer="defer"></script>
<script src="/erlang-language-platform/assets/js/main.bb55f3b3.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script>
Expand Down
4 changes: 2 additions & 2 deletions _src/erlang-error-index/w/W0035.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ sidebar_position: 35
```erlang
main(List) ->
lists:foldl(fun(K, Acc) -> Acc#{K => []} end, #{}, List).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 information: Unnecessary explicit fold to construct map from list.
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 information: Unnecessary explicit fold to construct map from list.
```

```erlang
main(List) ->
lists:foldl(fun({K,V}, Acc) -> Acc#{K => V} end, #{}, List).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 information: Unnecessary explicit fold to construct map from list.
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 information: Unnecessary explicit fold to construct map from list.
```

## Explanation
Expand Down
32 changes: 32 additions & 0 deletions _src/erlang-error-index/w/W0036.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
sidebar_position: 36
---

# W0036 - unnecessary Map From List Around Comprehension

## Warning

```erlang
fn(List) -> maps:from_list([{K + 1, V + 2} || {K,V} <- List]).
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 weak: Unnecessary intermediate list allocated.
```

## Explanation

The warning message indicates an unidiomatic and sub-optimal way to build a map
from a list.

Whilst the comprehension and subsequent call to `maps:from_list/1` will ultimately
construct a map from the key-values pair in the given list, it is less
efficient than it could be, since an intermediate list is created by the list
comprehension.

Using the map comprehension syntax is clearer and more performant.

To fix this warning, replace the list comprehension and `maps:from_list/1` call
with a map comprehension:

```erlang
main(List) ->
#{K + 1 => V + 2 || {K,V} <- List}.
```
1 change: 0 additions & 1 deletion assets/js/207a227f.4c4cc142.js

This file was deleted.

1 change: 1 addition & 0 deletions assets/js/207a227f.71599acb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/js/42f855b1.40840746.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions assets/js/main.bb55f3b3.js

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 0 additions & 2 deletions assets/js/main.fca1e2c3.js

This file was deleted.

Loading

0 comments on commit f5b613e

Please sign in to comment.