Abstract Wikipedia/更新情報/2022年01月13日

This page is a translated version of the page Abstract Wikipedia/Updates/2022-01-13 and the translation is 15% complete.
抽象的なウィキペディアの更新情報 Translate

メーリングリストによる抽象ウィキペディア IRCに関する抽象的なウィキペディア Telegramのウィキファンクションズ Wikifunctions on Mastodon Twitterのウィキファンクションズ Facebook上のウィキファンクションズ YouTubeのウィキファンクションズ ウィキファンクションズのウェブサイト Translate

フェーズ「η」を更新します。

よい年をお迎えですか、2022年のニュースレター初号をお届けします。

When we started work on Wikifunctions, we divided the work into eleven functional phases, named after the first eleven letters of the Greek alphabet (a naming scheme that has received notoriety recently). We are currently working on Phase η (eta), with the goal of entirely re-doing the function model of Wikifunctions by allowing for generic types and functions.

Following discussions within the team, we are refining the completion criteria for the current phase, in order to make it more tangible. The original idea of how to show that we had completed the phase was that we would do a lot of very deep static validation, so that a function call such as:

(1) if(head([true]), false, true)

would validate, but

(2) if(head(["text"]), false, true)

would not. To explain: the if function requires a Boolean as the first argument, but head is currently defined as head(List) → Object. So in a static analysis, if requires a Boolean but gets an Object. But if we would say that this is OK, the static analysis for both (1) and (2) would pass - and (2) shouldn’t pass.

On the other hand, as well as static analysis we have dynamic analysis, which happens when running the code. In that one, (1) should pass and return false, whereas (2) should raise a type error during evaluation (something such as “if expects a Boolean on the first argument, but got a String”).

We decided to de-scope the deep static analysis for now. This is something that we can add later, possibly after launching Wikifunctions.org. As you can see, users would get error messages one way or the other: it is just a question of when exactly the error is raised. Also, if you are interested in working on these or similar topics, please reach out. We are always happy to integrate the work of volunteers and other external partners.

Instead of this static analysis, we decided to focus on the following capabilities as examples of how the phase will have been completed:

  • Being able to implement curry as a composition on the wiki, but without requiring strict static analysis
  • Making it possible to create the following three 'user-defined' types on the wiki: positive integer, sign, and integer
  • Being able to make a generic wrapper type through composition on the wiki
  • Providing a re-designed function editor (though this might be pushed into the next phase)

Let’s dive deeper into each of these capabilities.

For this to work, a user must be able to use a function as an argument, and use that function for a function call in the implementation of curry. What is curry? Curry is a standard function in computer science that takes a function f and another object x and runs the function on the object. The standard form is that the function f has two arguments, the first one being of the type of x, and the 'output' is a call to the function f with the second argument preset to the value x. Example: given a function that appends a string to another string, I could create a new function “add s to end” by calling curry(append, "s"). We want to make it possible to define and call such a function.

ユーザー定義タイプ

正の整数

The following things will need to be possible:

  • Create a new type, Positive Integer, with a single key value of type String
  • Create a function to validate Positive Integer
    • If value contains a character which is not a digit (0-9), the validator raises a user-created error with the non-digit character
    • If value contains leading zeros and is not just a single zero, the validator raises a user-created error
    • If value is an empty string, the validator raises a user-created error
  • Connect the validator to the Positive Integer type
  • Create the following eight functions:
    • Is zero: Positive Integer → Boolean (returns True if the argument is zero and False otherwise)
    • Successor: Positive Integer → Positive Integer (returns the argument increased by one)
      • Provide implementations in JavaScript (BigInt) and Python (bignum)
    • Predecessor: Positive Integer → Positive Integer (returns the argument decreased by one, raises an error in case the argument is zero)
      • Provide implementations in JavaScript (BigInt) and Python (bignum)
    • Positive Integer: String → Positive Integer (constructor)
    • Positive Integer as String: Positive Integer → String (deconstructor)
    • Equal Positive Integer: Positive Integer, Positive Integer → Boolean (whether the two numbers have the same value)
    • Greater Than: Positive Integer, Positive Integer → Boolean (whether the first number is bigger than the second)
    • Lesser Than: Positive Integer, Positive Integer → Boolean (whether the second number is bigger than the first)

番号記号

The following things will be possible, related to the mathematics term "sign":

  • Create a new type, Sign, with a single key identity of type Sign
  • Create the three possible values of type Sign, i.e. positive, negative, and neutral
  • Create a function to validate Sign
    • If the value is not one of the expected three values, raise an error
  • Connect the validator to the Sign type
  • Create the following function:
    • Equal sign: Sign, Sign → Boolean (returns True if the two arguments have the same value)

整数

The following things will be possible:

  • Create a new type, Integer, with two keys, absolute value of type Positive Integer and sign of type Sign
  • Create a function to validate Integer
    • Ensure that both keys are validated
    • If sign is neutral and absolute value is not zero, or vice versa, raise an error
  • Connect the validator with the Integer type
  • Create the following six functions:
    • Integer: Positive Integer, Sign → Integer (constructor)
    • Absolute value: Integer → Positive Integer (deconstructor)
    • Sign: Integer → Sign (deconstructor)
    • Equal Integer: Integer, Integer → Boolean (whether the two numbers have the same value)
    • Greater Than: Integer, Integer → Boolean (whether the first number is bigger than the second)
    • Lesser Than: Integer, Integer → Boolean (whether the second number is bigger than the first)

Generic wrapper

A generic wrapper is a function that takes a type and returns a newly constructed type that has a single key with a value of that type. Wrappers may be useful for example to make sure that we don’t accidentally treat something as a number that looks a lot like a number. It is also useful as a test case because it is a rather simple generic type.

  • Create a function that creates the generic type, i.e. Wrap Type: Type → Type
  • Create a generic constructor function, i.e. Wrap: Type T → Function which is a function that returns a function of signature T → Wrap Type(T)
  • Create a generic deconstructor function, i.e. Unwrap: Type T → Function which is a function that returns a function of signature Wrap Type(T) → T
  • Store a literal of type Wrap Type(Boolean) as an object on the wiki
  • Write a generic function that creates a function that works with Wrap Type(T), e.g. Wrapped Equality: Type T → λ: Wrap(T), Wrap(T) → Boolean
  • これらの機能はすべて利用者空間に全文を書き込める前提です
  • Test by calling something like Unwrap(Boolean)(Wrap(Boolean)(True)) and get True back

次は?

当フェーズでこなすタスクはまだまだたくさんありますが、その部品となるものは揃いつつあります。当フェーズを完了した段階でベータクラスタの準備に集中し、皆さんに実際に試用してもらいたいと考えます。

皆さんにとって、ますます実り多い一年となりますように。