{"action":"created","comment":{"url":"https://api.github.com/repos/doomspork/elixir-school/pulls/comments/57537318","id":57537318,"diff_hunk":"@@ -0,0 +1,76 @@\n+---\n+layout: page\n+title: Operador Pipe \n+category: basics\n+order: 6 \n+lang: es\n+---\n+\n+El operador pipe `|>` pasa el resultado de una expresión como el primer parametro de otra expresión.\n+\n+## Tabla de Contenidos\n+\n+- [Introducción](#introduction)\n+- [Ejemplos](#examples)\n+- [Buenas Practicas](#best-practices)\n+\n+## Introducción\n+\n+La programación puede ser desordenada. De hecho, los llamados de función que estan contenidos dentro de otra función se vuelven muy difícil de seguir. Por ejemplo, tome las siguientes funciones anidadas en consideración:\n+\n+\n+```elixir\n+foo(bar(baz(nueva_function(otra_function()))))\n+```\n+\n+Aquí, pasamos el valor de `otra_function/1` a `nueva_function/1`, y de `nueva_function/1` a `baz/1`, `baz/1` a `bar/1`, y finalmente el resultado de `bar/1` a `foo/1`. Elixir adopta un enfoque pragmático a este caos sintáctico al darnos el operador pipe. El operador pipe que luce así `|>` *toma el resultado de una expresión, y se lo pasa a la siguiente*. Vamos a echar otro vistazo al código anterior reescrito con el operador pipe.\n+\n+```elixir\n+otra_function() |> nueva_function() |> baz() |> bar() |> foo()\n+```\n+\n+El operador lleva el resultado de la izquierda, y lo pasa a la derecha.\n+\n+## Ejemplos\n+\n+Para este grupo de ejemplos, usaremos el modulo String de elixir.\n+\n+- Separar Cadenas (Tokenize String)\n+\n+```shell\n+iex> \"Elixir language\" |> String.split\n+[\"Elixir\", \"language\"]\n+```\n+\n+- Mayusculas a todas las palabras (Uppercase all the tokens)\n+\n+```shell\n+iex> \"Elixir language\" |> String.split |> Enum.map( &String.upcase/1 )\n+[\"ELIXIR\", \"LANGUAGE\"]\n+```\n+\n+- Comparar terminacion de una cadena (Check ending)\n+\n+```shell\n+iex> \"elixir\" |> String.ends_with?(\"ixir\")\n+true\n+```\n+\n+## Buenas Practicas\n+\n+Si la funcion recibe más de 1 parametro, asegurese de usar parentesis. \n+Honestamente no importa mucho en elixir, pero es importante para otros programadores que pueden malinterpretar nuestro codigo. Si en el segundo ejemplo removemos los parentesis de `Enum.map/2`, tendriamos la siguiente advertencia.","path":"es/lessons/basics/pipe-operator.md","position":62,"original_position":62,"commit_id":"94a4fdef7bb36d8d5d1687b001691ef21006254c","original_commit_id":"94a4fdef7bb36d8d5d1687b001691ef21006254c","user":{"login":"setzer777","id":13922607,"avatar_url":"https://avatars.githubusercontent.com/u/13922607?v=3","gravatar_id":"","url":"https://api.github.com/users/setzer777","html_url":"https://github.com/setzer777","followers_url":"https://api.github.com/users/setzer777/followers","following_url":"https://api.github.com/users/setzer777/following{/other_user}","gists_url":"https://api.github.com/users/setzer777/gists{/gist_id}","starred_url":"https://api.github.com/users/setzer777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/setzer777/subscriptions","organizations_url":"https://api.github.com/users/setzer777/orgs","repos_url":"https://api.github.com/users/setzer777/repos","events_url":"https://api.github.com/users/setzer777/events{/privacy}","received_events_url":"https://api.github.com/users/setzer777/received_events","type":"User","site_admin":false},"body":"Acento a paréntesis y tendríamos","created_at":"2016-03-28T00:19:51Z","updated_at":"2016-03-28T00:19:51Z","html_url":"https://github.com/doomspork/elixir-school/pull/203#discussion_r57537318","pull_request_url":"https://api.github.com/repos/doomspork/elixir-school/pulls/203","_links":{"self":{"href":"https://api.github.com/repos/doomspork/elixir-school/pulls/comments/57537318"},"html":{"href":"https://github.com/doomspork/elixir-school/pull/203#discussion_r57537318"},"pull_request":{"href":"https://api.github.com/repos/doomspork/elixir-school/pulls/203"}}},"pull_request":{"url":"https://api.github.com/repos/doomspork/elixir-school/pulls/203","id":63948579,"html_url":"https://github.com/doomspork/elixir-school/pull/203","diff_url":"https://github.com/doomspork/elixir-school/pull/203.diff","patch_url":"https://github.com/doomspork/elixir-school/pull/203.patch","issue_url":"https://api.github.com/repos/doomspork/elixir-school/issues/203","number":203,"state":"open","locked":false,"title":"add pipe operator in 'es' (spanish)","user":{"login":"davidvanegas7","id":2745435,"avatar_url":"https://avatars.githubusercontent.com/u/2745435?v=3","gravatar_id":"","url":"https://api.github.com/users/davidvanegas7","html_url":"https://github.com/davidvanegas7","followers_url":"https://api.github.com/users/davidvanegas7/followers","following_url":"https://api.github.com/users/davidvanegas7/following{/other_user}","gists_url":"https://api.github.com/users/davidvanegas7/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvanegas7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvanegas7/subscriptions","organizations_url":"https://api.github.com/users/davidvanegas7/orgs","repos_url":"https://api.github.com/users/davidvanegas7/repos","events_url":"https://api.github.com/users/davidvanegas7/events{/privacy}","received_events_url":"https://api.github.com/users/davidvanegas7/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-23T20:35:49Z","updated_at":"2016-03-28T00:19:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b85a588e0de64f89f46b2907996d0f69f2182bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/doomspork/elixir-school/pulls/203/commits","review_comments_url":"https://api.github.com/repos/doomspork/elixir-school/pulls/203/comments","review_comment_url":"https://api.github.com/repos/doomspork/elixir-school/pulls/comments{/number}","comments_url":"https://api.github.com/repos/doomspork/elixir-school/issues/203/comments","statuses_url":"https://api.github.com/repos/doomspork/elixir-school/statuses/94a4fdef7bb36d8d5d1687b001691ef21006254c","head":{"label":"davidvanegas7:master","ref":"master","sha":"94a4fdef7bb36d8d5d1687b001691ef21006254c","user":{"login":"davidvanegas7","id":2745435,"avatar_url":"https://avatars.githubusercontent.com/u/2745435?v=3","gravatar_id":"","url":"https://api.github.com/users/davidvanegas7","html_url":"https://github.com/davidvanegas7","followers_url":"https://api.github.com/users/davidvanegas7/followers","following_url":"https://api.github.com/users/davidvanegas7/following{/other_user}","gists_url":"https://api.github.com/users/davidvanegas7/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvanegas7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvanegas7/subscriptions","organizations_url":"https://api.github.com/users/davidvanegas7/orgs","repos_url":"https://api.github.com/users/davidvanegas7/repos","events_url":"https://api.github.com/users/davidvanegas7/events{/privacy}","received_events_url":"https://api.github.com/users/davidvanegas7/received_events","type":"User","site_admin":false},"repo":{"id":54578634,"name":"elixir-school","full_name":"davidvanegas7/elixir-school","owner":{"login":"davidvanegas7","id":2745435,"avatar_url":"https://avatars.githubusercontent.com/u/2745435?v=3","gravatar_id":"","url":"https://api.github.com/users/davidvanegas7","html_url":"https://github.com/davidvanegas7","followers_url":"https://api.github.com/users/davidvanegas7/followers","following_url":"https://api.github.com/users/davidvanegas7/following{/other_user}","gists_url":"https://api.github.com/users/davidvanegas7/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvanegas7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvanegas7/subscriptions","organizations_url":"https://api.github.com/users/davidvanegas7/orgs","repos_url":"https://api.github.com/users/davidvanegas7/repos","events_url":"https://api.github.com/users/davidvanegas7/events{/privacy}","received_events_url":"https://api.github.com/users/davidvanegas7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davidvanegas7/elixir-school","description":"Lessons about the Elixir programming language","fork":true,"url":"https://api.github.com/repos/davidvanegas7/elixir-school","forks_url":"https://api.github.com/repos/davidvanegas7/elixir-school/forks","keys_url":"https://api.github.com/repos/davidvanegas7/elixir-school/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davidvanegas7/elixir-school/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davidvanegas7/elixir-school/teams","hooks_url":"https://api.github.com/repos/davidvanegas7/elixir-school/hooks","issue_events_url":"https://api.github.com/repos/davidvanegas7/elixir-school/issues/events{/number}","events_url":"https://api.github.com/repos/davidvanegas7/elixir-school/events","assignees_url":"https://api.github.com/repos/davidvanegas7/elixir-school/assignees{/user}","branches_url":"https://api.github.com/repos/davidvanegas7/elixir-school/branches{/branch}","tags_url":"https://api.github.com/repos/davidvanegas7/elixir-school/tags","blobs_url":"https://api.github.com/repos/davidvanegas7/elixir-school/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davidvanegas7/elixir-school/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davidvanegas7/elixir-school/git/refs{/sha}","trees_url":"https://api.github.com/repos/davidvanegas7/elixir-school/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davidvanegas7/elixir-school/statuses/{sha}","languages_url":"https://api.github.com/repos/davidvanegas7/elixir-school/languages","stargazers_url":"https://api.github.com/repos/davidvanegas7/elixir-school/stargazers","contributors_url":"https://api.github.com/repos/davidvanegas7/elixir-school/contributors","subscribers_url":"https://api.github.com/repos/davidvanegas7/elixir-school/subscribers","subscription_url":"https://api.github.com/repos/davidvanegas7/elixir-school/subscription","commits_url":"https://api.github.com/repos/davidvanegas7/elixir-school/commits{/sha}","git_commits_url":"https://api.github.com/repos/davidvanegas7/elixir-school/git/commits{/sha}","comments_url":"https://api.github.com/repos/davidvanegas7/elixir-school/comments{/number}","issue_comment_url":"https://api.github.com/repos/davidvanegas7/elixir-school/issues/comments{/number}","contents_url":"https://api.github.com/repos/davidvanegas7/elixir-school/contents/{+path}","compare_url":"https://api.github.com/repos/davidvanegas7/elixir-school/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davidvanegas7/elixir-school/merges","archive_url":"https://api.github.com/repos/davidvanegas7/elixir-school/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davidvanegas7/elixir-school/downloads","issues_url":"https://api.github.com/repos/davidvanegas7/elixir-school/issues{/number}","pulls_url":"https://api.github.com/repos/davidvanegas7/elixir-school/pulls{/number}","milestones_url":"https://api.github.com/repos/davidvanegas7/elixir-school/milestones{/number}","notifications_url":"https://api.github.com/repos/davidvanegas7/elixir-school/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davidvanegas7/elixir-school/labels{/name}","releases_url":"https://api.github.com/repos/davidvanegas7/elixir-school/releases{/id}","deployments_url":"https://api.github.com/repos/davidvanegas7/elixir-school/deployments","created_at":"2016-03-23T17:10:41Z","updated_at":"2016-03-23T17:10:43Z","pushed_at":"2016-03-28T00:17:42Z","git_url":"git://github.com/davidvanegas7/elixir-school.git","ssh_url":"git@github.com:davidvanegas7/elixir-school.git","clone_url":"https://github.com/davidvanegas7/elixir-school.git","svn_url":"https://github.com/davidvanegas7/elixir-school","homepage":"https://elixirschool.com","size":808,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"doomspork:master","ref":"master","sha":"e73d66aa939f038603da753464948824834d945b","user":{"login":"doomspork","id":73386,"avatar_url":"https://avatars.githubusercontent.com/u/73386?v=3","gravatar_id":"","url":"https://api.github.com/users/doomspork","html_url":"https://github.com/doomspork","followers_url":"https://api.github.com/users/doomspork/followers","following_url":"https://api.github.com/users/doomspork/following{/other_user}","gists_url":"https://api.github.com/users/doomspork/gists{/gist_id}","starred_url":"https://api.github.com/users/doomspork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doomspork/subscriptions","organizations_url":"https://api.github.com/users/doomspork/orgs","repos_url":"https://api.github.com/users/doomspork/repos","events_url":"https://api.github.com/users/doomspork/events{/privacy}","received_events_url":"https://api.github.com/users/doomspork/received_events","type":"User","site_admin":false},"repo":{"id":36616176,"name":"elixir-school","full_name":"doomspork/elixir-school","owner":{"login":"doomspork","id":73386,"avatar_url":"https://avatars.githubusercontent.com/u/73386?v=3","gravatar_id":"","url":"https://api.github.com/users/doomspork","html_url":"https://github.com/doomspork","followers_url":"https://api.github.com/users/doomspork/followers","following_url":"https://api.github.com/users/doomspork/following{/other_user}","gists_url":"https://api.github.com/users/doomspork/gists{/gist_id}","starred_url":"https://api.github.com/users/doomspork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doomspork/subscriptions","organizations_url":"https://api.github.com/users/doomspork/orgs","repos_url":"https://api.github.com/users/doomspork/repos","events_url":"https://api.github.com/users/doomspork/events{/privacy}","received_events_url":"https://api.github.com/users/doomspork/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/doomspork/elixir-school","description":"Lessons about the Elixir programming language","fork":false,"url":"https://api.github.com/repos/doomspork/elixir-school","forks_url":"https://api.github.com/repos/doomspork/elixir-school/forks","keys_url":"https://api.github.com/repos/doomspork/elixir-school/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doomspork/elixir-school/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doomspork/elixir-school/teams","hooks_url":"https://api.github.com/repos/doomspork/elixir-school/hooks","issue_events_url":"https://api.github.com/repos/doomspork/elixir-school/issues/events{/number}","events_url":"https://api.github.com/repos/doomspork/elixir-school/events","assignees_url":"https://api.github.com/repos/doomspork/elixir-school/assignees{/user}","branches_url":"https://api.github.com/repos/doomspork/elixir-school/branches{/branch}","tags_url":"https://api.github.com/repos/doomspork/elixir-school/tags","blobs_url":"https://api.github.com/repos/doomspork/elixir-school/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doomspork/elixir-school/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doomspork/elixir-school/git/refs{/sha}","trees_url":"https://api.github.com/repos/doomspork/elixir-school/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doomspork/elixir-school/statuses/{sha}","languages_url":"https://api.github.com/repos/doomspork/elixir-school/languages","stargazers_url":"https://api.github.com/repos/doomspork/elixir-school/stargazers","contributors_url":"https://api.github.com/repos/doomspork/elixir-school/contributors","subscribers_url":"https://api.github.com/repos/doomspork/elixir-school/subscribers","subscription_url":"https://api.github.com/repos/doomspork/elixir-school/subscription","commits_url":"https://api.github.com/repos/doomspork/elixir-school/commits{/sha}","git_commits_url":"https://api.github.com/repos/doomspork/elixir-school/git/commits{/sha}","comments_url":"https://api.github.com/repos/doomspork/elixir-school/comments{/number}","issue_comment_url":"https://api.github.com/repos/doomspork/elixir-school/issues/comments{/number}","contents_url":"https://api.github.com/repos/doomspork/elixir-school/contents/{+path}","compare_url":"https://api.github.com/repos/doomspork/elixir-school/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doomspork/elixir-school/merges","archive_url":"https://api.github.com/repos/doomspork/elixir-school/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doomspork/elixir-school/downloads","issues_url":"https://api.github.com/repos/doomspork/elixir-school/issues{/number}","pulls_url":"https://api.github.com/repos/doomspork/elixir-school/pulls{/number}","milestones_url":"https://api.github.com/repos/doomspork/elixir-school/milestones{/number}","notifications_url":"https://api.github.com/repos/doomspork/elixir-school/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doomspork/elixir-school/labels{/name}","releases_url":"https://api.github.com/repos/doomspork/elixir-school/releases{/id}","deployments_url":"https://api.github.com/repos/doomspork/elixir-school/deployments","created_at":"2015-05-31T18:27:42Z","updated_at":"2016-03-27T13:35:10Z","pushed_at":"2016-03-28T00:17:42Z","git_url":"git://github.com/doomspork/elixir-school.git","ssh_url":"git@github.com:doomspork/elixir-school.git","clone_url":"https://github.com/doomspork/elixir-school.git","svn_url":"https://github.com/doomspork/elixir-school","homepage":"https://elixirschool.com","size":868,"stargazers_count":336,"watchers_count":336,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":91,"mirror_url":null,"open_issues_count":38,"forks":91,"open_issues":38,"watchers":336,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/doomspork/elixir-school/pulls/203"},"html":{"href":"https://github.com/doomspork/elixir-school/pull/203"},"issue":{"href":"https://api.github.com/repos/doomspork/elixir-school/issues/203"},"comments":{"href":"https://api.github.com/repos/doomspork/elixir-school/issues/203/comments"},"review_comments":{"href":"https://api.github.com/repos/doomspork/elixir-school/pulls/203/comments"},"review_comment":{"href":"https://api.github.com/repos/doomspork/elixir-school/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/doomspork/elixir-school/pulls/203/commits"},"statuses":{"href":"https://api.github.com/repos/doomspork/elixir-school/statuses/94a4fdef7bb36d8d5d1687b001691ef21006254c"}}}}