diff --git a/hxlm-js/bootstrapper/lisp/datatype.mjs b/hxlm-js/bootstrapper/lisp/datatype.mjs index b1b1858..3e0902f 100644 --- a/hxlm-js/bootstrapper/lisp/datatype.mjs +++ b/hxlm-js/bootstrapper/lisp/datatype.mjs @@ -1,2 +1,7 @@ // TODO: this is an draft -// https://en.wiktionary.org/wiki/dictionarium#Latin \ No newline at end of file +// https://en.wiktionary.org/wiki/dictionarium#Latin +// https://clojure.org/reference/data_structures +// https://docs.racket-lang.org/guide/datatypes.html +// Ada: +// Strong data type +// - https://learn.adacore.com/courses/intro-to-ada/chapters/strongly_typed_language.html \ No newline at end of file diff --git a/tests/hdplisp/other-inspirations/ada-extra.adb b/tests/hdplisp/other-inspirations/ada-extra.adb new file mode 100644 index 0000000..75c6204 --- /dev/null +++ b/tests/hdplisp/other-inspirations/ada-extra.adb @@ -0,0 +1,2 @@ +-- TODO: maybe add examples of Ada with contracts +-- @see https://learn.adacore.com/ \ No newline at end of file diff --git a/tests/hdplisp/other-inspirations/haskell-math.hs b/tests/hdplisp/other-inspirations/haskell-math.hs new file mode 100644 index 0000000..b0ec3cb --- /dev/null +++ b/tests/hdplisp/other-inspirations/haskell-math.hs @@ -0,0 +1,11 @@ +{- + https://tryhaskell.org/ + + Command line interpreter: ghci + ghci tests/hdplisp/other-inspirations/haskell-math.hs + runhaskell tests/hdplisp/other-inspirations/haskell-math.hs +-} + +main = putStrLn "Hello world!" + +values = [1..10] \ No newline at end of file diff --git a/tests/hdplisp/other-lisps/clojure-extra.clj b/tests/hdplisp/other-lisps/clojure-extra.clj new file mode 100644 index 0000000..990c41e --- /dev/null +++ b/tests/hdplisp/other-lisps/clojure-extra.clj @@ -0,0 +1,69 @@ +;; https://en.wikipedia.org/wiki/Clojure +;; Interpreter: +;; clojure + + +(println "Hello world!") + +;; define a var +(def a 42) +;; => #'user/a + +;; call a function named `+` +(+ a 8) +;; => 50 + +;; call a function named `even?` +(even? a) +;; => true + +;; define a function that returns the remainder of `n` when divided by 10 +(defn foo [n] (rem n 10)) +;; => #'user/foo + +;; call the function +(foo a) +;; => 2 + +;; print the docstring of `rem` +(doc rem) +;; => +;; ------------------------- +;; clojure.core/rem +;; ([num div]) +;; remainder of dividing numerator by denominator. +;; + +;; print the source of `rem` +(source rem) +;; => +;; (defn rem +;; "remainder of dividing numerator by denominator." +;; {:added "1.0" +;; :static true +;; :inline (fn [x y] `(. clojure.lang.Numbers (remainder ~x ~y)))} +;; [num div] +;; (. clojure.lang.Numbers (remainder num div))) + + +;; define a function (with a docstring) that +;; returns the remainder of `n` when divided by 10 +(defn foo2 "returns `(rem n 10)`" [n] (rem n 10)) +;; #'user/foo2 + +(doc foo2) +;; ------------------------- +;; user/foo2 +;; ([n]) +;; returns `(rem n 10)` +;; nil + + + +;; More structured hello world + +;; A typical entry point of a Clojure program: +;; `-main` function +(defn -main ; name + [& args] ; (variable) parameters + (println "Hello, World!")) ; body \ No newline at end of file diff --git a/tests/hdplisp/other-lisps/clojure-math.clj b/tests/hdplisp/other-lisps/clojure-math.clj new file mode 100644 index 0000000..ad52497 --- /dev/null +++ b/tests/hdplisp/other-lisps/clojure-math.clj @@ -0,0 +1,11 @@ +;; https://en.wikipedia.org/wiki/Clojure + + +(+ 1 2 3 4 5 6 7 8 9) +;; 45 + +(- 1 2 3 4 5 6 7 8 9) +;; -43 + +(quote (+ 1 1)) +;; (+ 1 1) \ No newline at end of file diff --git a/tests/hdplisp/other-lisps/common-lisp-extra.cl b/tests/hdplisp/other-lisps/common-lisp-extra.cl new file mode 100644 index 0000000..7c8953b --- /dev/null +++ b/tests/hdplisp/other-lisps/common-lisp-extra.cl @@ -0,0 +1,6 @@ +;; https://rosettacode.org/wiki/Hello_world/Text#Common_Lisp + + +;; (format t "Hello world!~%") + +(print "Hello world!") diff --git a/tests/hdplisp/other-lisps/racket-extra.rkt b/tests/hdplisp/other-lisps/racket-extra.rkt new file mode 100644 index 0000000..ed67c62 --- /dev/null +++ b/tests/hdplisp/other-lisps/racket-extra.rkt @@ -0,0 +1,3 @@ +#lang racket + +(printf "Hello world!\n") diff --git a/tests/hdplisp/other-lisps/racket-math.rkt b/tests/hdplisp/other-lisps/racket-math.rkt new file mode 100644 index 0000000..3f86093 --- /dev/null +++ b/tests/hdplisp/other-lisps/racket-math.rkt @@ -0,0 +1,11 @@ +#lang racket + + +(+ 1 2 3 4 5 6 7 8 9) +;; 45 + +(- 1 2 3 4 5 6 7 8 9) +;; -43 + +(quote (+ 1 1)) +;; '(+ 1 1) \ No newline at end of file diff --git a/tests/hdplisp/other-lisps/scheme-extra.scm b/tests/hdplisp/other-lisps/scheme-extra.scm new file mode 100644 index 0000000..a791e66 --- /dev/null +++ b/tests/hdplisp/other-lisps/scheme-extra.scm @@ -0,0 +1,10 @@ +;; https://rosettacode.org/wiki/Hello_world/Text#Scheme +;; https://en.wikipedia.org/wiki/Scheme_(programming_language) + +;; R5RS +(display "Hello world!") + +;; R7RS +(import (scheme base) + (scheme write)) +(display "Hello world!") \ No newline at end of file