From 8d123aa68c7e8b696b881ea5a6cd0bfb605d98a0 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 30 Sep 2023 15:16:59 -0400 Subject: [PATCH] :memo: Fill in remaining documentation --- .../AshashatCore.docc/Modifiers.md | 137 ++++++++++++++---- .../Modifiers/AshashatColorModifier.swift | 50 +++++++ .../Modifiers/AshashatScaleModifier.swift | 27 ++++ .../AshashatScientificModifier.swift | 23 +++ .../Modifiers/AshashatSenseModifier.swift | 26 ++++ .../Modifiers/AshashatSpeedModifier.swift | 19 +++ 6 files changed, 252 insertions(+), 30 deletions(-) diff --git a/Ashashat/Sources/AshashatCore/AshashatCore.docc/Modifiers.md b/Ashashat/Sources/AshashatCore/AshashatCore.docc/Modifiers.md index 4bb61e3..76730be 100644 --- a/Ashashat/Sources/AshashatCore/AshashatCore.docc/Modifiers.md +++ b/Ashashat/Sources/AshashatCore/AshashatCore.docc/Modifiers.md @@ -113,11 +113,11 @@ Grammatical person modifiers, prefixes to primitives and/or modifiers, are used and recipient. They are also also stand-ins for pronouns. In AshashatCore, this is represented with the ``AshashatGrammaticalPersonModifier`` type. -| English grammatical person | [ʔaʃaʃat] | Grammatical person type case | -| :------------------------- | :-------- | :------------------------------------------- | -| first person | ba | ``AshashatGrammaticalPersonModifier/first`` | -| second person | bi | ``AshashatGrammaticalPersonModifier/second`` | -| third person | bu | ``AshashatGrammaticalPersonModifier/third`` | +| English grammatical person | [ʔaʃaʃat] | +| :------------------------- | :-------- | +| first person | ba | +| second person | bi | +| third person | bu | > Pronouns do not take a gender as the gender is “type erased” away, hereby recognizing everyone as a person. @@ -138,17 +138,17 @@ let yourIdea: some AshashatWord = { Action modifiers describe that a certain action can be done on or with the item in question. They are suffixes to primitives and/or modifiers. In AshashatCore, this is represented as the ``AshashatActionModifier`` type. -| English action | [ʔaʃaʃat] | Action modifier type case | -| :------------- | :-------- | :------------------------------------- | -| speakable | kasu | ``AshashatActionModifier/speakable`` | -| markable | babin | ``AshashatActionModifier/markable`` | -| writable | bapen | ``AshashatActionModifier/writeable`` | -| destroyable | k’abi: | ``AshashatActionModifier/destroyable`` | -| craftable | pabil | ``AshashatActionModifier/craftable`` | -| performable | ʃasu | ``AshashatActionModifier/performable`` | -| movable | ʃaku | ``AshashatActionModifier/movable`` | -| doable | nalu | ``AshashatActionModifier/doable`` | -| able to exist | nalu: | ``AshashatActionModifier/existing`` | +| English action | [ʔaʃaʃat] | +| :------------- | :-------- | +| speakable | kasu | +| markable | babin | +| writable | bapen | +| destroyable | k’abi: | +| craftable | pabil | +| performable | ʃasu | +| movable | ʃaku | +| doable | nalu | +| able to exist | nalu: | For example, the word [ʔaʃa | kasu] transliterates to “speakable idea”, which translates to *word*. Action modifiers can @@ -175,13 +175,13 @@ The logical conjunctions are infixes for primitives and/or modifiers that can be combinational logic, such as “red and blue”. In AshashatCore, this is represented by ``AshashatLogicalConjunctionModifier``. -| English conjunction | [ʔaʃaʃat] | Conjunction modifier case | -| :------------------ | :-------- | :------------------------------------------- | -| not | sukaʔ | ``AshashatLogicalConjunctionModifier/not`` | -| never | sukak’aʔ | ``AshashatLogicalConjunctionModifier/never`` | -| and | suki | ``AshashatLogicalConjunctionModifier/and`` | -| or | suke | ``AshashatLogicalConjunctionModifier/or`` | -| exclusive or (xor) | ʃukek’e | ``AshashatLogicalConjunctionModifier/xor`` | +| English conjunction | [ʔaʃaʃat] | +| :------------------ | :-------- | +| not | sukaʔ | +| never | sukak’aʔ | +| and | suki | +| or | suke | +| exclusive or (xor) | ʃukek’e | For example, the modifier [ba | sukaʔa | bin] transliterates to “not markable”. Logical conjunctions can be expressed @@ -203,7 +203,7 @@ let unmarkableIdea: some AshashatWord = { ## Scientific domains Scientific domain modifiers are circumfixes to primitives and/or modifiers used to denote a scientific quality about an -item. +item. In AshashatCore, this is represented using ``AshashatScientificModifier``. | Scientific domain | [ʔaʃaʃat] | | :---------------- | :-------- | @@ -214,10 +214,19 @@ item. For example, the word [e | siʃa | ʃaku] transliterates to “electrical slab”, which translates to *tablet (like iPad)*. +In AshashatCore, the ``AshashatWord/scientificDomain(_:)`` can be used to accomplish this: + +```swift +let iPad: some AshashatWord = { + AshashatShape.slab + .scientificDomain(.electrical) +}() +``` ## Size and scale -Size and scale modifiers are suffixes to primitives and/or modifiers that describe the scale or size of an item. +Size and scale modifiers are suffixes to primitives and/or modifiers that describe the scale or size of an item. In +AshashatCore, this is represented with a ``AshashatScaleModifier`` and an ``AshashatScaleAxisModifier``, respectively. | Size or scale | [ʔaʃaʃat] | | :------------ | :-------- | @@ -229,11 +238,19 @@ Size and scale modifiers are suffixes to primitives and/or modifiers that descri For example, the word [siʃa | ʃa | k’iʃi | suki | ʃi | k’aʃa] transliterates to “slab that is small width wise and big -lengthwise”, which translates to *line*. +lengthwise”, which translates to *line*. In AshashatCore, ``AshashatWord/scaled(to:axis:)`` can be used: + +```swift +let longSlab: some AshashatWord = { + AshashatShape.slab + .scaled(to: .medium, axis: .length) +}() +``` ## Senses -Sense modifiers are prefixes to primitives and/or modifiers that describe words with respect to the senses. +Sense modifiers are prefixes to primitives and/or modifiers that describe words with respect to the senses. In +AshashatCore, this is represented by ``AshashatSenseModifier``. | Sense | [ʔaʃaʃat] | | :----------- | :-------- | @@ -244,12 +261,21 @@ Sense modifiers are prefixes to primitives and/or modifiers that describe words | tactile | ik’i | -For example, the word [iʔi | ʔaʃ] transliterates to “visual idea”, which translates to *art*. +For example, the word [iʔi | ʔaʃ] transliterates to “visual idea”, which translates to *art*. In AshashatCore, the +``AshashatWord/sense(_:)`` modifier can be used: + +```swift +let art: some AshashatWord = { + AshashatPrimitive.idea + .sense(.visual) +}() +``` ## Colors Color modifiers are prefixes to primitives and modifiers that describe the color of an item. They can be combined using -logical intensity operators and are **never** used to describe the race of a person. +logical intensity operators and are **never** used to describe the race of a person. In AshashatCore, this is +represented by ``AshashatColorModifier``. | Color | [ʔaʃaʃat] | | :----- | :-------- | @@ -265,19 +291,38 @@ logical intensity operators and are **never** used to describe the race of a per For example, the word [titi | uʔu | ʔilin] transliterates to “red tastable/edible sphere”, which translates to *apple*. +In AshashatCore, the ``AshashatWord/color(_:)`` and/or ``AshashatWord/action(_:properties:)`` modifiers can be used: + +```swift +let apple: some AshashatWord = { + AshashatShape.sphere + .sense(.tastable) + .color(.red) +}() +``` > Tip: To disambiguate between the fruit "apple" and the consumer electronics company "Apple, Inc.", “apple” will always > be written as described above. Apple Inc. is written as a name with repair strategies applied ([e:pulu]). ## Speed -Speed modifiers are prefixes to primitives and modifiers that describe the speed of an action or item in question. +Speed modifiers are prefixes to primitives and modifiers that describe the speed of an action or item in question. In +AshashatCore, this is represented by ``AshashatSpeedModifier``. | Speed | [ʔaʃaʃat] | | :---- | :-------- | | slow | ake | | fast | ak'i | +In AshashatCore, the ``AshashatWord/speed(_:)`` modifier can be used: + +```swift +let fastBall: some AshashatWord = { + AshashatShape.sphere + .speed(.fast) +}() +``` + ## Topics ### Modifiers @@ -311,3 +356,35 @@ Speed modifiers are prefixes to primitives and modifiers that describe the speed - ``AshashatWord/logicalConjunction(using:)`` - ``AshashatLogicalConjunctionModifier`` - ``LogicalAshashatWord`` + +### Scientific Domain + +- ``AshashatWord/scientificDomain(_:)`` +- ``AshashatScientificModifier`` +- ``ScientificDomainAshashatWord`` + +### Size and Scale + +- ``AshashatWord/scaled(to:axis:)`` +- ``AshashatScaleModifier`` +- ``AshashatScaleAxisModifier`` +- ``ScaledAshashatWord`` + +### Senses + +- ``AshashatWord/sense(_:)`` +- ``AshashatSenseModifier`` +- ``SenseAshashatWord`` + +### Color + +- ``AshashatWord/color(_:)`` +- ``AshashatWord/color(_:propertiesBuilder:)`` +- ``AshashatColorModifier`` +- ``ColorizedAshashatWord`` + +### Speed + +- ``AshashatWord/speed(_:)`` +- ``AshashatSpeedModifier`` +- ``MovingAshashatWord`` diff --git a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatColorModifier.swift b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatColorModifier.swift index c105d26..7419542 100644 --- a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatColorModifier.swift +++ b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatColorModifier.swift @@ -16,15 +16,33 @@ import Foundation import ConlangKit +/// A modifier that represents colors in [ʔaʃaʃat]. public enum AshashatColorModifier: AshashatModifier { + /// A red color. case red + + /// An orange color. case orange + + /// A yellow color. case yellow + + /// A green color. case green + + /// A blue color. case blue + + /// An indigo color. case indigo + + /// A purple color. case pruple + + /// A black color. case black + + /// A white color. case white public var word: some LinguisticRepresentable { @@ -51,6 +69,10 @@ public enum AshashatColorModifier: AshashatModifier { } } +/// A word with an associated color. +/// +/// This can only be constructed with the ``AshashatWord/color(_:)`` or ``AshashatWord/color(_:propertiesBuilder:)`` +/// modifiers. public struct ColorizedAshashatWord: AshashatWord { var color: AshashatColorModifier var uncoloredItem: UncoloredItem @@ -79,10 +101,38 @@ extension ColorizedAshashatWord: CustomStringConvertible { } public extension AshashatWord { + /// Associates the word with a specified color. + /// + /// Colors are applied as prefixes to a word. For example, the following produces "apple": + /// + /// ```swift + /// let apple: some AshashatWord = { + /// AshashatShape.sphere + /// .sense(.tastable) + /// .color(.red) + /// }() + /// ``` + /// + /// - Parameter color: The color to associated with the word. func color(_ color: AshashatColorModifier) -> some AshashatWord { ColorizedAshashatWord(color: color, uncoloredItem: self) } + /// Associates the word with a specified color. + /// + /// Colors are applied as prefixes to a word. For example, the following produces "apple": + /// + /// ```swift + /// let apple: some AshashatWord = { + /// AshashatShape.sphere + /// .sense(.tastable) + /// .color(.red) + /// }() + /// ``` + /// + /// - Parameter color: The color to associated with the word. + /// - Parameter propertiesBuilder: A closure that transforms the color. Use this for modifiers that require + /// modifying an existing modifier. func color( _ color: AshashatColorModifier, propertiesBuilder: @escaping (AshashatColorModifier) -> some AshashatWord diff --git a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScaleModifier.swift b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScaleModifier.swift index 20e749e..5278200 100644 --- a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScaleModifier.swift +++ b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScaleModifier.swift @@ -16,9 +16,15 @@ import ConlangKit import Foundation +/// A modifier that contains scaleable sizes in [ʔaʃaʃat]. public enum AshashatScaleModifier: AshashatModifier { + /// A small scale or size. case small + + /// A medium scale or size. case medium + + /// A large scale or size. case large public var word: some LinguisticRepresentable { @@ -33,8 +39,12 @@ public enum AshashatScaleModifier: AshashatModifier { } } +/// A modifer that specifies an axis for a scale or size in [ʔaʃaʃat]. public enum AshashatScaleAxisModifier: AshashatModifier { + /// Applies along a word's length. case length + + /// Applies along a word's width. case width public var word: some LinguisticRepresentable { @@ -47,6 +57,9 @@ public enum AshashatScaleAxisModifier: AshashatModifier { } } +/// An [ʔaʃaʃat] word with an associated scale, with an optional axis. +/// +/// This can only be constructed with the ``scaled(to:axis:)`` modifier. public struct ScaledAshashatWord: AshashatWord { var scale: AshashatScaleModifier var axis: AshashatScaleAxisModifier? @@ -88,6 +101,20 @@ extension ScaledAshashatWord: CustomStringConvertible { } public extension AshashatWord { + /// Applies a scale to a specified word. + /// + /// Scales/sizes are applied as suffixes to a word, along with an axis if specified. For example, the following + /// produces "big ball": + /// + /// ```swift + /// let bigBall: some AshashatWord = { + /// AshashatShape.sphere + /// .scaled(to: .large) + /// }() + /// ``` + /// + /// - Parameter scale: The scale or size of the word. + /// - Parameter axis: The axis of which the scale applies, if applicable. func scaled(to scale: AshashatScaleModifier, axis: AshashatScaleAxisModifier? = nil) -> some AshashatWord { ScaledAshashatWord(scale: scale, axis: axis, reference: self) } diff --git a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScientificModifier.swift b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScientificModifier.swift index d0f06b5..ad796a4 100644 --- a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScientificModifier.swift +++ b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatScientificModifier.swift @@ -16,10 +16,18 @@ import Foundation import ConlangKit +/// A modifier that represents scientific domains in [ʔaʃaʃat]. public enum AshashatScientificModifier: AshashatModifier { + /// The item or word has natural or biological properties to it. case natural + + /// The item or word has physical properties to it. case physical + + /// The item or word has chemical properties to it. case chemical + + /// The item or word has electrical properties to it. case electrical public var word: some LinguisticRepresentable { @@ -36,6 +44,9 @@ public enum AshashatScientificModifier: AshashatModifier { } } +/// A word that has an associated scientific domain. +/// +/// This can only be constructed through the ``AshashatWord/scientificDomain(_:)`` modifier. public struct ScientificDomainAshashatWord: AshashatWord { var domain: AshashatScientificModifier var reference: Object @@ -63,6 +74,18 @@ extension ScientificDomainAshashatWord: CustomStringConvertible { } public extension AshashatWord { + /// Associates the word with a given scientific domain. + /// + /// Scientific domains are applied as circumfixes to a word. For example, the following produces "tablet/iPad": + /// + /// ```swift + /// let iPad: some AshashatWord = { + /// AshashatShape.slab + /// .scientificDomain(.electrical) + /// }() + /// ``` + /// + /// - Parameter domain: The scientific domain that the word applies to. func scientificDomain(_ domain: AshashatScientificModifier) -> some AshashatWord { ScientificDomainAshashatWord(domain: domain, reference: self) } diff --git a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSenseModifier.swift b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSenseModifier.swift index c59e87c..3d83c07 100644 --- a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSenseModifier.swift +++ b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSenseModifier.swift @@ -16,11 +16,21 @@ import Foundation import ConlangKit +/// A modifier containing [ʔaʃaʃat] senses. public enum AshashatSenseModifier: AshashatModifier { + /// The word or item can be heard, or it produces sound. case audio + + /// The word or item can be seen, or it produces visual content. case visual + + /// The word or item can be smelled, or it produces a fragrance. case sniffable + + /// The word or item can be tasted. case tastable + + /// The word or item can be touched, or it touches another item. case tactile public var word: some LinguisticRepresentable { @@ -39,6 +49,9 @@ public enum AshashatSenseModifier: AshashatModifier { } } +/// A word with an associated sense. +/// +/// This can only be constructed with the ``AshashatWord/sense(_:)`` modifier. public struct SenseAshashatWord: AshashatWord { var sense: AshashatSenseModifier var reference: Reference @@ -67,6 +80,19 @@ extension SenseAshashatWord: CustomStringConvertible { } public extension AshashatWord { + /// Associates the word with a specified sense. + /// + /// Senses are applied as prefixes to a word. For example, the following produces "apple": + /// + /// ```swift + /// let apple: some AshashatWord = { + /// AshashatShape.sphere + /// .sense(.tastable) + /// .color(.red) + /// }() + /// ``` + /// + /// - Parameter sense: The sense to associate with this word. func sense(_ sense: AshashatSenseModifier) -> some AshashatWord { SenseAshashatWord(sense: sense, reference: self) } diff --git a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSpeedModifier.swift b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSpeedModifier.swift index fb554e6..9ed728f 100644 --- a/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSpeedModifier.swift +++ b/Ashashat/Sources/AshashatCore/Lingustics/Modifiers/AshashatSpeedModifier.swift @@ -16,8 +16,12 @@ import Foundation import ConlangKit +/// A modifier containing [ʔaʃaʃat] speeds. public enum AshashatSpeedModifier: AshashatModifier { + /// A slow speed. case slow + + /// A fast speed. case fast public var word: some LinguisticRepresentable { @@ -30,6 +34,9 @@ public enum AshashatSpeedModifier: AshashatModifier { } } +/// An [ʔaʃaʃat] word with an associated speed. +/// +/// This can only be constructed using the ``AshashatWord/speed(_:)`` modifier. public struct MovingAshashatWord: AshashatWord { var speed: AshashatSpeedModifier var mass: Mass @@ -58,6 +65,18 @@ extension MovingAshashatWord: CustomStringConvertible { } public extension AshashatWord { + /// Applies a speed modifier to the word. + /// + /// Speed modifiers are applied as prefixes to a given word. For example, the following will produce "fast ball": + /// + /// ```swift + /// let fastBall: some AshashatWord = { + /// AshashatShape.sphere + /// .speed(.fast) + /// }() + /// ``` + /// + /// - Parameter speed: The speed at which the item moves. func speed(_ speed: AshashatSpeedModifier) -> some AshashatWord { MovingAshashatWord(speed: speed, mass: self) }