设令

From Esolang
Jump to navigation Jump to search

设令 is a programming language designed by PSTF, directly translated to Simplified Chinese from SLet 3.

Data types

In this esolang, there is 5 data types.

数字: Fraction/Float. Size is unlimited. Division by 0 is 不是数字.
布尔值: 真 or 假.
数对: A pair of objects. One former value and one latter value.
代码: Just a lambda function.
集合: The most common data type. Objects in a set is always sorted. 布尔值 < 数字 < 数对 < 集合 < 代码.

Commands

==== Flow Control
对于          | For every object in set A, store it in variable named B, and execute lambda C.
只要          | While boolean A is True, execute lambda B.
做            | Start define a lambda. End with "好了".
调用          | Executes lambda A.

==== Input/Output
输入字符     | Get a character input.
输出字符     | Print a character.
输入         | Get a number input.
输出         | Print an object.
输出小数     | Print a fraction as decimal to the B'th digit.

==== Data structures and calculations
数对         | Make a pair. Returns (A,B).
组合         | Makes a set with various objects by union. End with "好了".
相反数       | Not boolean A. Negate number A.
交换         | Swap the two objects in pair A. Return the reciprocal of number A.
前者         | Former object of pair A. Numerator of number A.
后者         | Latter object of pair A. Denominator of number A.
打包         | Pack object A into a set.
存在         | True if object A is a subset of object B.
等于         | True if A=B.
抽取         | Pick a random object from set A. Randomly choose an integer between the 2 numbers in pair A.
第一个       | Returns the smallest item in a set.
加           | Does addition between numbers.
或           | Does OR between booleans.
乘           | Does multiplication between numbers.
减           | Does subtraction between numbers.
除           | Does division between numbers.
整除         | Does integer division between numbers.
且           | Does AND between booleans.
交集         | Does intersection between sets.
余数         | Does modulo between numbers.
等差数列     | Python "range(A,B,C)". Returns sets.
过滤         | For every object in set A, store it in variable named B, if C is false, throw away the item.
大小         | The size of set A.

==== Variables
令           | Set the variable named A to B.
==== Constants
真, 假, 空集, 不是数字, 无穷

Strings can be written in double quotes(“”). Use backslash(\) for escape(\q is used for left double quote, and \Q is right.). Comments are written between parentheses.

Examples

問天地好在。

对于 “問天地好在。” 甲 做 输出字符 后者 甲 好了

A + B

输出 加 输入 输入

See also

Categories and References