~subsetpark/urquh

eb244c73ff06930dc6ce1910089a5ad3843d2be1 — Zach Smith 1 year, 10 days ago 72098f2
fmt
6 files changed, 118 insertions(+), 118 deletions(-)

M .gitignore
M eqns.janet
M index.temple
M main.janet
M project.janet
M sources.janet
M .gitignore => .gitignore +1 -0
@@ 2,3 2,4 @@ build
/.env
*.sqlite3
janet_modules/
/tags

M eqns.janet => eqns.janet +110 -110
@@ 41,126 41,126 @@
             `\mathbb{A}`
             `\mathbb{H}`
             `\mathbb{O}`
             `\mathbb{S}`]) 
             `\mathbb{S}`])

(def letters
  (->>
   (map
    |(if (string? $) $ (string/from-bytes $))
    (array/concat
     (range (chr "0") (chr "9"))
     (range (chr "A") (chr "Z"))
     (range (chr "a") (chr "z"))
     greeks))
   (map |{:type :symbol :val $})))
    (map
      |(if (string? $) $ (string/from-bytes $))
      (array/concat
        (range (chr "0") (chr "9"))
        (range (chr "A") (chr "Z"))
        (range (chr "a") (chr "z"))
        greeks))
    (map |{:type :symbol :val $})))

(def relations
  (->>
   [`\gt`
    `\lt`
    `\nless`
    `\leq`
    `\leqslant`
    `\nleq`
    `\nleqslant`
    `\prec`
    `\nprec`
    `\preceq`
    `\npreceq`
    `\ll`
    `\lll`
    `\subset`
    `\not\subset`
    `\subseteq`
    `\nsubseteq`
    `\sqsubset`
    `\sqsubseteq`
    `\ngtr`
    `\geq`
    `\geqslant`
    `\ngeq`
    `\ngeqslant`
    `\succ`
    `\nsucc`
    `\succeq`
    `\nsucceq`
    `\gg`
    `\ggg`
    `\supset`
    `\not\supset`
    `\supseteq`
    `\nsupseteq`
    `\sqsupset`
    `\sqsupseteq`
    `=`
    `\doteq`
    `\equiv`
    `\approx`
    `\cong`
    `\simeq`
    `\sim`
    `\propto`
    `\neq`
    `\parallel`
    `\asymp`
    `\vdash`
    `\in`
    `\smile`
    `\models`
    `\perp`]
  (map
    |{:type :symbol :val $})))
    [`\gt`
     `\lt`
     `\nless`
     `\leq`
     `\leqslant`
     `\nleq`
     `\nleqslant`
     `\prec`
     `\nprec`
     `\preceq`
     `\npreceq`
     `\ll`
     `\lll`
     `\subset`
     `\not\subset`
     `\subseteq`
     `\nsubseteq`
     `\sqsubset`
     `\sqsubseteq`
     `\ngtr`
     `\geq`
     `\geqslant`
     `\ngeq`
     `\ngeqslant`
     `\succ`
     `\nsucc`
     `\succeq`
     `\nsucceq`
     `\gg`
     `\ggg`
     `\supset`
     `\not\supset`
     `\supseteq`
     `\nsupseteq`
     `\sqsupset`
     `\sqsupseteq`
     `=`
     `\doteq`
     `\equiv`
     `\approx`
     `\cong`
     `\simeq`
     `\sim`
     `\propto`
     `\neq`
     `\parallel`
     `\asymp`
     `\vdash`
     `\in`
     `\smile`
     `\models`
     `\perp`]
    (map
      |{:type :symbol :val $})))

(def operators
  (->>
   ["+"
    "-"
    `\pm`
    `\mp`
    `\times`
    `\div`
    `\ast`
    `\star`
    `\dagger`
    `\ddagger` 
    `\cap`
    `\cup`
    `\uplus`
    `\sqcap`
    `\sqcup`
    `\vee`
    `\wedge`
    `\cdot` 
    `\diamond`
    `\bigtriangleup`
    `\bigtriangledown`
    `\triangleleft`
    `\triangleright`
    `\bigcirc`
    `\bullet`
    `\wr` 
    `\oplus`
    `\ominus`
    `\otimes`
    `\oslash`
    `\odot`
    `\circ`
    `\setminus`
    `\amalg`]
   (map
    |{:type :symbol :val $})))
    ["+"
     "-"
     `\pm`
     `\mp`
     `\times`
     `\div`
     `\ast`
     `\star`
     `\dagger`
     `\ddagger`
     `\cap`
     `\cup`
     `\uplus`
     `\sqcap`
     `\sqcup`
     `\vee`
     `\wedge`
     `\cdot`
     `\diamond`
     `\bigtriangleup`
     `\bigtriangledown`
     `\triangleleft`
     `\triangleright`
     `\bigcirc`
     `\bullet`
     `\wr`
     `\oplus`
     `\ominus`
     `\otimes`
     `\oslash`
     `\odot`
     `\circ`
     `\setminus`
     `\amalg`]
    (map
      |{:type :symbol :val $})))

(def propositions
  (->>
   [`\exists`
    `\exists!`
    `\nexists`]
   (map |{:type :symbol :val $})))
    [`\exists`
     `\exists!`
     `\nexists`]
    (map |{:type :symbol :val $})))

(def quantifiers
  (->>
   [`\forall`]
   (map |{:type :symbol :val $})))
    [`\forall`]
    (map |{:type :symbol :val $})))

(defn- rand-select
  [a]


@@ 175,9 175,9 @@
(defn layout
  [& args]
  (seq [arg :in args]
       (match arg
         (s (string? s)) s
         kw (one-of kw))))
    (match arg
      (s (string? s)) s
      kw (one-of kw))))

(varfn one-of
  [type &opt except]


@@ 185,7 185,7 @@
    (t (tuple? t)) (let [elem (rand-select t)]
                     (one-of elem))
    (a (array? a)) (rand-select a)
    

    :eqn (layout :form :rel :form)
    :prop (layout :ex :variable `\in`
                  (one-of @[:variable :operation :frac :sup])


@@ 231,7 231,7 @@
    {:type :sub :left form :sub sub} (string/join ["{" (to-string form) "}_{" (to-string sub) "}"])
    {:type :fraction :bottom bottom :top top} (string/join [`\frac{` (to-string top) `}{` (to-string bottom) `}`])
    {:type :super :form form :to to} (string/join [`{` (to-string form) `}^{` (to-string to) `}`])
    

    _ (errorf "Unknown print type: %q" sym)))

(defn render

M index.temple => index.temple +1 -1
@@ 37,7 37,7 @@
       (string/format `<li><a href="%s">%s</a></li>`
                      dest
                      link))
     (string/join " "))-}
     (string/join " ")) -}
</ul>
<hr>
<p>

M main.janet => main.janet +1 -1
@@ 13,7 13,7 @@
       (index/render))
     @{:status 200
       :body body
      :headers text/html })
       :headers text/html})


(defn main [_ &opt port host]

M project.janet => project.janet +4 -4
@@ 11,9 11,9 @@

(phony "server" []
       (if (= "development" (os/getenv "JOY_ENV"))
    (os/shell "find . -name '*.janet' | entr janet main.janet")
    (os/shell "janet main.janet")))
         (os/shell "find . -name '*.janet' | entr janet main.janet")
         (os/shell "janet main.janet")))

(declare-executable
 :name "urquh"
 :entry "main.janet")
  :name "urquh"
  :entry "main.janet")

M sources.janet => sources.janet +1 -2
@@ 17,5 17,4 @@ intituled, The Wonders of the new Language :
   ["music" "https://zdsmith.bandcamp.com"]
   ["flaming tusk" "https://tusk.bandcamp.com"]
   ["keybase" "https://keybase.io/zdsmith"]
   ["twitter" "https://twitter.com/zdsmith"]
   ])
   ["twitter" "https://twitter.com/zdsmith"]])