Jump to content

Wikifunções:Introdução

From Wikifunctions
This page is a translated version of the page Wikifunctions:Introduction and the translation is 45% complete.
Outdated translations are marked like this.

Functions make calculations on the data you provide.

Wikifunções é um projeto de código aberto que permite a qualquer pessoa criar funções e compartilhá-las para que outros possam usar, remixar, testar e aprender.

Use os seguintes guias práticos para experimentar os recursos básicos do Wikifunções. Aguardamos seu feedback e contribuições!

Avaliar uma função

Você mesmo pode experimentar funções criadas pela comunidade do Wikifunções! Escolha uma de nossa biblioteca de funções e forneça valores de entrada para descobrir a saída.

Passos:

  1. Encontre uma função na página principal.
  2. Navegue até a página da função.
  3. Insira os valores de entrada.
  4. Execute a função.

Resultados:

  1. O resultado foi o que você esperava?
  2. Do you have corrections or feedback to report?

Share a Function call

After you run a function, use the 'Copy result link' button beneath the result panel to copy a shareable URL. When someone opens that link, Wikifunctions preloads the same function call and runs it automatically, so they see the inputs and result exactly as you did. This is a quick way to demonstrate reproducible examples or ask others for help with a specific function input/output.

Steps (continue from "Evaluate a Function"):

  1. After the result loads, click 'Copy result link' under the result panel.
    Share a function call feature in Wikifunctions screenshot
  2. Share the URL with others!

Note: the shared link preloads your exact inputs and runs them again, so recipients see the same result unless the underlying implementation has changed since you generated the link.

Crie uma função

Você pode adicionar suas próprias funções ao Wikifunções! Crie uma nova função para usar em suas próprias implementações e permita que outras pessoas também a utilizem. Novas funções podem ser escritas no seu idioma preferido.

Passos:

  1. Vá para página de criação de função.
  2. Nomeie sua função.
  3. Define your function's inputs:
    1. Add/remove input fields.
    2. Define each input type.
    3. Name each input.
  4. Define your function output type.
  5. Optionally, provide multilingual values for any of these fields:
    • Function name, function aliases, input labels.
  6. Publish your function.

Results:

  1. Was the function successfully published?
  2. Do you have corrections or feedback to report?

Editar uma função

Você pode contribuir com o Wikifunções editando sua biblioteca de funções. Adicione ou edite informações multilíngues a funções, expanda e altere as definições das funções.

Passos:

  1. Encontre uma função na página principal.
  2. Navegue até a página da função.
  3. Clique em “Editar código-fonte” para ver as opções de edição desta função.
  4. Opcionalmente, modifique os valores de:
    1. Nome da função,
    2. Function aliases,
    3. Input list
      1. Add/remove input fields
      2. Edit input type
      3. Edit input labels
    4. Output type.
  5. Opcionalmente, forneça opções multilíngues para qualquer um destes campos:
    1. Nome da função
    2. Function aliases
    3. Input labels.
  6. Publish your updates.

Resultados:

  1. Suas edições foram salvas com sucesso?
  2. Do you have corrections or feedback to report?

Criar testes

Você pode criar testes para suas implementações no Wikifunções para garantir que estejam funcionando corretamente.

Passos:

  1. Find a function on the Main Page or the function you created in the previous workflow.
  2. Navegue até a página da função.
  3. Clique na ligação “+” na tabela de testes.
  4. The "Call" section should automatically be expanded.
    1. In the field under "Function", type in the name of the function you are testing and select the function when it shows up.
    2. Add values for the inputs in the respective fields.
  5. The "Result Validation" section should automatically be expanded.
    1. In the field under "Function", type in the name of the function you want to use to check the result.
    2. For a function whose output is String, this will be "String equality", for a function whose output is Boolean, this will be "Boolean equality".
    3. Add the expected value in the given field (either "Second String" or "Second Boolean").
  6. Publish your updates.

Results:

  1. Was the test successfully published?
  2. Do you have corrections or feedback to report?

Crie uma implementação

As funções ganham vida em implementações criadas para atender às suas necessidades. Execute, remixe e combine funções por meio de implementações no Wikifunções. Veja a seção abaixo para saber como conectar sua implementação a funções. Recomendamos criar e conectar um teste antes de criar uma implementação. Um guia mais abrangente para a criação de implementações está disponível em Wikifunctions:How to create implementations.

Passos:

  1. Encontre uma função na página principal.
  2. Navegue até a página da função.
  3. Clique na ligação “+” na tabela de implementações.
  4. Você pode criar uma nova implementação de duas maneiras:
    1. Código
      • Selecione a linguagem de programação necessária para escrever o código.
      • Insira seu código.
    2. Composition:
      • Create a composition using existing functions.
  5. Publish your updates (after running a test by clicking the round arrow on the right of the box titled Testes).

Resultados:

  1. A implementação foi salva com sucesso?
  2. Do you have corrections or feedback to report?

Conecte uma implementação ou teste a uma função

Nota: Este recurso está disponível apenas para funcionários.

Conecte testes e implementações à sua função para vê-la ganhar vida.

Passos:

  1. Encontre uma função na página principal.
  2. Navegue até a página da função.
  3. Selecione um ou mais testes ou uma ou mais implementações.
  4. Clique no botão “Ligar”.

Resultados:

  1. O estado de anexação/desconexão foi alterado com sucesso?
  2. Você tem correções ou feedback para reportar?

Insert a Function in a Wikipedia article

Now it is time to insert a function in a Wikipedia article and see the magic unfold.

Steps:

  1. Open the article you want to add a function to.
  2. Go to the edit tab and open visual editor.
  3. Click on the “Insert” menu at the top of the visual editor. Scroll down and click on “Function”. A dialog box will open.
  4. Search for the function you want to insert and click on it. Or, try one of the Suggested Functions below the search bar.
  5. Enter the necessary inputs and click on the “Insert” button at the top right to insert the function into the article.
  6. You can now see the output of your function in the article. You can proceed to publish the changes.
  7. If you want to edit the function, click on it. A tooltip will appear with the function name and description. Click on the “Edit” button.
  8. Then you can make changes to the inputs and click on “Apply changes” when you are done editing.

Results:

  1. Was the output what you expected?
  2. Do you have corrections or feedback to report?