Викифунции:Введение

From Wikifunctions
This page is a translated version of the page Wikifunctions:Introduction and the translation is 7% complete.

Функции — это компьютерные инструкции, которые выполняют расчёты по данным, которые вы предоставляете, и отвечают на вопросы, которые у вас есть по ним. Например, когда вы спрашиваете голосового помощника, сколько миль в километре, голосовой помощник вызовет функцию, чтобы вычислить это для вас.

Викифункции — это проект с открытым исходным кодом, который позволяет любому человеку создавать функции и делиться ими, чтобы другие могли их использовать, переделывать, тестировать и учиться на их примере.

Воспользуйтесь следующими руководствами, чтобы опробовать основные возможности Викифункций. Мы с нетерпением ждём вашего отзыва и вклада!

Evaluate a Function

You can try out community-contributed functions on Wikifunctions for yourself! Pick one from our library of functions, and give input values to discover the output.

Steps:

  1. Find a function on the Main page.
  2. Navigate to a function page.
  3. Enter the input values.
  4. Run the function.

Results:

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

Создать функцию

You can add your own functions to Wikifunctions! Create a new function for use in your own implementations and enable others to use it as well. New functions can be written in your preferred language.

Steps:

  1. Go to the function creation page.
  2. Name your function.
  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 saved?
  2. Do you have corrections or feedback to report?

Редактировать функцию

You can contribute to Wikifunctions by editing its library of functions. Add or edit multilingual information to functions, and expand and alter the definitions of functions.

Steps:

  1. Find a function on the Main Page.
  2. Navigate to the function page.
  3. Click Edit source to see the edit options for this function.
  4. Optionally, modify the values of:
    1. Function name,
    2. Function aliases,
    3. Input list
      1. Add/remove input fields
      2. Edit input type
      3. Edit input labels
    4. Output type.
  5. Optionally, provide multilingual values for any of these fields:
    1. Function name
    2. Function aliases
    3. Input labels.
  6. Publish your updates.

Results:

  1. Were your edits successfully saved?
  2. Do you have corrections or feedback to report?

Create tests

You can create tests for your function implementations in Wikifunctions to ensure they are working properly.

Steps:

  1. Find a function on the Main Page or the function you created in the previous workflow.
  2. Navigate to the function page.
  3. Click the “+” link in the tests table.
  4. Click on "Select функция" under "Call".
    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. Click on "Select Function" under "Result Validation". In the field under "Function", type in the name of the function you want to use to check the result.
    • For a function whose output is String, this will be "String equality", for a function whose output is Boolean, this will be "Boolean equality".
    • Add the expected value in the given field (either "Second String" or "Second Boolean").
  6. Publish your updates.

Results:

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

Create an implementation

Functions are brought to life in implementations created to suit your needs. Run, remix, and combine functions via implementations in Wikifunctions. See the section below to learn how to connect your implementation to functions. We recommend creating and connecting a test before creating an implementation. A more comprehensive guide to creating implementations is available at Wikifunctions:How to create implementations.

Steps:

  1. Find a function on the Main Page.
  2. Navigate to the function page.
  3. Click the “+” link in the implementations table.
  4. You can create a new implementation in one of two ways:
    1. Код
      • Select the required programming language to write the function code.
      • Input your code.
    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 Tests).

Results:

  1. Was the implementation successfully saved?
  2. Do you have corrections or feedback to report?

Connect an Implementation or Test to a Function

Note: This feature is only available to Functioneers.

Connect tests and implementations to your function to see it come to life.

Steps:

  1. Find a function on the Main Page.
  2. Navigate to the function page.
  3. Select one or more tests, or one or more implementations.
  4. Click on the button “Connect”.

Results:

  1. Was the attach/detach state successfully changed?
  2. Do you have corrections or feedback to report?