diff options
author | Eduardo Julian | 2021-08-21 04:06:54 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-21 04:06:54 -0400 |
commit | 1ea83ecadccc5adee1bdb35bd11527c3982c015e (patch) | |
tree | b2a701e6eb14469d55a4f88af3f398a7d7056121 /stdlib/source/documentation | |
parent | 374ccf07246484eb7beb2cd87f3fc88396373ee1 (diff) |
Can now produce arbitrary code fragments statically by evaluating arbitrary expressions at compile-time.
Diffstat (limited to 'stdlib/source/documentation')
22 files changed, 1834 insertions, 25 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 2376510b5..4a964e552 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -15,9 +15,8 @@ ["#." debug] ["#." documentation] ["#." ffi] - ... ["#." locale] - ... ["#." macro - ... ["#/." code]] + ["#." locale] + ["#." macro] ... ["#." math] ... ["#." meta] ["#." program] @@ -32,27 +31,19 @@ ... <target>] ]) -(documentation: /.:of - "Generates the type corresponding to a given expression." - [(let [my_num +123] - (:of my_num)) - "=>" - .Int] - [(:of +123) - "=>" - .Int]) - (.def: .public documentation (.List $.Module) ($.module /._ "" - [..:of] + [] [/abstract.documentation /control.documentation /data.documentation /debug.documentation /documentation.documentation /ffi.documentation + /locale.documentation + /macro.documentation /program.documentation])) diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux index 51c28a5ef..7887d97f6 100644 --- a/stdlib/source/documentation/lux/data/text.lux +++ b/stdlib/source/documentation/lux/data/text.lux @@ -1,9 +1,9 @@ (.module: [library - [lux #* + [lux (#- char) ["$" documentation (#+ documentation:)] [data - [text (#+ \n) + [text ["%" format (#+ format)]] [collection ["." list]]]]] @@ -13,15 +13,162 @@ ["#." escape] ["#." format] ["#." regex] - ["#." unicode]]) + ["#." unicode]] + [\\library + ["." /]]) + +(documentation: /.Char + "A character code number.") + +(documentation: /.line_feed + "Same as 'new_line'.") + +(documentation: /.char + "Yields the character at the specified index." + [(char index input)]) + +(documentation: /.index' + "" + [(index' from pattern input)]) + +(documentation: /.index + "" + [(index pattern input)]) + +(documentation: /.last_index + "" + [(last_index part text)]) + +(documentation: /.starts_with? + "" + [(starts_with? prefix x)]) + +(documentation: /.ends_with? + "" + [(ends_with? postfix x)]) + +(documentation: /.enclosed_by? + "" + [(enclosed_by? boundary value)]) + +(documentation: /.contains? + "" + [(contains? sub text)]) + +(documentation: /.prefix + "" + [(prefix param subject)]) + +(documentation: /.suffix + "" + [(suffix param subject)]) + +(documentation: /.enclosed + "Surrounds the given content text with left and right side additions." + [(enclosed [left right] content)]) + +(documentation: /.enclosed' + "Surrounds the given content text with the same boundary text." + [(enclosed' boundary content)]) + +(documentation: /.clip + "Clips a chunk of text from the input at the specified offset and of the specified size." + [(clip offset size input)]) + +(documentation: /.clip' + "Clips the remaining text from the input at the specified offset." + [(clip' offset input)]) + +(documentation: /.split_at + "" + [(split_at at x)]) + +(documentation: /.split_by + "" + [(split_by token sample)]) + +(documentation: /.all_split_by + "" + [(all_split_by token sample)]) + +(documentation: /.replaced/1 + "" + [(replaced/1 pattern replacement template)]) + +(documentation: /.replaced + "" + [(replaced pattern replacement template)]) + +(documentation: /.interposed + "" + [(interposed separator texts)]) + +(documentation: /.space? + "Checks whether the character is white-space." + [(space? char)]) (.def: .public documentation (.List $.Module) - (list.together - (list /buffer.documentation - /encoding.documentation - /escape.documentation - /format.documentation - /regex.documentation - /unicode.documentation - ))) + ($.module /._ + "" + [..Char + ..line_feed + ..char + ..index' + ..index + ..last_index + ..starts_with? + ..ends_with? + ..enclosed_by? + ..contains? + ..prefix + ..suffix + ..enclosed + ..enclosed' + ..clip + ..clip' + ..split_at + ..split_by + ..all_split_by + ..replaced/1 + ..replaced + ..interposed + ..space? + ($.default /.of_char) + + ($.default /.\0) + ($.default /.null) + ($.default /.\a) + ($.default /.alarm) + ($.default /.\b) + ($.default /.back_space) + ($.default /.\t) + ($.default /.tab) + ($.default /.\n) + ($.default /.new_line) + ($.default /.\v) + ($.default /.vertical_tab) + ($.default /.\f) + ($.default /.form_feed) + ($.default /.\r) + ($.default /.carriage_return) + ($.default /.\'') + ($.default /.double_quote) + + ($.default /.size) + ($.default /.format) + ($.default /.equivalence) + ($.default /.order) + ($.default /.monoid) + ($.default /.hash) + ($.default /.together) + ($.default /.empty?) + ($.default /.space) + ($.default /.lower_cased) + ($.default /.upper_cased)] + [/buffer.documentation + /encoding.documentation + /escape.documentation + /format.documentation + /regex.documentation + /unicode.documentation])) diff --git a/stdlib/source/documentation/lux/locale.lux b/stdlib/source/documentation/lux/locale.lux new file mode 100644 index 000000000..f299d2a96 --- /dev/null +++ b/stdlib/source/documentation/lux/locale.lux @@ -0,0 +1,33 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." language] + ["#." territory]] + [\\library + ["." /]]) + +(documentation: /.Locale + "A description of a locale; with territory, (optional) language, and (optional) text-encoding.") + +(documentation: /.locale + "" + [(locale language territory encoding)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Locale + ..locale + ($.default /.code) + ($.default /.hash) + ($.default /.equivalence)] + [/language.documentation + /territory.documentation])) diff --git a/stdlib/source/documentation/lux/locale/language.lux b/stdlib/source/documentation/lux/locale/language.lux new file mode 100644 index 000000000..fc720ddb1 --- /dev/null +++ b/stdlib/source/documentation/lux/locale/language.lux @@ -0,0 +1,660 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list ("#\." monoid)]]]]] + [\\library + ["." /]]) + +(documentation: /.Language + "An ISO 639 language.") + +(def: items/~ + (list.together + (list ($.default /.uncoded) + ($.default /.multiple) + ($.default /.undetermined) + ($.default /.not_applicable)))) + +(def: items/a + (list.together + (list ($.default /.afar) + ($.default /.abkhazian) + ($.default /.achinese) + ($.default /.acoli) + ($.default /.adangme) + ($.default /.adyghe) + ($.default /.afro_asiatic) + ($.default /.afrihili) + ($.default /.afrikaans) + ($.default /.ainu) + ($.default /.akan) + ($.default /.akkadian) + ($.default /.aleut) + ($.default /.algonquian) + ($.default /.southern_altai) + ($.default /.amharic) + ($.default /.old_english) + ($.default /.angika) + ($.default /.apache) + ($.default /.arabic) + ($.default /.official_aramaic) + ($.default /.imperial_aramaic) + ($.default /.aragonese) + ($.default /.mapudungun) + ($.default /.arapaho) + ($.default /.artificial) + ($.default /.arawak) + ($.default /.assamese) + ($.default /.asturian) + ($.default /.bable) + ($.default /.leonese) + ($.default /.asturleonese) + ($.default /.athapascan) + ($.default /.australian) + ($.default /.avaric) + ($.default /.avestan) + ($.default /.awadhi) + ($.default /.aymara) + ($.default /.azerbaijani)))) + +(def: items/b + (list.together + (list ($.default /.banda) + ($.default /.bamileke) + ($.default /.bashkir) + ($.default /.baluchi) + ($.default /.bambara) + ($.default /.balinese) + ($.default /.basa) + ($.default /.baltic) + ($.default /.beja) + ($.default /.belarusian) + ($.default /.bemba) + ($.default /.bengali) + ($.default /.berber) + ($.default /.bhojpuri) + ($.default /.bihari) + ($.default /.bikol) + ($.default /.bini) + ($.default /.edo) + ($.default /.bislama) + ($.default /.siksika) + ($.default /.bantu) + ($.default /.tibetan) + ($.default /.bosnian) + ($.default /.braj) + ($.default /.breton) + ($.default /.batak) + ($.default /.buriat) + ($.default /.buginese) + ($.default /.bulgarian) + ($.default /.blin) + ($.default /.bilin)))) + +(def: items/c + (list.together + (list ($.default /.caddo) + ($.default /.central_american_indian) + ($.default /.galibi_carib) + ($.default /.catalan) + ($.default /.valencian) + ($.default /.caucasian) + ($.default /.cebuano) + ($.default /.celtic) + ($.default /.czech) + ($.default /.chamorro) + ($.default /.chibcha) + ($.default /.chechen) + ($.default /.chagatai) + ($.default /.chuukese) + ($.default /.mari) + ($.default /.chinook) + ($.default /.choctaw) + ($.default /.chipewyan) + ($.default /.cherokee) + ($.default /.church_slavic) + ($.default /.old_slavonic) + ($.default /.church_slavonic) + ($.default /.old_bulgarian) + ($.default /.old_church_slavonic) + ($.default /.chuvash) + ($.default /.cheyenne) + ($.default /.chamic) + ($.default /.montenegrin) + ($.default /.coptic) + ($.default /.cornish) + ($.default /.corsican) + ($.default /.creoles_and_pidgins/english) + ($.default /.creoles_and_pidgins/french) + ($.default /.creoles_and_pidgins/portuguese) + ($.default /.cree) + ($.default /.crimean) + ($.default /.creoles_and_pidgins) + ($.default /.kashubian) + ($.default /.cushitic) + ($.default /.welsh)))) + +(def: items/d + (list.together + (list ($.default /.dakota) + ($.default /.danish) + ($.default /.dargwa) + ($.default /.land_dayak) + ($.default /.delaware) + ($.default /.slavey) + ($.default /.german) + ($.default /.dogrib) + ($.default /.dinka) + ($.default /.dhivehi) + ($.default /.maldivian) + ($.default /.dogri) + ($.default /.dravidian) + ($.default /.lower_sorbian) + ($.default /.duala) + ($.default /.middle_dutch) + ($.default /.dyula) + ($.default /.dzongkha)))) + +(def: items/e + (list.together + (list ($.default /.efik) + ($.default /.egyptian) + ($.default /.ekajuk) + ($.default /.greek) + ($.default /.elamite) + ($.default /.english) + ($.default /.middle_english) + ($.default /.esperanto) + ($.default /.estonian) + ($.default /.basque) + ($.default /.ewe) + ($.default /.ewondo)))) + +(def: items/f + (list.together + (list ($.default /.fang) + ($.default /.faroese) + ($.default /.persian) + ($.default /.fanti) + ($.default /.fijian) + ($.default /.filipino) + ($.default /.finnish) + ($.default /.finno_ugrian) + ($.default /.fon) + ($.default /.french) + ($.default /.middle_french) + ($.default /.old_french) + ($.default /.northern_frisian) + ($.default /.eastern_frisian) + ($.default /.western_frisian) + ($.default /.fulah) + ($.default /.friulian)))) + +(def: items/g + (list.together + (list ($.default /.ga) + ($.default /.gayo) + ($.default /.gbaya) + ($.default /.germanic) + ($.default /.geez) + ($.default /.gilbertese) + ($.default /.gaelic) + ($.default /.irish) + ($.default /.galician) + ($.default /.manx) + ($.default /.middle_high_german) + ($.default /.old_high_german) + ($.default /.gondi) + ($.default /.gorontalo) + ($.default /.gothic) + ($.default /.grebo) + ($.default /.ancient_greek) + ($.default /.guarani) + ($.default /.swiss_german) + ($.default /.alemannic) + ($.default /.alsatian) + ($.default /.gujarati) + ($.default /.gwich'in)))) + +(def: items/h + (list.together + (list ($.default /.haida) + ($.default /.haitian) + ($.default /.hausa) + ($.default /.hawaiian) + ($.default /.hebrew) + ($.default /.herero) + ($.default /.hiligaynon) + ($.default /.himachali) + ($.default /.hindi) + ($.default /.hittite) + ($.default /.hmong) + ($.default /.hiri_motu) + ($.default /.croatian) + ($.default /.upper_sorbian) + ($.default /.hungarian) + ($.default /.hupa) + ($.default /.armenian)))) + +(def: items/i + (list.together + (list ($.default /.iban) + ($.default /.igbo) + ($.default /.ido) + ($.default /.sichuan_yi) + ($.default /.nuosu) + ($.default /.ijo) + ($.default /.inuktitut) + ($.default /.interlingue) + ($.default /.iloko) + ($.default /.interlingua) + ($.default /.indic) + ($.default /.indonesian) + ($.default /.indo_european) + ($.default /.ingush) + ($.default /.inupiaq) + ($.default /.iranian) + ($.default /.iroquoian) + ($.default /.icelandic) + ($.default /.italian)))) + +(def: items/j + (list.together + (list ($.default /.javanese) + ($.default /.lojban) + ($.default /.japanese) + ($.default /.judeo_persian) + ($.default /.judeo_arabic)))) + +(def: items/k + (list.together + (list ($.default /.kara_kalpak) + ($.default /.kabyle) + ($.default /.kachin) + ($.default /.jingpho) + ($.default /.kalaallisut) + ($.default /.greenlandic) + ($.default /.kamba) + ($.default /.kannada) + ($.default /.karen) + ($.default /.kashmiri) + ($.default /.georgian) + ($.default /.kanuri) + ($.default /.kawi) + ($.default /.kazakh) + ($.default /.kabardian) + ($.default /.khasi) + ($.default /.khoisan) + ($.default /.central_khmer) + ($.default /.khotanese) + ($.default /.sakan) + ($.default /.gikuyu) + ($.default /.kinyarwanda) + ($.default /.kyrgyz) + ($.default /.kimbundu) + ($.default /.konkani) + ($.default /.komi) + ($.default /.kongo) + ($.default /.korean) + ($.default /.kosraean) + ($.default /.kpelle) + ($.default /.karachay_balkar) + ($.default /.karelian) + ($.default /.kru) + ($.default /.kurukh) + ($.default /.kwanyama) + ($.default /.kumyk) + ($.default /.kurdish) + ($.default /.kutenai)))) + +(def: items/l + (list.together + (list ($.default /.ladino) + ($.default /.lahnda) + ($.default /.lamba) + ($.default /.lao) + ($.default /.latin) + ($.default /.latvian) + ($.default /.lezghian) + ($.default /.limburgan) + ($.default /.lingala) + ($.default /.lithuanian) + ($.default /.mongo) + ($.default /.lozi) + ($.default /.luxembourgish) + ($.default /.luba_lulua) + ($.default /.luba_katanga) + ($.default /.ganda) + ($.default /.luiseno) + ($.default /.lunda) + ($.default /.luo) + ($.default /.lushai)))) + +(def: items/m + (list.together + (list ($.default /.madurese) + ($.default /.magahi) + ($.default /.marshallese) + ($.default /.maithili) + ($.default /.makasar) + ($.default /.malayalam) + ($.default /.mandingo) + ($.default /.austronesian) + ($.default /.marathi) + ($.default /.masai) + ($.default /.moksha) + ($.default /.mandar) + ($.default /.mende) + ($.default /.middle_irish) + ($.default /.mi'kmaq) + ($.default /.micmac) + ($.default /.minangkabau) + ($.default /.macedonian) + ($.default /.mon_khmer) + ($.default /.malagasy) + ($.default /.maltese) + ($.default /.manchu) + ($.default /.manipuri) + ($.default /.manobo) + ($.default /.mohawk) + ($.default /.mongolian) + ($.default /.mossi) + ($.default /.maori) + ($.default /.malay) + ($.default /.munda) + ($.default /.creek) + ($.default /.mirandese) + ($.default /.marwari) + ($.default /.burmese) + ($.default /.mayan) + ($.default /.erzya)))) + +(def: items/n + (list.together + (list ($.default /.nahuatl) + ($.default /.north_american_indian) + ($.default /.neapolitan) + ($.default /.nauru) + ($.default /.navajo) + ($.default /.south_ndebele) + ($.default /.north_ndebele) + ($.default /.ndonga) + ($.default /.low_german) + ($.default /.nepali) + ($.default /.newari) + ($.default /.nepal_bhasa) + ($.default /.nias) + ($.default /.niger_kordofanian) + ($.default /.niuean) + ($.default /.dutch) + ($.default /.flemish) + ($.default /.nynorsk) + ($.default /.bokmal) + ($.default /.nogai) + ($.default /.old_norse) + ($.default /.norwegian) + ($.default /.n'ko) + ($.default /.northern_sotho) + ($.default /.pedi) + ($.default /.sepedi) + ($.default /.nubian) + ($.default /.old_newari) + ($.default /.classical_newari) + ($.default /.classical_nepal_bhasa) + ($.default /.nyanja) + ($.default /.chichewa) + ($.default /.chewa) + ($.default /.nyamwezi) + ($.default /.nyankole) + ($.default /.nyoro) + ($.default /.nzima)))) + +(def: items/o + (list.together + (list ($.default /.occitan) + ($.default /.provencal) + ($.default /.ojibwa) + ($.default /.oriya) + ($.default /.oromo) + ($.default /.osage) + ($.default /.ossetic) + ($.default /.ottoman_turkish) + ($.default /.otomian)))) + +(def: items/p + (list.together + (list ($.default /.papuan) + ($.default /.pangasinan) + ($.default /.pahlavi) + ($.default /.pampanga) + ($.default /.kapampangan) + ($.default /.punjabi) + ($.default /.papiamento) + ($.default /.palauan) + ($.default /.old_persian) + ($.default /.philippine) + ($.default /.phoenician) + ($.default /.pali) + ($.default /.polish) + ($.default /.pohnpeian) + ($.default /.portuguese) + ($.default /.prakrit) + ($.default /.old_provencal) + ($.default /.pashto)))) + +(def: items/q + (list.together + (list ($.default /.quechua)))) + +(def: items/r + (list.together + (list ($.default /.rajasthani) + ($.default /.rapanui) + ($.default /.rarotongan) + ($.default /.cook_islands_maori) + ($.default /.romance) + ($.default /.romansh) + ($.default /.romany) + ($.default /.romanian) + ($.default /.moldavian) + ($.default /.moldovan) + ($.default /.rundi) + ($.default /.aromanian) + ($.default /.arumanian) + ($.default /.macedo_romanian) + ($.default /.russian)))) + +(def: items/s + (list.together + (list ($.default /.sandawe) + ($.default /.sango) + ($.default /.yakut) + ($.default /.south_american_indian) + ($.default /.salishan) + ($.default /.samaritan_aramaic) + ($.default /.sanskrit) + ($.default /.sasak) + ($.default /.santali) + ($.default /.sicilian) + ($.default /.scots) + ($.default /.selkup) + ($.default /.semitic) + ($.default /.old_irish) + ($.default /.sign) + ($.default /.shan) + ($.default /.sidamo) + ($.default /.sinhalese) + ($.default /.siouan) + ($.default /.sino_tibetan) + ($.default /.slavic) + ($.default /.slovak) + ($.default /.slovenian) + ($.default /.southern_sami) + ($.default /.northern_sami) + ($.default /.sami) + ($.default /.lule) + ($.default /.inari) + ($.default /.samoan) + ($.default /.skolt_sami) + ($.default /.shona) + ($.default /.sindhi) + ($.default /.soninke) + ($.default /.sogdian) + ($.default /.somali) + ($.default /.songhai) + ($.default /.southern_sotho) + ($.default /.spanish) + ($.default /.castilian) + ($.default /.albanian) + ($.default /.sardinian) + ($.default /.sranan_tongo) + ($.default /.serbian) + ($.default /.serer) + ($.default /.nilo_saharan) + ($.default /.swati) + ($.default /.sukuma) + ($.default /.sundanese) + ($.default /.susu) + ($.default /.sumerian) + ($.default /.swahili) + ($.default /.swedish) + ($.default /.classical_syriac) + ($.default /.syriac)))) + +(def: items/t + (list.together + (list ($.default /.tahitian) + ($.default /.tai) + ($.default /.tamil) + ($.default /.tatar) + ($.default /.telugu) + ($.default /.timne) + ($.default /.tereno) + ($.default /.tetum) + ($.default /.tajik) + ($.default /.tagalog) + ($.default /.thai) + ($.default /.tigre) + ($.default /.tigrinya) + ($.default /.tiv) + ($.default /.tokelau) + ($.default /.klingon) + ($.default /.tlingit) + ($.default /.tamashek) + ($.default /.tonga) + ($.default /.tongan) + ($.default /.tok_pisin) + ($.default /.tsimshian) + ($.default /.tswana) + ($.default /.tsonga) + ($.default /.turkmen) + ($.default /.tumbuka) + ($.default /.tupi) + ($.default /.turkish) + ($.default /.altaic) + ($.default /.tuvalu) + ($.default /.twi) + ($.default /.tuvinian)))) + +(def: items/u + (list.together + (list ($.default /.udmurt) + ($.default /.ugaritic) + ($.default /.uyghur) + ($.default /.ukrainian) + ($.default /.umbundu) + ($.default /.urdu) + ($.default /.uzbek)))) + +(def: items/v + (list.together + (list ($.default /.vai) + ($.default /.venda) + ($.default /.vietnamese) + ($.default /.volapük) + ($.default /.votic)))) + +(def: items/w + (list.together + (list ($.default /.wakashan) + ($.default /.walamo) + ($.default /.waray) + ($.default /.washo) + ($.default /.sorbian) + ($.default /.walloon) + ($.default /.wolof)))) + +(def: items/x + (list.together + (list ($.default /.kalmyk) + ($.default /.oirat) + ($.default /.xhosa)))) + +(def: items/y + (list.together + (list ($.default /.yao) + ($.default /.yapese) + ($.default /.yiddish) + ($.default /.yoruba) + ($.default /.yupik)))) + +(def: items/z + (list.together + (list ($.default /.zapotec) + ($.default /.blissymbols) + ($.default /.zenaga) + ($.default /.standard_moroccan_tamazight) + ($.default /.zhuang) + ($.default /.chinese) + ($.default /.zande) + ($.default /.zulu) + ($.default /.zuni) + ($.default /.zaza) + ($.default /.dimili) + ($.default /.dimli) + ($.default /.kirdki) + ($.default /.kirmanjki) + ($.default /.zazaki)))) + +(.def: .public documentation + (.List $.Module) + (`` ($.module /._ + "" + [..Language + ($.default /.name) + ($.default /.code) + ($.default /.equivalence) + ($.default /.hash) + ..items/~ + ..items/a + ..items/b + ..items/c + ..items/d + ..items/e + ..items/f + ..items/g + ..items/h + ..items/i + ..items/j + ..items/k + ..items/l + ..items/m + ..items/n + ..items/o + ..items/p + ..items/q + ..items/r + ..items/s + ..items/t + ..items/u + ..items/v + ..items/w + ..items/x + ..items/y + ..items/z] + []))) diff --git a/stdlib/source/documentation/lux/locale/territory.lux b/stdlib/source/documentation/lux/locale/territory.lux new file mode 100644 index 000000000..eb4553615 --- /dev/null +++ b/stdlib/source/documentation/lux/locale/territory.lux @@ -0,0 +1,321 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list ("#\." monoid)]]]]] + [\\library + ["." /]]) + +(documentation: /.Territory + "An ISO 3166 territory.") + +(def: items/ab + (list.together + (list ($.default /.afghanistan) + ($.default /.aland_islands) + ($.default /.albania) + ($.default /.algeria) + ($.default /.american_samoa) + ($.default /.andorra) + ($.default /.angola) + ($.default /.anguilla) + ($.default /.antarctica) + ($.default /.antigua) + ($.default /.barbuda) + ($.default /.argentina) + ($.default /.armenia) + ($.default /.aruba) + ($.default /.australia) + ($.default /.austria) + ($.default /.azerbaijan) + ($.default /.the_bahamas) + ($.default /.bahrain) + ($.default /.bangladesh) + ($.default /.barbados) + ($.default /.belarus) + ($.default /.belgium) + ($.default /.belize) + ($.default /.benin) + ($.default /.bermuda) + ($.default /.bhutan) + ($.default /.bolivia) + ($.default /.bonaire) + ($.default /.sint_eustatius) + ($.default /.saba) + ($.default /.bosnia) + ($.default /.herzegovina) + ($.default /.botswana) + ($.default /.bouvet_island) + ($.default /.brazil) + ($.default /.british_indian_ocean_territory) + ($.default /.brunei_darussalam) + ($.default /.bulgaria) + ($.default /.burkina_faso) + ($.default /.burundi)))) + +(def: items/cd + (list.together + (list ($.default /.cape_verde) + ($.default /.cambodia) + ($.default /.cameroon) + ($.default /.canada) + ($.default /.cayman_islands) + ($.default /.central_african_republic) + ($.default /.chad) + ($.default /.chile) + ($.default /.china) + ($.default /.christmas_island) + ($.default /.cocos_islands) + ($.default /.colombia) + ($.default /.comoros) + ($.default /.congo) + ($.default /.democratic_republic_of_the_congo) + ($.default /.cook_islands) + ($.default /.costa_rica) + ($.default /.ivory_coast) + ($.default /.croatia) + ($.default /.cuba) + ($.default /.curacao) + ($.default /.cyprus) + ($.default /.czech_republic) + ($.default /.denmark) + ($.default /.djibouti) + ($.default /.dominica) + ($.default /.dominican_republic)))) + +(def: items/efg + (list.together + (list ($.default /.ecuador) + ($.default /.egypt) + ($.default /.el_salvador) + ($.default /.equatorial_guinea) + ($.default /.eritrea) + ($.default /.estonia) + ($.default /.eswatini) + ($.default /.ethiopia) + ($.default /.falkland_islands) + ($.default /.faroe_islands) + ($.default /.fiji) + ($.default /.finland) + ($.default /.france) + ($.default /.french_guiana) + ($.default /.french_polynesia) + ($.default /.french_southern_territories) + ($.default /.gabon) + ($.default /.the_gambia) + ($.default /.georgia) + ($.default /.germany) + ($.default /.ghana) + ($.default /.gibraltar) + ($.default /.greece) + ($.default /.greenland) + ($.default /.grenada) + ($.default /.guadeloupe) + ($.default /.guam) + ($.default /.guatemala) + ($.default /.guernsey) + ($.default /.guinea) + ($.default /.guinea_bissau) + ($.default /.guyana)))) + +(def: items/hijkl + (list.together + (list ($.default /.haiti) + ($.default /.heard_island) + ($.default /.mcdonald_islands) + ($.default /.vatican_city) + ($.default /.honduras) + ($.default /.hong_kong) + ($.default /.hungary) + ($.default /.iceland) + ($.default /.india) + ($.default /.indonesia) + ($.default /.iran) + ($.default /.iraq) + ($.default /.ireland) + ($.default /.isle_of_man) + ($.default /.israel) + ($.default /.italy) + ($.default /.jamaica) + ($.default /.japan) + ($.default /.jersey) + ($.default /.jordan) + ($.default /.kazakhstan) + ($.default /.kenya) + ($.default /.kiribati) + ($.default /.north_korea) + ($.default /.south_korea) + ($.default /.kuwait) + ($.default /.kyrgyzstan) + ($.default /.laos) + ($.default /.latvia) + ($.default /.lebanon) + ($.default /.lesotho) + ($.default /.liberia) + ($.default /.libya) + ($.default /.liechtenstein) + ($.default /.lithuania) + ($.default /.luxembourg)))) + +(def: items/mno + (list.together + (list ($.default /.macau) + ($.default /.macedonia) + ($.default /.madagascar) + ($.default /.malawi) + ($.default /.malaysia) + ($.default /.maldives) + ($.default /.mali) + ($.default /.malta) + ($.default /.marshall_islands) + ($.default /.martinique) + ($.default /.mauritania) + ($.default /.mauritius) + ($.default /.mayotte) + ($.default /.mexico) + ($.default /.micronesia) + ($.default /.moldova) + ($.default /.monaco) + ($.default /.mongolia) + ($.default /.montenegro) + ($.default /.montserrat) + ($.default /.morocco) + ($.default /.mozambique) + ($.default /.myanmar) + ($.default /.namibia) + ($.default /.nauru) + ($.default /.nepal) + ($.default /.netherlands) + ($.default /.new_caledonia) + ($.default /.new_zealand) + ($.default /.nicaragua) + ($.default /.niger) + ($.default /.nigeria) + ($.default /.niue) + ($.default /.norfolk_island) + ($.default /.northern_mariana_islands) + ($.default /.norway) + ($.default /.oman)))) + +(def: items/pqrs + (list.together + (list ($.default /.pakistan) + ($.default /.palau) + ($.default /.palestine) + ($.default /.panama) + ($.default /.papua_new_guinea) + ($.default /.paraguay) + ($.default /.peru) + ($.default /.philippines) + ($.default /.pitcairn_islands) + ($.default /.poland) + ($.default /.portugal) + ($.default /.puerto_rico) + ($.default /.qatar) + ($.default /.reunion) + ($.default /.romania) + ($.default /.russia) + ($.default /.rwanda) + ($.default /.saint_barthelemy) + ($.default /.saint_helena) + ($.default /.ascension) + ($.default /.tristan_da_cunha) + ($.default /.saint_kitts) + ($.default /.nevis) + ($.default /.saint_lucia) + ($.default /.saint_martin) + ($.default /.saint_pierre) + ($.default /.miquelon) + ($.default /.saint_vincent) + ($.default /.the_grenadines) + ($.default /.samoa) + ($.default /.san_marino) + ($.default /.sao_tome) + ($.default /.principe) + ($.default /.saudi_arabia) + ($.default /.senegal) + ($.default /.serbia) + ($.default /.seychelles) + ($.default /.sierra_leone) + ($.default /.singapore) + ($.default /.sint_maarten) + ($.default /.slovakia) + ($.default /.slovenia) + ($.default /.solomon_islands) + ($.default /.somalia) + ($.default /.south_africa) + ($.default /.south_georgia) + ($.default /.south_sandwich_islands) + ($.default /.south_sudan) + ($.default /.spain) + ($.default /.sri_lanka) + ($.default /.sudan) + ($.default /.suriname) + ($.default /.svalbard) + ($.default /.jan_mayen) + ($.default /.sweden) + ($.default /.switzerland) + ($.default /.syria)))) + +(def: items/tuvwxyz + (list.together + (list ($.default /.taiwan) + ($.default /.tajikistan) + ($.default /.tanzania) + ($.default /.thailand) + ($.default /.east_timor) + ($.default /.togo) + ($.default /.tokelau) + ($.default /.tonga) + ($.default /.trinidad) + ($.default /.tobago) + ($.default /.tunisia) + ($.default /.turkey) + ($.default /.turkmenistan) + ($.default /.turks) + ($.default /.caicos_islands) + ($.default /.tuvalu) + ($.default /.uganda) + ($.default /.ukraine) + ($.default /.united_arab_emirates) + ($.default /.united_kingdom) + ($.default /.northern_ireland) + ($.default /.united_states_of_america) + ($.default /.united_states_minor_outlying_islands) + ($.default /.uruguay) + ($.default /.uzbekistan) + ($.default /.vanuatu) + ($.default /.venezuela) + ($.default /.vietnam) + ($.default /.british_virgin_islands) + ($.default /.united_states_virgin_islands) + ($.default /.wallis) + ($.default /.futuna) + ($.default /.western_sahara) + ($.default /.yemen) + ($.default /.zambia) + ($.default /.zimbabwe)))) + +(.def: .public documentation + (.List $.Module) + (`` ($.module /._ + "" + [..Territory + ($.default /.name) + ($.default /.short_code) + ($.default /.long_code) + ($.default /.numeric_code) + ($.default /.equivalence) + ($.default /.hash) + ..items/ab + ..items/cd + ..items/efg + ..items/hijkl + ..items/mno + ..items/pqrs + ..items/tuvwxyz] + []))) diff --git a/stdlib/source/documentation/lux/macro.lux b/stdlib/source/documentation/lux/macro.lux new file mode 100644 index 000000000..f222d778c --- /dev/null +++ b/stdlib/source/documentation/lux/macro.lux @@ -0,0 +1,87 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." code] + ["#." local] + ["#." syntax] + ["#." template]] + [\\library + ["." /]]) + +(documentation: /.single_expansion + (format "Given code that requires applying a macro, does it once and returns the result." + \n "Otherwise, returns the code as-is.") + [(single_expansion syntax)]) + +(documentation: /.expansion + (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left." + \n "Otherwise, returns the code as-is.") + [(expansion syntax)]) + +(documentation: /.full_expansion + "Expands all macro-calls everywhere recursively, until only primitive/base code remains." + [(full_expansion syntax)]) + +(documentation: /.identifier + (format "Generates a unique name as an Code node (ready to be used in code templates)." + \n "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.") + [(identifier prefix)]) + +(documentation: /.wrong_syntax_error + "A generic error message for macro syntax failures.") + +(documentation: /.with_identifiers + "Creates new identifiers and offers them to the body expression." + [(syntax: (synchronized [lock any + body any]) + (with_identifiers [g!lock g!body g!_] + (in (list (` (let [(~ g!lock) (~ lock) + (~ g!_) ("jvm monitorenter" (~ g!lock)) + (~ g!body) (~ body) + (~ g!_) ("jvm monitorexit" (~ g!lock))] + (~ g!body)))))))]) + +(documentation: /.one_expansion + "Works just like expand, except that it ensures that the output is a single Code token." + [(one_expansion token)]) + +(template [<macro>] + [(documentation: <macro> + (format "Performs a macro-expansion and logs the resulting code." + \n "You can either use the resulting code, or omit them." + \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + [(<macro> #omit + (def: (foo bar baz) + (-> Int Int Int) + (int.+ bar baz)))])] + + [/.log_single_expansion!] + [/.log_expansion!] + [/.log_full_expansion!] + ) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..single_expansion + ..expansion + ..full_expansion + ..identifier + ..wrong_syntax_error + ..with_identifiers + ..one_expansion + ..log_single_expansion! + ..log_expansion! + ..log_full_expansion!] + [/code.documentation + /local.documentation + /syntax.documentation + /template.documentation])) diff --git a/stdlib/source/documentation/lux/macro/code.lux b/stdlib/source/documentation/lux/macro/code.lux new file mode 100644 index 000000000..6102046b1 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/code.lux @@ -0,0 +1,44 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.local_identifier + "Produces a local identifier (an identifier with no module prefix).") + +(documentation: /.local_tag + "Produces a local tag (a tag with no module prefix).") + +(documentation: /.replaced + "" + [(replaced original substitute ast)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..local_identifier + ..local_tag + ..replaced + ($.default /.bit) + ($.default /.nat) + ($.default /.int) + ($.default /.rev) + ($.default /.frac) + ($.default /.text) + ($.default /.identifier) + ($.default /.tag) + ($.default /.form) + ($.default /.tuple) + ($.default /.record) + + ($.default /.equivalence) + ($.default /.format)] + [])) diff --git a/stdlib/source/documentation/lux/macro/local.lux b/stdlib/source/documentation/lux/macro/local.lux new file mode 100644 index 000000000..5b6acf1b5 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/local.lux @@ -0,0 +1,28 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.push + (format "Installs macros in the compiler-state, with the given names." + \n "Yields code that can be placed either as expression or as directives." + \n "This code un-installs the macros." + \n "NOTE: Always use this code once to clean-up..") + [(push macros)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..push + ($.default /.unknown_module) + ($.default /.cannot_shadow_definition) + ($.default /.unknown_definition)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax.lux b/stdlib/source/documentation/lux/macro/syntax.lux new file mode 100644 index 000000000..b0e76e1a8 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax.lux @@ -0,0 +1,51 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." annotations] + ["#." check] + ["#." declaration] + ["#." definition] + ["#." export] + ["#." input] + ["#." type #_ + ["#/." variable]]] + [\\library + ["." /]]) + +(documentation: /.syntax: + (format \n "A more advanced way to define macros than 'macro:'." + \n "The inputs to the macro can be parsed in complex ways through the use of syntax parsers." + \n "The macro body is also (implicitly) run in the Meta monad, to save some typing." + \n "Also, the compiler state can be accessed through the *lux* binding.") + [(syntax: .public (object [.let [imports (class_imports *lux*)] + .let [class_vars (list)] + super (opt (super_class_decl^ imports class_vars)) + interfaces (tuple (some (super_class_decl^ imports class_vars))) + constructor_args (constructor_args^ imports class_vars) + methods (some (overriden_method_def^ imports))]) + (let [def_code ($_ text\compose "anon-class:" + (spaced (list (super_class_decl$ (maybe.else object_super_class super)) + (with_brackets (spaced (list\map super_class_decl$ interfaces))) + (with_brackets (spaced (list\map constructor_arg$ constructor_args))) + (with_brackets (spaced (list\map (method_def$ id) methods))))))] + (in (list (` ((~ (code.text def_code))))))))]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..syntax:] + [/annotations.documentation + /check.documentation + /declaration.documentation + /definition.documentation + /export.documentation + /input.documentation + /type/variable.documentation])) diff --git a/stdlib/source/documentation/lux/macro/syntax/annotations.lux b/stdlib/source/documentation/lux/macro/syntax/annotations.lux new file mode 100644 index 000000000..2fbb28d35 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/annotations.lux @@ -0,0 +1,25 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.Annotations + "Definition/module annotations.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Annotations + ($.default /.equivalence) + ($.default /.empty) + ($.default /.format) + ($.default /.parser)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/check.lux b/stdlib/source/documentation/lux/macro/syntax/check.lux new file mode 100644 index 000000000..0d0ffcdd3 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/check.lux @@ -0,0 +1,24 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.Check + "A type annotation for an expression.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Check + ($.default /.equivalence) + ($.default /.format) + ($.default /.parser)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/declaration.lux b/stdlib/source/documentation/lux/macro/syntax/declaration.lux new file mode 100644 index 000000000..45611f4e6 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/declaration.lux @@ -0,0 +1,30 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.Declaration + "A declaration for either a constant or a function.") + +(documentation: /.parser + "A parser for declaration syntax." + ["Such as:" + quux + (foo bar baz)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Declaration + ..parser + ($.default /.equivalence) + ($.default /.format)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/definition.lux b/stdlib/source/documentation/lux/macro/syntax/definition.lux new file mode 100644 index 000000000..21befadc2 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/definition.lux @@ -0,0 +1,33 @@ +(.module: + [library + [lux (#- Definition) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.Definition + "Syntax for a constant definition.") + +(documentation: /.parser + "A reader that first macro-expands and then analyses the input Code, to ensure it is a definition." + [(parser compiler)]) + +(documentation: /.typed + "Only works for typed definitions." + [(typed compiler)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Definition + ..parser + ..typed + ($.default /.equivalence) + ($.default /.lacks_type)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/export.lux b/stdlib/source/documentation/lux/macro/syntax/export.lux new file mode 100644 index 000000000..cadab752a --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/export.lux @@ -0,0 +1,23 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.parser + "" + [(parser un_exported)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "Syntax for marking a definition as an export." + [..parser + ($.default /.default_policy)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/input.lux b/stdlib/source/documentation/lux/macro/syntax/input.lux new file mode 100644 index 000000000..bd1a5daa5 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/input.lux @@ -0,0 +1,27 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.Input + "The common typed-argument syntax used by many macros.") + +(documentation: /.parser + "Parser for the common typed-argument syntax used by many macros.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Input + ..parser + ($.default /.equivalence) + ($.default /.format)] + [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux new file mode 100644 index 000000000..d46d85588 --- /dev/null +++ b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux @@ -0,0 +1,27 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.Variable + "A variable'S name.") + +(documentation: /.parser + "Parser for the common type variable/parameter used by many macros.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Variable + ..parser + ($.default /.equivalence) + ($.default /.format)] + [])) diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux new file mode 100644 index 000000000..894d68c3d --- /dev/null +++ b/stdlib/source/documentation/lux/macro/template.lux @@ -0,0 +1,77 @@ +(.module: + [library + [lux (#- let) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + [\\library + ["." /]]) + +(documentation: /.spliced + "" + [(spliced [a b c d]) + "=>" + a + b + c + d]) + +(documentation: /.amount + "" + [(amount [a b c d]) + "=>" + 4]) + +(documentation: /.with_locals + "Creates names for local bindings aliased by the names you choose." + [(with_locals [my_var] + (let [my_var 123] + (text [my_var]))) + "=>" + "__gensym__my_var506"]) + +(documentation: /.text + "A text literal made by concatenating pieces of code." + [(text [#0 123 +456 +789.0 "abc" .def ..ghi]) + "=>" + "#0123+456+789.0abcdefghi"]) + +(template [<a/an> <name> <short_example> <full_example>] + [(documentation: <name> + (format <a/an> " " (/.text [<name>]) " made by concatenating pieces of code." + \n "The (optional) module part and the short part are specified independently.") + [(<name> ["abc" .def ..ghi]) + "=>" + <short_example>] + [(<name> [.def] ["abc" .def ..ghi]) + "=>" + <full_example>])] + + ["An" /.identifier abcdefghi .abcdefghi] + ["A" /.tag #abcdefghi #.abcdefghi] + ) + +(documentation: /.let + "Lexically-bound templates." + [(let [(!square <root>) + [(* <root> <root>)]] + (def: (square root) + (-> Nat Nat) + (!square root)))]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..spliced + ..amount + ..with_locals + ..text + ..identifier + ..tag + ..let + ($.default /.irregular_arguments)] + [])) diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux new file mode 100644 index 000000000..7c74692ca --- /dev/null +++ b/stdlib/source/documentation/lux/math.lux @@ -0,0 +1,28 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." infix] + ... ["#." modulus] + ... ["#." modular] + ... ["#." number] + ["#." logic]] + [\\library + ["." /]]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [] + [/infix.documentation + ... /modulus.documentation + ... /modular.documentation + ... /number.documentation + /logic.documentation])) diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux new file mode 100644 index 000000000..ccb72f665 --- /dev/null +++ b/stdlib/source/documentation/lux/math/infix.lux @@ -0,0 +1,31 @@ +(.module: + [library + [lux (#- private) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.infix + (format "Infix math syntax." + \n "The rules for infix syntax are simple." + \n "If you want your binary function to work well with it." + \n "Then take the argument to the right (y) as your first argument," + \n "and take the argument to the left (x) as your second argument.") + [(infix [x * +10])] + [(infix [[x + y] * [x - y]])] + [(infix [sin [x + y]])] + [(infix [[x < y] and [y < z]])] + [(infix [#and x < y < z])] + [(infix [(* 3 9) gcd 450])]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [] + [])) diff --git a/stdlib/source/documentation/lux/math/logic.lux b/stdlib/source/documentation/lux/math/logic.lux new file mode 100644 index 000000000..1b455c23e --- /dev/null +++ b/stdlib/source/documentation/lux/math/logic.lux @@ -0,0 +1,22 @@ +(.module: + [library + [lux (#- char) + ["$" documentation (#+ documentation:)] + [data + [text + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." continuous] + ["#." fuzzy]] + [\\library + ["." /]]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [] + [/continuous.documentation + /fuzzy.documentation])) diff --git a/stdlib/source/documentation/lux/math/logic/continuous.lux b/stdlib/source/documentation/lux/math/logic/continuous.lux new file mode 100644 index 000000000..94c7486d4 --- /dev/null +++ b/stdlib/source/documentation/lux/math/logic/continuous.lux @@ -0,0 +1,32 @@ +(.module: + [library + [lux (#- private) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.implies + "" + [(implies consequent antecedent)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + (format "Continuous logic using Rev values." + \n "Continuous logic is logic in the interval [0,1] instead of just the binary #0 and #1 options." + \n "Because Rev is being used, the interval is actual [0,1).") + [..implies + ($.default /.false) + ($.default /.true) + ($.default /.or) + ($.default /.disjunction) + ($.default /.and) + ($.default /.conjunction) + ($.default /.not) + ($.default /.=)] + [])) diff --git a/stdlib/source/documentation/lux/math/logic/fuzzy.lux b/stdlib/source/documentation/lux/math/logic/fuzzy.lux new file mode 100644 index 000000000..5f31cfea1 --- /dev/null +++ b/stdlib/source/documentation/lux/math/logic/fuzzy.lux @@ -0,0 +1,68 @@ +(.module: + [library + [lux (#- private) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.Fuzzy + "A fuzzy set.") + +(documentation: /.membership + "" + [(membership set elem)]) + +(documentation: /.difference + "" + [(difference sub base)]) + +(documentation: /.of_predicate + "" + [(of_predicate predicate)]) + +(documentation: /.predicate + "" + [(predicate treshold set)]) + +(documentation: /.gradient + "" + [(gradient from to)]) + +(documentation: /.triangle + "" + [(triangle bottom middle top)]) + +(documentation: /.trapezoid + "" + [(trapezoid bottom middle_bottom middle_top top)]) + +(documentation: /.cut + "" + [(cut treshold set)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "Fuzzy logic, implemented on top of the Rev type." + [..Fuzzy + ..membership + ..difference + ..of_predicate + ..predicate + ..gradient + ..triangle + ..trapezoid + ..cut + ($.default /.functor) + ($.default /.empty) + ($.default /.full) + ($.default /.union) + ($.default /.intersection) + ($.default /.complement) + ($.default /.of_set)] + [])) |