วิกิฟังก์ชันส์:บทนำ

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

ฟังก์ชันคือคำสั่งคอมพิวเตอร์ที่คำนวณจากข้อมูลที่ป้อนเข้าไป แล้วตอบคำถามเกี่ยวกับข้อมูลนั้น ตัวอย่างเช่น เมื่อถามผู้ช่วยสั่งการด้วยเสียงว่าหนึ่งกิโลเมตรเท่ากับกี่ไมล์ ระบบผู้ช่วยจะเรียกใช้ฟังก์ชันเพื่อคำนวณคำตอบให้

วิกิฟังก์ชันส์เป็นโครงการโอเพนซอร์สที่ให้ทุกคนสร้างสรรค์ฟังก์ชันและแบ่งปันให้ผู้อื่นใช้ ผสม ทดสอบ และเรียนรู้

ทำตามคู่มือวิธีใช้งานดังต่อไปนี้เพื่อทดลองใช้งานฟีเจอร์พื้นฐานของวิกิฟังก์ชันส์ เราพร้อมรับเสียงตอบรับและการมีส่วนร่วมจากคุณ

ประเมินผลฟังก์ชัน

คุณสามารถลองใช้ฟังก์ชันจากส่วนร่วมของชุมชนบนวิกิฟังก์ชันส์ได้เลย เลือกมาหนึ่งอย่างจากคลังฟังก์ชันแล้วป้อนค่าเข้าไปเพื่อดูค่าส่งออก

ขั้นตอน:

  1. ค้นหาฟังก์ชันบนหน้าหลัก
  2. ไปยังหน้าฟังก์ชัน
  3. กรอกค่าป้อนเข้า
  4. ทำงานฟังก์ชัน

ผลลัพธ์:

  1. ค่าส่งออกเป็นตามที่คาดหวังไหม?
  2. มีข้อแก้ไขหรือการตอบรับที่จะรายงานไหม?

สร้างฟังก์ชัน

คุณสามารถเพิ่มฟังก์ชันของคุณเองบนวิกิฟังก์ชันส์ได้ สร้างฟังก์ชันใหม่สำหรับนำไปใช้เองและให้ผู้อื่นใช้ได้ไปด้วยกัน คุณสามารถเขียนฟังก์ชันใหม่ในภาษาที่สะดวก

ขั้นตอน:

  1. ไปยังหน้าสร้างฟังก์ชัน
  2. ตั้งชื่อฟังก์ชัน
  3. กำหนดค่ารับเข้าของฟังก์ชัน
    1. เพิ่ม/ลบช่องกรอกค่ารับเข้า
    2. กำหนดประเภทของค่ารับเข้า
    3. ตั้งชื่อค่ารับเข้า
  4. กำหนดชนิดของค่าส่งออกของฟังก์ชัน
  5. สามารถเพิ่มตัวเลือกหลายภาษาให้กับแต่ละอย่างได้:
    • ชื่อฟังก์ชัน, ชื่ออื่นของฟังก์ชัน, ป้ายชื่อค่ารับเข้า
  6. เผยแพร่ฟังก์ชันของคุณ

ผลลัพธ์:

  1. บันทึกฟังก์ชันสำเร็จไหม?
  2. มีข้อแก้ไขหรือการตอบรับที่จะรายงานไหม?

แก้ไขฟังก์ชัน

คุณสามารถมีส่วนร่วมบนวิกิฟังก์ชันได้ผ่านการแก้ไขฟังก์ชันต่าง ๆ เพิ่มหรือแก้ไขข้อมูลของฟังก์ชันในภาษาอื่น ๆ และขยายหรือแปลงนิยามของฟังก์ชัน

ขั้นตอน:

  1. ค้นหาฟังก์ชันบนหน้าหลัก
  2. ไปยังหน้าฟังก์ชัน
  3. คลิกแก้ไขต้นฉบับเพื่อดูตัวเลือกการแก้ไขสำหรับฟังก์ชันนี้
  4. สามารถเปลี่ยนค่าได้ดังนี้:
    1. ชื่อฟังก์ชัน
    2. ชื่ออื่นของฟังก์ชัน
    3. รายการค่ารับเข้า
      1. เพิ่ม/ลบช่องกรอกค่ารับเข้า
      2. แก้ไขชนิดของค่ารับเข้า
      3. แก้ไขป้ายชื่อของค่ารับเข้า
    4. ชนิดของค่าส่งออก
  5. สามารถเพิ่มตัวเลือกหลายภาษาให้กับแต่ละอย่างได้:
    1. ชื่อฟังก์ชัน
    2. ชื่ออื่นของฟังก์ชัน
    3. ป้ายชื่อของค่ารับเข้า
  6. เผยแพร่ฟังก์ชันของคุณ

ผลลัพธ์:

  1. บันทึกการแก้ไขสำเร็จไหม?
  2. มีข้อแก้ไขหรือการตอบรับที่จะรายงานไหม?

สร้างชุดทดสอบ

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. Code
      • 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?