Created
December 9, 2021 19:36
-
-
Save MrEbbinghaus/457875dd479ab4abd2971665b291f7e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns check-sci-compat | |
| (:require | |
| [clojure.string :as str] | |
| [sci.core :as sci] | |
| [clojure.pprint :as pprint])) | |
| (def clojure-built-in-nss | |
| (->> (all-ns) | |
| (map str) | |
| (filter #(str/starts-with? % "clojure")) | |
| sort | |
| (map symbol))) | |
| (def all-built-in-fqf-symbols | |
| (->> clojure-built-in-nss | |
| (map ns-publics) | |
| (apply merge) | |
| vals)) | |
| (defn check-support-by-sci [f] | |
| (try (sci/eval-string (str f)) | |
| nil | |
| (catch Exception e (ex-message e)))) | |
| (defn expand [var-sym] | |
| (let [meta-sym (meta var-sym) | |
| check-msg (check-support-by-sci var-sym)] | |
| (assoc meta-sym | |
| :name (str (:name meta-sym)) | |
| :ns-name (str (:ns meta-sym)) | |
| :msg check-msg | |
| :supported? (nil? check-msg)))) | |
| (def array-names | |
| '[make-array object-array boolean-array byte-array short-array char-array | |
| int-array long-array float-array double-array aclone to-array to-array-2d | |
| into-array | |
| aget aset aset-boolean aset-byte aset-short aset-char aset-int aset-long | |
| aset-float aset-double alength amap areduce | |
| booleans bytes shorts chars ints longs floats doubles]) | |
| (def array-symbols | |
| (filter #((set array-names) (:name (meta %))) | |
| all-built-in-fqf-symbols)) | |
| (defn to-md-table [table] | |
| (-> table | |
| (str/replace #"\|-" "| ") | |
| (str/replace #"-\|" " |") | |
| (str/replace #"-\+-" " | "))) | |
| (->> array-symbols | |
| (map expand) | |
| (filter #(= "clojure.core" (:ns-name %))) | |
| (sort-by (juxt :ns-name :supported?)) | |
| (pprint/print-table [:ns-name :name :supported? :msg]) | |
| (with-out-str) | |
| to-md-table) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment