Explorer

core

Core built-in module for definy · Public

Snapshot history

Status: In progress · Every branch of the project (change the status there)

core.let: (no type)  // Compiler built-in let binding
core.plus: Fn(left: Number, right: Number) -> Number  // Compiler built-in addition
core.number-literal: Number  // Compiler built-in number literal
core.number: Type  // Built-in 64-bit integer type
core.string: Type  // Built-in UTF-8 string type
core.boolean: Type  // Built-in boolean type
core.list: Type  // Built-in list type constructor
core.equal: (no type)  // Compiler built-in equality comparison
core.minus: Fn(left: Number, right: Number) -> Number  // Compiler built-in subtraction
core.multiply: Fn(left: Number, right: Number) -> Number  // Compiler built-in multiplication
core.divide: Fn(left: Number, right: Number) -> Number  // Compiler built-in division
core.remainder: Fn(left: Number, right: Number) -> Number  // Compiler built-in remainder
core.less-than: Fn(left: Number, right: Number) -> Boolean  // Compiler built-in less than comparison
core.less-than-or-equal: Fn(left: Number, right: Number) -> Boolean  // Compiler built-in less than or equal comparison
core.greater-than: Fn(left: Number, right: Number) -> Boolean  // Compiler built-in greater than comparison
core.greater-than-or-equal: Fn(left: Number, right: Number) -> Boolean  // Compiler built-in greater than or equal comparison
core.not-equal: (no type)  // Compiler built-in not equal comparison
core.not: Fn(value: Boolean) -> Boolean  // Compiler built-in boolean negation
core.and: Fn(left: Boolean, right: Boolean) -> Boolean  // Compiler built-in boolean and
core.or: Fn(left: Boolean, right: Boolean) -> Boolean  // Compiler built-in boolean or
core.string-concat: Fn(left: String, right: String) -> String  // Compiler built-in string concatenation
core.string-length: Fn(value: String) -> Number  // Compiler built-in string length
core.string-slice: Fn(value: String, start: Number, end: Number) -> String  // Compiler built-in string slice
core.string-to-bytes: Fn(value: String) -> List<Number>  // Compiler built-in conversion of a string to its UTF-8 bytes
core.list-length: (no type)  // Compiler built-in list length
core.list-concat: (no type)  // Compiler built-in list concatenation
core.list-get: (no type)  // Compiler built-in list item access by index
core.list-append: (no type)  // Compiler built-in list append item
core.float-plus: Fn(left: Float, right: Float) -> Float  // Compiler built-in. Addition of floating-point numbers (IEEE 754)
core.float-minus: Fn(left: Float, right: Float) -> Float  // Compiler built-in. Subtraction of floating-point numbers
core.float-multiply: Fn(left: Float, right: Float) -> Float  // Compiler built-in. Multiplication of floating-point numbers. Overflow gives Infinity
core.float-divide: Fn(left: Float, right: Float) -> Float  // Compiler built-in. Division of floating-point numbers (IEEE 754). Division by zero gives Infinity or NaN, not an error
core.float-less-than: Fn(left: Float, right: Float) -> Boolean  // Compiler built-in. Whether left < right. False if either is NaN
core.float-less-than-or-equal: Fn(left: Float, right: Float) -> Boolean  // Compiler built-in. Whether left <= right. False if either is NaN
core.float-from-integer: Fn(value: Number) -> Float  // Compiler built-in. The floating-point number nearest to the integer
core.float-floor: Fn(value: Float) -> Number  // Compiler built-in. The largest integer not greater than value. NaN gives 0 and out-of-range values are clamped
core.float-ceiling: Fn(value: Float) -> Number  // Compiler built-in. The smallest integer not less than value. NaN gives 0 and out-of-range values are clamped
core.float-truncate: Fn(value: Float) -> Number  // Compiler built-in. value with the fraction dropped (toward zero). NaN gives 0 and out-of-range values are clamped
core.float-square-root: Fn(value: Float) -> Float  // Compiler built-in. The square root. Negative values give NaN
core.float-nan: Float  // NaN (not a number). The square root of -1.0. The run panel shows a NaN result as this part
core.power-of-ten: Fn(n: Number) -> Number  // 10 to the power of n (n >= 0)
core.float-power-of-ten: Fn(n: Number) -> Float  // 10 to the power of n as a floating-point number. Exact up to n = 22
core.float-from-decimal: Fn(mantissa: Number, exponent: Number) -> Float  // The value of the float literal mantissa × 10^exponent. Correctly rounded when |mantissa| < 2^53 and |exponent| <= 22. The compiler computes the same way (core.compile-float-literal)
core.bit-and: Fn(left: Number, right: Number) -> Number  // Compiler built-in bitwise AND
core.bit-or: Fn(left: Number, right: Number) -> Number  // Compiler built-in bitwise OR
core.bit-xor: Fn(left: Number, right: Number) -> Number  // Compiler built-in bitwise XOR
core.shift-left: Fn(left: Number, right: Number) -> Number  // Compiler built-in left shift (wraps around in 64 bits). The shift amount is taken modulo 64
core.shift-right: Fn(left: Number, right: Number) -> Number  // Compiler built-in arithmetic (sign-preserving) right shift. The shift amount is taken modulo 64
core.expression: Type  // Definy AST expression type (self-describing AST)
core.callee: Type  // What a call expression calls: a part (function part or compiler built-in), a compiler built-in itself, a function parameter, or a function field of a record. A function cannot be called as an arbitrary expression
core.pattern: Type  // Pattern of a match arm. any matches every value, bind matches every value and binds it to the variable, variant matches a variant with the tag whose payload matches the pattern, string / number / boolean match the literal
core.match-arm: Type  // Arm of a match expression: the body is evaluated for the first arm whose pattern matches the target
core.callee-to-expression: Fn(callee: @core.callee) -> @core.expression  // Converts what a call calls to the expression that evaluates to the function (used by the evaluator and compiler)
core.value: Type  // Definy runtime value type (self-describing value)
core.env: Type  // Definy runtime evaluation environment (variable bindings)
core.env-lookup: Fn(env: @core.env, var_id: Number) -> @core.value  // Lookup a variable in the environment
core.env-lookup-inner: Fn(env: @core.env, var_id: Number, idx: Number) -> @core.value  // Inner helper for env-lookup with index recursion
core.env-extend: Fn(env: @core.env, var_id: Number, val: @core.value) -> @core.env  // Extend environment with a new variable binding
core.value-equals: Fn(val_a: @core.value, val_b: @core.value) -> Boolean  // Compare two dynamic values for equality
core.value-equals-record-fields: Fn(
    left_fields: List<Record{key: String, value: @core.value}>,
    right_fields: List<Record{key: String, value: @core.value}>,
    index: Number
  ) -> Boolean  // (en) Whether every field of left_fields (from index) is in right_fields with the same key and an equal value. The caller compares the numbers of fields (ja) left_fields の index 以降の各フィールドが, right_fields に同じキーで等しい値としてあるか (フィールドの順番によらない). フィールドの数は呼び出し側で比べる
core.value-equals-record-field-in: Fn(
    fields: List<Record{key: String, value: @core.value}>,
    key: String,
    value: @core.value,
    index: Number
  ) -> Boolean  // (en) Whether fields (from index) have a field with key whose value equals value (ja) fields の index 以降に, キーが key で値が value と等しいフィールドがあるか
core.value-equals-list-items: Fn(left_items: List<@core.value>, right_items: List<@core.value>, index: Number) -> Boolean  // Recursively compare dynamic list value items
core.type-ast: Type  // Definy type system AST (self-describing types)
core.option: Fn(T: Type) -> Type  // A value of type T or nothing (Maybe in Elm). A type that takes a type argument: option(T: number)
core.code: Type  // Runtime value of quoted code (the type Code<T>): the expression and the ids of the parts it references (following the references). Get the parts' expressions by the ids (wasi.io get_parts) and pass them to core.compile-to-wasm
core.part-definition: Type  // Definy part definition structure (self-describing part metadata)
core.module-definition: Type  // Definy module definition structure (self-describing module metadata)
core.event-content: Type  // Content of a signed event (what the account did). The signed envelope (account_id, time, signature) is CBOR outside of this value. See docs/event.md
core.project-commit: Type  // A commit of a project on a branch: the whole list of its modules and their parts at that point. merged_commit_hash is the commit of another branch merged by this commit. See docs/project.md and docs/branch.md
core.visibility: Type  // Whether a module or a part can be referenced from outside. A private module can be referenced only from its project, and a private part only from its module. See docs/visibility.md
core.project-commit-module: Type  // A module in a project commit: its name, description and the whole list of its parts
core.module-commit-part: Type  // A part in a module of a project commit: its name and the content hash of its content (core.part-content) stored in the content-addressed storage
core.part-content: Type  // The content of a part stored in the content-addressed storage. Its content hash (SHA-256 of the CBOR) is written in core.module-commit-part
core.define-part: Fn(
    description: List<@core.localized-text>,
    visibility: @core.visibility,
    part_type: Union{#none, #some(@core.expression)},
    expression: Union{#none, #some(@core.expression)}
  ) -> @core.part-content  // (en) Define a part. The content stored for a part is an expression that evaluates to core.part-content, usually a call of this part or of a definition part built on it such as core.define-type (docs/part-definition.md). The name of the part is kept outside, in the commit (ja) パーツを定義する. パーツの中身として預けるのは評価すると core.part-content になる式で, ふつうはこのパーツか, これを使う定義のパーツ (core.define-type など) の呼び出し (docs/part-definition.md). パーツの名前は式の外 (コミット) に置く
core.define-type: Fn(
    description: List<@core.localized-text>,
    visibility: @core.visibility,
    expression: @core.expression
  ) -> @core.part-content  // (en) Define a type part: core.define-part whose type is type. expression is the declaration (a type expression such as union {...}, or a function returning one) (ja) 型パーツを定義する: 型が type の core.define-part. expression は宣言 (union {...} などの型の式か, それを返す関数)
core.localized-text: Type  // Text in one language
core.eval-ast: Fn(e: @core.expression) -> Number  // Evaluates a Definy AST expression to a number (self-hosting evaluator)
core.eval-value: Fn(
    expr: @core.expression,
    env: @core.env,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> @core.value  // (en) Universal self-hosted AST evaluator returning dynamic values (ja) 動的値を返却する汎用自己ホスト AST 評価器
core.eval-builtin-call: Fn(
    name: String,
    arguments: List<Record{name: String, value: @core.expression}>,
    env: @core.env,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> @core.value  // (en) Evaluate a call to the compiler built-in with the name (ja) 名前のコンパイラ組み込みの呼び出しを評価する
core.string-index-of: Fn(text: String, target: String, start: Number) -> Number  // The byte index of the first target in the text at or after start (-1 if none). core.eval-value runs it compiled (core.eval-native-part)
core.string-split: Fn(text: String, separator: String) -> List<String>  // Split the text by the separator (an empty separator gives [text]). core.eval-value runs it compiled
core.string-split-from: Fn(text: String, separator: String, start: Number, acc: List<String>) -> List<String>  // core.string-split from the byte index start
core.string-join: Fn(items: List<String>, separator: String) -> String  // Join the strings with the separator (halving the range, so the copies are n log n). core.eval-value runs it compiled
core.string-join-range: Fn(items: List<String>, separator: String, start: Number, end: Number) -> String  // core.string-join of items[start..end]
core.string-replace: Fn(text: String, from: String, to: String) -> String  // Replace every from in the text with to. core.eval-value runs it compiled
core.eval-native-part: Fn(id: String) -> Union{#none, #some(String)}  // The name for core.eval-builtin-call if core.eval-value runs the part compiled instead of evaluating its expression (core.string-index-of and so on)
core.eval-native-strings-to-value: Fn(items: List<String>) -> @core.value  // A list of strings as an evaluated value
core.eval-native-value-to-strings: Fn(items: List<@core.value>) -> List<String>  // The strings of evaluated values (non-strings become empty)
core.value-as-float: Fn(value: @core.value) -> Float  // The float in a core.value, or 0.0
core.value-as-number: Fn(value: @core.value) -> Number  // The integer in a core.value, or 0
core.record-field-lookup: Fn(items: List<Record{key: String, value: @core.value}>, key: String, index: Number) -> @core.value  // Looks up a field's value in a dynamic record value field list
core.eval-record-fields: Fn(
    fields: List<Record{key: String, value: @core.expression}>,
    env: @core.env,
    index: Number,
    accum: List<Record{key: String, value: @core.value}>,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> List<Record{key: String, value: @core.value}>  // (en) Evaluates record expression fields sequentially into dynamic values (ja) レコード式の各フィールドを再帰的に評価して動的値一覧を構築する関数
core.eval-list-items: Fn(
    items: List<@core.expression>,
    env: @core.env,
    index: Number,
    accum: List<@core.value>,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> List<@core.value>  // (en) Evaluates expressions in a list literal into a list of dynamic values (ja) リスト式内の各式を左から順に動的評価して値リストを構築する関数
core.eval-call-arguments: Fn(
    params: List<Record{parameter_id: Number, parameter_name: String}>,
    args: List<Record{name: String, value: @core.expression}>,
    caller_env: @core.env,
    callee_env: @core.env,
    index: Number,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> @core.env  // (en) Evaluates function call arguments and binds them to the callee environment (ja) 関数呼び出しの引数式を評価し呼び出し先環境へパラメータを変数束縛
core.eval-match-arms: Fn(
    arms: List<@core.match-arm>,
    value: @core.value,
    env: @core.env,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> @core.value  // (en) Evaluate pattern match arms sequentially for self-hosted evaluator (ja) 自己評価器用: パターンマッチアームを先頭から順に走査・解釈実行
core.eval-match-arms-inner: Fn(
    arms: List<@core.match-arm>,
    value: @core.value,
    env: @core.env,
    idx: Number,
    parts: List<Record{id: String, expression: @core.expression}>
  ) -> @core.value  // (en) Inner recursive helper for pattern match arms evaluation (ja) パターンマッチアーム走査評価の内部再帰ヘルパー
core.eval-numbers-to-values: Fn(numbers: List<Number>, index: Number, accum: List<@core.value>) -> List<@core.value>  // Wrap each number of the list in the number value
core.eval-part-reference: Fn(parts: List<Record{id: String, expression: @core.expression}>, id: String, index: Number) -> @core.value  // Find the part with the given id in parts and evaluate its expression in an empty environment (unit when not found)
core.type-error: Type  // Definy type checker error diagnostics. located wraps an error with the innermost expression where it was found
core.type-result: Type  // Result of type checking: ok(type-ast) or error(type-error)

1–100 (of 499) Next 100