The on-wiki version of this newsletter can be found here: https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2022-01-13
--
Happy New Year, and welcome to the first newsletter of 2022!
When we started work on Wikifunctions, we divided the work into eleven functional phases https://meta.wikimedia.org/wiki/Abstract_Wikipedia/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. Curry
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 https://en.wikipedia.org/wiki/Currying 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. User-defined typesPositive Integer
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)
Sign
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)
Integer
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 - Note that all these functions should be possible to be written entirely in user space - Test by calling something like Unwrap(Boolean)(Wrap(Boolean)(True)) and get True back
Where to next?
There are still quite a few tasks to be done in this phase, but many of the pieces are almost in place for it. Once this phase is complete, we will focus on getting the beta cluster ready for you to play with.
We wish you all the best for the New Year!
Hi Denny!
Glad to see things quickly falling into place! This is fantastic progress and Kudos to the Team!
What's the longest number type supported, 64 bit two's complement integer, I.E. long or longer? Additionally, what will be the limits for floating point precision? In general, has there been "limits" discussion for numbers for Wikifunctions? A page somewhere that's drafted?
The reason I ask is because of I've thought of various integration and conversion routines that the team might play and test with that might be useful for Astrology wiki pages and where further Wikifunctions with supported algorithms could do a bit of magical automatic conversion as necessary and useful.
Ex. Given some wikitext of "The M42 nebula is estimated to be 24 light-years across." Ex. Lightyear (ly) <--> Parsec (pc) <--> Kiloparsec (kpc) <--> Kilometer (km)
Feel free to steal my ideas and hack and provide solutions in Wikifunctions prior to go-live. :-)
Reference numerical libraries: https://en.wikipedia.org/wiki/List_of_numerical_libraries
Thad https://www.linkedin.com/in/thadguidry/ https://calendly.com/thadguidry/
On Thu, Jan 13, 2022 at 6:02 PM Denny Vrandečić dvrandecic@wikimedia.org wrote:
The on-wiki version of this newsletter can be found here: https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2022-01-13
--
Happy New Year, and welcome to the first newsletter of 2022!
When we started work on Wikifunctions, we divided the work into eleven functional phases https://meta.wikimedia.org/wiki/Abstract_Wikipedia/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. Curry
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 https://en.wikipedia.org/wiki/Currying 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. User-defined typesPositive Integer
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
validator raises a user-created error with the non-digit character
- If value contains a character which is not a digit (0-9), the
the validator raises a user-created error
- If value contains leading zeros and is not just a single zero,
error
- If value is an empty string, the validator raises a user-created
- Connect the validator to the Positive Integer type
- Create the following eight functions:
is zero and False otherwise)
- Is zero: Positive Integer → Boolean (returns True if the argument
argument increased by one) - Provide implementations in JavaScript (BigInt) and Python ( bignum)
- Successor: 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)
- Predecessor: Positive Integer → Positive Integer (returns the
(deconstructor)
- Positive Integer: String → Positive Integer (constructor)
- Positive Integer as String: Positive Integer → String
Boolean (whether the two numbers have the same value)
- Equal Positive Integer: Positive Integer, Positive Integer →
the first number is bigger than the second)
- Greater Than: Positive Integer, Positive Integer → Boolean (whether
the second number is bigger than the first)
- Lesser Than: Positive Integer, Positive Integer → Boolean (whether
Sign
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
error
- If the value is not one of the expected three values, raise an
- Connect the validator to the Sign type
- Create the following function:
arguments have the same value)
- Equal sign: Sign, Sign → Boolean (returns True if the two
Integer
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
raise an error
- Ensure that both keys are validated
- If sign is neutral and absolute value is not zero, or *vice versa*,
- Connect the validator with the Integer type
- Create the following six functions:
numbers have the same value)
- Integer: Positive Integer, Sign → Integer (constructor)
- Absolute value: Integer → Positive Integer (deconstructor)
- Sign: Integer → Sign (deconstructor)
- Equal Integer: Integer, Integer → Boolean (whether the two
number is bigger than the second)
- Greater Than: Integer, Integer → Boolean (whether the first
number is bigger than the first)
- Lesser Than: Integer, Integer → Boolean (whether the second
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
- Note that all these functions should be possible to be written
entirely in user space
- Test by calling something like Unwrap(Boolean)(Wrap(Boolean)(True)) and
get True back
Where to next?
There are still quite a few tasks to be done in this phase, but many of the pieces are almost in place for it. Once this phase is complete, we will focus on getting the beta cluster ready for you to play with.
We wish you all the best for the New Year!
Abstract-Wikipedia mailing list -- abstract-wikipedia@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/abstract-wikipedia.lists.wikimed...
Hi Thad,
That's a great question!
We intentionally decided not to have a pre-loaded numeric type in Wikifunctions, for several reasons.
One reason is that this allows us to, as a community, to work together on a numeric type (or, more likely, the different numeric types) we want to support, and how we define them.
The page doesn't exist yet. I expect it to be created on Wikifunctions, by the community, after launch, to discuss the options, and implement the different numeric types. I am very much looking forward to see how this will shape out.
I hope that helps, Denny
On Thu, Jan 13, 2022 at 6:18 PM Thad Guidry thadguidry@gmail.com wrote:
Hi Denny!
Glad to see things quickly falling into place! This is fantastic progress and Kudos to the Team!
What's the longest number type supported, 64 bit two's complement integer, I.E. long or longer? Additionally, what will be the limits for floating point precision? In general, has there been "limits" discussion for numbers for Wikifunctions? A page somewhere that's drafted?
The reason I ask is because of I've thought of various integration and conversion routines that the team might play and test with that might be useful for Astrology wiki pages and where further Wikifunctions with supported algorithms could do a bit of magical automatic conversion as necessary and useful.
Ex. Given some wikitext of "The M42 nebula is estimated to be 24 light-years across." Ex. Lightyear (ly) <--> Parsec (pc) <--> Kiloparsec (kpc) <--> Kilometer (km)
Feel free to steal my ideas and hack and provide solutions in Wikifunctions prior to go-live. :-)
Reference numerical libraries: https://en.wikipedia.org/wiki/List_of_numerical_libraries
Thad https://www.linkedin.com/in/thadguidry/ https://calendly.com/thadguidry/
On Thu, Jan 13, 2022 at 6:02 PM Denny Vrandečić dvrandecic@wikimedia.org wrote:
The on-wiki version of this newsletter can be found here: https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2022-01-13
--
Happy New Year, and welcome to the first newsletter of 2022!
When we started work on Wikifunctions, we divided the work into eleven functional phases https://meta.wikimedia.org/wiki/Abstract_Wikipedia/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. Curry
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 https://en.wikipedia.org/wiki/Currying 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. User-defined typesPositive Integer
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
validator raises a user-created error with the non-digit character
- If value contains a character which is not a digit (0-9), the
the validator raises a user-created error
- If value contains leading zeros and is not just a single zero,
error
- If value is an empty string, the validator raises a user-created
- Connect the validator to the Positive Integer type
- Create the following eight functions:
argument is zero and False otherwise)
- Is zero: Positive Integer → Boolean (returns True if the
argument increased by one) - Provide implementations in JavaScript (BigInt) and Python ( bignum)
- Successor: 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)
- Predecessor: Positive Integer → Positive Integer (returns the
(deconstructor)
- Positive Integer: String → Positive Integer (constructor)
- Positive Integer as String: Positive Integer → String
Boolean (whether the two numbers have the same value)
- Equal Positive Integer: Positive Integer, Positive Integer →
the first number is bigger than the second)
- Greater Than: Positive Integer, Positive Integer → Boolean (whether
the second number is bigger than the first)
- Lesser Than: Positive Integer, Positive Integer → Boolean (whether
Sign
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
error
- If the value is not one of the expected three values, raise an
- Connect the validator to the Sign type
- Create the following function:
arguments have the same value)
- Equal sign: Sign, Sign → Boolean (returns True if the two
Integer
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
versa*, raise an error
- Ensure that both keys are validated
- If sign is neutral and absolute value is not zero, or *vice
- Connect the validator with the Integer type
- Create the following six functions:
numbers have the same value)
- Integer: Positive Integer, Sign → Integer (constructor)
- Absolute value: Integer → Positive Integer (deconstructor)
- Sign: Integer → Sign (deconstructor)
- Equal Integer: Integer, Integer → Boolean (whether the two
number is bigger than the second)
- Greater Than: Integer, Integer → Boolean (whether the first
number is bigger than the first)
- Lesser Than: Integer, Integer → Boolean (whether the second
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
- Note that all these functions should be possible to be written
entirely in user space
- Test by calling something like Unwrap(Boolean)(Wrap(Boolean)(True)) and
get True back
Where to next?
There are still quite a few tasks to be done in this phase, but many of the pieces are almost in place for it. Once this phase is complete, we will focus on getting the beta cluster ready for you to play with.
We wish you all the best for the New Year!
Abstract-Wikipedia mailing list -- abstract-wikipedia@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/abstract-wikipedia.lists.wikimed...
Abstract-Wikipedia mailing list -- abstract-wikipedia@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/abstract-wikipedia.lists.wikimed...
Thanks Denny! That's super useful and encouraging to know that our community will help decide on different numeric types!
Thad https://www.linkedin.com/in/thadguidry/ https://calendly.com/thadguidry/
On Fri, Jan 14, 2022 at 12:04 PM Denny Vrandečić dvrandecic@wikimedia.org wrote:
Hi Thad,
That's a great question!
We intentionally decided not to have a pre-loaded numeric type in Wikifunctions, for several reasons.
One reason is that this allows us to, as a community, to work together on a numeric type (or, more likely, the different numeric types) we want to support, and how we define them.
The page doesn't exist yet. I expect it to be created on Wikifunctions, by the community, after launch, to discuss the options, and implement the different numeric types. I am very much looking forward to see how this will shape out.
I hope that helps, Denny
On Thu, Jan 13, 2022 at 6:18 PM Thad Guidry thadguidry@gmail.com wrote:
Hi Denny!
Glad to see things quickly falling into place! This is fantastic progress and Kudos to the Team!
What's the longest number type supported, 64 bit two's complement integer, I.E. long or longer? Additionally, what will be the limits for floating point precision? In general, has there been "limits" discussion for numbers for Wikifunctions? A page somewhere that's drafted?
The reason I ask is because of I've thought of various integration and conversion routines that the team might play and test with that might be useful for Astrology wiki pages and where further Wikifunctions with supported algorithms could do a bit of magical automatic conversion as necessary and useful.
Ex. Given some wikitext of "The M42 nebula is estimated to be 24 light-years across." Ex. Lightyear (ly) <--> Parsec (pc) <--> Kiloparsec (kpc) <--> Kilometer (km)
Feel free to steal my ideas and hack and provide solutions in Wikifunctions prior to go-live. :-)
Reference numerical libraries: https://en.wikipedia.org/wiki/List_of_numerical_libraries
Thad https://www.linkedin.com/in/thadguidry/ https://calendly.com/thadguidry/
On Thu, Jan 13, 2022 at 6:02 PM Denny Vrandečić dvrandecic@wikimedia.org wrote:
The on-wiki version of this newsletter can be found here: https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2022-01-13
--
Happy New Year, and welcome to the first newsletter of 2022!
When we started work on Wikifunctions, we divided the work into eleven functional phases https://meta.wikimedia.org/wiki/Abstract_Wikipedia/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. Curry
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 https://en.wikipedia.org/wiki/Currying 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. User-defined typesPositive Integer
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
validator raises a user-created error with the non-digit character
- If value contains a character which is not a digit (0-9), the
the validator raises a user-created error
- If value contains leading zeros and is not just a single zero,
user-created error
- If value is an empty string, the validator raises a
- Connect the validator to the Positive Integer type
- Create the following eight functions:
argument is zero and False otherwise)
- Is zero: Positive Integer → Boolean (returns True if the
argument increased by one) - Provide implementations in JavaScript (BigInt) and Python ( bignum)
- Successor: 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)
- Predecessor: Positive Integer → Positive Integer (returns the
(deconstructor)
- Positive Integer: String → Positive Integer (constructor)
- Positive Integer as String: Positive Integer → String
Boolean (whether the two numbers have the same value)
- Equal Positive Integer: Positive Integer, Positive Integer →
the first number is bigger than the second)
- Greater Than: Positive Integer, Positive Integer → Boolean (whether
the second number is bigger than the first)
- Lesser Than: Positive Integer, Positive Integer → Boolean (whether
Sign
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
error
- If the value is not one of the expected three values, raise an
- Connect the validator to the Sign type
- Create the following function:
arguments have the same value)
- Equal sign: Sign, Sign → Boolean (returns True if the two
Integer
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
versa*, raise an error
- Ensure that both keys are validated
- If sign is neutral and absolute value is not zero, or *vice
- Connect the validator with the Integer type
- Create the following six functions:
numbers have the same value)
- Integer: Positive Integer, Sign → Integer (constructor)
- Absolute value: Integer → Positive Integer (deconstructor)
- Sign: Integer → Sign (deconstructor)
- Equal Integer: Integer, Integer → Boolean (whether the two
number is bigger than the second)
- Greater Than: Integer, Integer → Boolean (whether the first
number is bigger than the first)
- Lesser Than: Integer, Integer → Boolean (whether the second
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
- Note that all these functions should be possible to be written
entirely in user space
- Test by calling something like Unwrap(Boolean)(Wrap(Boolean)(True)) and
get True back
Where to next?
There are still quite a few tasks to be done in this phase, but many of the pieces are almost in place for it. Once this phase is complete, we will focus on getting the beta cluster ready for you to play with.
We wish you all the best for the New Year!
Abstract-Wikipedia mailing list -- abstract-wikipedia@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/abstract-wikipedia.lists.wikimed...
Abstract-Wikipedia mailing list -- abstract-wikipedia@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/abstract-wikipedia.lists.wikimed...
Abstract-Wikipedia mailing list -- abstract-wikipedia@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/abstract-wikipedia.lists.wikimed...
abstract-wikipedia@lists.wikimedia.org