We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
User:PrySigneToFry/Sandbox/Sinicomix
- This is still a work in progress. It may be changed in the future.
Sinicomix is designed by PSTF inspired from islptng's Polynomix.
Syntax
Numeric Value
We use 〇一二三四五六七八九 instead of 0123456789 as number literals. For example,
四二
evaluates into 42.
Backslash for negative is replaced by 负. For example,
负三
is equal to \3 in Polynomix.
Scientific notation dot is replaced with 什. For example,
三乘五什 $$ Should equal to 三〇〇〇〇〇
Division are also exactly rational as in Polynomix. Reduction will be performed automatically. 除 and 分 is synonym for slash used for fractions and divisions.
八分一六 $$ Should equal to 一分二
A÷0 evaluates into 卺 for A≠0 and 覃 for A=0.
LTR Rule
Same as what in Polynomix. For example,
九加三乘三 $$ Equals to (9+3)*3=36 九加(三乘三) $$ Equals to 9+(3*3)=18
Without parentheses, Sinicomix behaves the same as Polynomix, both evaluating from left to right.
Semicolon
In Sinicomix, sometimes semicolons are really just decorative, because Chinese characters are way more than ASCII characters, and we have enough Chinese characters to express the different meanings that a single ASCII character represents. For example, even just a simple - can be divided into 减 for dyadic - and 反 for monadic -.
空 behaves like Polynomix \;.
Variables
Declaration and Mutation
赋 equals to hashtag in Polynomix. To declare instead of mutate, you should add 量 before the name. For example,
一〇赋量龘
二〇赋龘
$$$ Now 龘 should store 20 instead of 10.
If we accidentally made a type, for example, we wrote 二〇赋龖,
then it will return an Exception called NameError. $
You can also define multiple variables by pair-definition. For example,
(五,六)赋(量甲,量乙)
Scope
We use 始终 for scope definition, which behaves like braces in Polynomix. Variables with the same name in different scopes won't affect each other. If you want to use the value of a same-named variable from an outer scope in a certain scope, you can use variable_name 外 to seal a variable.
Compound Assignment
Compound assignment works exactly like what in Polynomix since Sinicomix is Chinese version of Polynomix. For example,
一〇赋量龘 二〇赋加龘 $$$ Now 龘 should store 30 instead of 20 in the previous example. $
If-else Statement
若 ... 则 works like ? in Polynomix. Its syntax is like this:
若 condition 则 (true_value false_value)
If false_value was omitted or 空, then it will be never evaluated.
Multiple-branch if-elif-else expressions are allowed. They also follow the "left-to-right evaluation" rule and will return immediately once a condition is met, without evaluating the expressions that follow. For example,
若〇则(“啊。” 若一则(“啊?” 若〇则(“啊!”)))
While Statement
循 works like "keyword" @ in Polynomix. For example,
五赋量丙
丙循始
丙
丙减一赋丙
终
When the operand on the left side of '循', which is the loop condition, is true, '循' will repeatedly evaluate the operand on the right side (or execute the code block on the right) until the left operand becomes false.
The monadic @ is replaced with 返.
Try-except Statement
Colon is replaced by 错. For example,
三乘甲错一
If at this time 甲 is an undefined value, 错 will return the operand on its right side, which in this example is 1.
You can also replace the right operand by codeblock to handle the error.
If there are no right operand, then it will just throw out an error, which is useful when the program reached an unexpected impossible state.
“不可能!绝对不可能!”错
List
Literal
Brackets for lists are replaced by the equivalent in Chinese, 【】.
Character literal is just a character followed by 字. Strings are quoted in “”, and \ is used for escaping sequence. \换 for newline, \表 for tab, \转 for carriage return, \退 for backspace, \左 for “ and \右 for ”.
Indexing
The slash for getting item is replaced by 取. For example,
【一 二 三 四】取二 $$ Should return 三
You can also replace the right operand by a pair for slice. For example,
【一 二 三 四 五 六 七】取(二,四) $$ Should return 【三 四】
And multidimensional indexing.
【【一 三】 【四 六】】取【〇 一】
To get the first or second element of a pair, use 首 and 尾.
To invert the pair or list, use 倒.
You can also modify an element in list by 赋, just like this:
【n0 n1 n2 n3 n4 n5 n6 ...】赋(index new_element)
Where index is either an integer for real index or a pair for slice.
Property
To get length, you use 长.
To flatten one layer of nest, you use 碾. Literally crush a list to flatten it.
When generating range, you use 范. When monadically, the syntax is like this:
x 范 $$ Generates a range of [0, x).
And when dyadically, the syntax is like this:
c 范(a b) $$ Generates a range from a to b with step of c.
Duplicate removal is achieved by 丢.
About Pair
Comma are exactly same as what in Polynomix. For example,
三,五 $$ Equals to 3,5 in Polynomix.
Monadic comma is replaced by 饺.
Iterative Operations
The iterative operation notator backslash is replaced by 叠. For example,
【一 二 三 四 五】叠幂二 $$ Should return [1 4 9 16 25]. 二幂叠【一 二 三 四 五】 $$ Should return [2 4 8 16 32] instead. $$ See? When one side is list, then 叠 should added to that side. $$ When both sides are lists, then 叠 should added to both sides. E. G. 【一 二 三】叠加叠【四 五 六】 $$ Should return [5 7 9].
Cartesian product: \!*\ is replaced by 植 and \*\! is replaced by 捺.
Arithmetics on Everything
+
The same symbol can have different meanings depending on the operands. For example, the plus sign alone can mean a lot of different things. For example, It adds numbers together:
三加五
Joins lists together:
【一 二 三】加【四 五 六】
When monadically, it is represented by different characters. For example, When floor the number, + is replaced by 整. When ranking, it is replaced by 排.
+. is replaced by 组. For example,
【三 五 二 九 一二 二二 一七】组(【三 五 二 九 一二 二二 一七】排)碾 $$ This is how we sort a list.
-
The minus sign also carries different meanings represented by different characters in different contexts. For instance, when both operands are numbers, 减 is used to calculate the difference between them.
三减五
When both operators are lists, it can be used to calculate the difference set of the two lists (the union of the two lists minus the intersection of them and the unique elements of the second operand).
When monadically, it can be achieved by three characters. 反 for negation, 丢 for duplicate removal, and 非 for boolean.
Thus, we can get union of list by this way without union operator:
(list_1加list_2)丢
*
Similarly, the multiplication symbol also has different meanings represented by different characters. When both operands are numbers, it calculates the product of these two operands; when one of the operands is a list, it repeats the list the specified number of times.
The number of repetitions can be a fraction, as long as the denominator of this fraction is a factor or multiple of the length of the list.
三乘八 $$ 24 (三饺)乘八 $$ [3 3 3 3 3 3 3 3]
The monadical asterisk is replaced by 绝.
/
The division symbol also needs to be determined based on the context (or the character used to replace the slash in the original Polynomix). When both operators are numbers, it calculates the result of dividing the two numbers.
As we have already mentioned, Sinicomix is a Chinese version of Polynomix, so the fractions in it are also absolutely rational numbers.
When there is only one operator, it will be replaced by 倒. This "倒" is not only the "reciprocal" of "倒数", but also the "reversal" of "颠倒".
Thus when we want to make integer division, then we can use this:
(dividend除divisor)整
%
When dyadically, it is represented by 模. When monadically on matrix, it is represented by 转.
&
In the original Polynomix, the greatest common divisor, intersection, and type acquisition are all represented by & (the ampersand). In our Chinese version, when & represents the greatest common divisor, we use "约" (approximately) instead; when & represents the intersection, we use "交" (intersection) instead; and when & represents type acquisition, we use "种" (type) instead.
Boolean
Literal and Operation
Boolean literals are written by 真 and 假, which equals (1|) and (0|) in original Polynomix.
& is 与, | is 或, and ^ is 俩.
Comparison
Since we have more Chinese characters, we can have exactly three comparison relations: 少, 同 and 多.
Converting
To convert other things into boolean, you use 逻. Any null value (absolute null value, number 0, empty string, empty list, pair (0, 0), NUL character) corresponds to false, and all other values correspond to true.
One point deserves special attention, and that is, the type identifier for Boolean values is not 逻, but 爻. The name 爻 is largely influenced by wenyan, which means the solid or dashed lines that make up a hexagram(卦) in the I-Ching.
Treat Lists as Sets
Let two operands as A and B.
A与B $$ Intersection. A或B $$ Union. A减B $$ Set difference. A俩B $$ Return the "unique" values of each of the two sets, that is, the values that are present in one set but not in the other.
Transpose and Reshape
As we said, 转 on a matrix (A) can return AT (transpose of it). It can also convert between (list, list) and [pair1, pair2, pair3...].
We use 塑 to reshape the list. For example,
【二 三 四】塑五 $$ [2 3 4 2 3] 【二 三 四】塑(五 一) $$ [2 3 4 1 1]
To cut the list into parts, you use 割. For example,
【一 二 三 四 五 六 七】割三 $$ [[1 2 3] [4 5 6] [7 \; \;]]
When there is no enough elements to group in, the rest of last group will be filled with nulls.
Enumeration and Rotation
When enumerating the list, you use 索.
When rotating the list, you use 旋. As what in Polynomix, rotating n position will rotate to left if n is positive and right if n is negative.
To get numerator and denominator of a number, you use 子 and 母.
To get encoding point in UCS-4, you use 码. For example, getting UCS-4 encoding of 😊 results in 一二八五二二.
Search and Split
To find substrings from a string, you can use 搜. If 搜 is used triadically, it replaces the substrings with the specified masks, and if it's used tetradically, it replaces for x times where x is a positive integer and is the fourth operand.
We use 拆 to split a string into multiple strings with the specified seperator. If it's used tetradically, it only splits for x times where x is a positive integer and is the fourth operand.
Randomness
We use 抽 to replace monadic + on pair and dyadic + on list and integer. If the second operand of dyadic 抽 is 空, then it will shuffle instead.