Back
compile (clj)
(source)function
(compile lib)
Compiles the namespace named by the symbol lib into a set of
classfiles. The source for the lib must be in a proper
classpath-relative directory. The output files will go into the
directory specified by *compile-path*, and that directory too must
be in the classpath.
Examples
penpot/penpot
#_:clj-kondo/ignore
(ns app.common.data.macros
"Data retrieval & manipulation specific macros."
(:refer-clojure :exclude [get-in select-keys str with-open min max])
#?(:cljs (:require-macros [app.common.data.macros]))
(:require
#?(:clj [clojure.core :as c]
:cljs [cljs.core :as c])
[app.common.data :as d]
[cljs.analyzer.api :as aapi]
[cuerdas.core :as str]))
(defmacro select-keys
"A macro version of `select-keys`. Useful when keys vector is known
at compile time (aprox 600% performance boost).
(defmacro get-in
"A macro version of `get-in`. Useful when the keys vector is known at
compile time (20-40% performance improvement)."
([target keys]
(assert (vector? keys) "keys expected to be a vector")
`(-> ~target ~@(map (fn [key] (list `c/get key)) keys)))
([target keys default]
(assert (vector? keys) "keys expected to be a vector")
(let [last-index (dec (count keys))]
`(-> ~target ~@(map-indexed (fn [index key]
(if (= last-index index)
(list `c/get key default)
(list `c/get key)))
keys)))))
(defmacro fmt
"String interpolation helper. Can only be used with strings known at
compile time. Can be used with indexed params access or sequential.
hraberg/deuce
(ns deuce.emacs.ccl
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c])
(:refer-clojure :exclude []))
(defvar font-ccl-encoder-alist nil
"Alist of fontname patterns vs corresponding CCL program.
Each element looks like (REGEXP . CCL-CODE),
where CCL-CODE is a compiled CCL program.
When a font whose name matches REGEXP is used for displaying a character,
CCL-CODE is executed to calculate the code point in the font
from the charset number and position code(s) of the character which are set
in CCL registers R0, R1, and R2 before the execution.
The code point in the font is set in CCL registers R1 and R2
when the execution terminated.
If the font is single-byte font, the register R2 is not used.")
(defun register-ccl-program (name ccl-prog)
"Register CCL program CCL-PROG as NAME in `ccl-program-table'.
CCL-PROG should be a compiled CCL program (vector), or nil.
If it is nil, just reserve NAME as a CCL program name.
Return index number of the registered CCL program."
)
CCL-PROGRAM is a CCL program name (symbol)
or compiled code generated by `ccl-compile' (for backward compatibility.
In the latter case, the execution overhead is bigger than in the former).
No I/O commands should appear in CCL-PROGRAM.
(defun ccl-program-p (object)
"Return t if OBJECT is a CCL program name or a compiled CCL program code.
See the documentation of `define-ccl-program' for the detail of CCL program."
)
CCL-PROGRAM is a symbol registered by `register-ccl-program',
or a compiled code generated by `ccl-compile' (for backward compatibility,
in this case, the execution is slower).
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
"Type annotations for the base Clojure distribution."
#?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
(:require [clojure.core :as cc]
[typed.clojure :as t]
#?(:clj [typed.ann-macros.clojure :as macros])
#?(:clj typed.ann.clojure.jvm) ;; jvm annotations
#?(:clj clojure.core.typed))
#?(:clj
(:import (clojure.lang PersistentHashSet PersistentList
APersistentMap #_IPersistentCollection
#_ITransientSet
IRef)
(java.util Comparator Collection))))
#?@(:cljs [] :default [
cc/compile [t/Sym :-> t/Sym]
])
#?@(:cljs [] :default [
cc/*file* t/Str
])
cc/*command-line-args* (t/NilableNonEmptyASeq t/Str)
#?@(:cljs [
cc/*unchecked-if* t/Bool
cc/*unchecked-arrays* t/Bool
cc/*warn-on-infer* t/Bool
cc/enable-console-print! [:-> t/Any]
] :default [
cc/*warn-on-reflection* t/Bool
cc/*compile-path* t/Str
cc/*compile-files* t/Bool
cc/*unchecked-math* t/Bool
cc/*compiler-options* (t/Map t/Any t/Any)
cc/*in* java.io.Reader
cc/*out* java.io.Writer ;; FIXME cljs
cc/*err* java.io.Writer
cc/*repl* t/Any
])
cc/*flush-on-newline* t/Bool
cc/*print-meta* t/Bool
cc/*print-dup* t/Bool
cc/*print-readably* t/Bool
#?@(:cljs [] :default [
cc/*read-eval* (t/U ':unknown t/Bool)
])
bsless/more.async
(ns more.async.dataflow.node
(:require
[clojure.spec.alpha :as s]
[clojure.core.async :as a]
[more.async :as ma]
[clojure.data]))
(defmulti -compile (fn [node _env] (get node ::type)))
(defmethod -compile ::pipeline
[{{to ::to from ::from size ::size xf ::xf} ::pipeline} env]
(a/pipeline size (env to) xf (env from)))
(defmethod -compile ::pipeline-blocking
[{{to ::to from ::from size ::size xf ::xf} ::pipeline} env]
(a/pipeline-blocking size (env to) xf (env from)))
(defmethod -compile ::pipeline-async
[{{to ::to from ::from size ::size af ::xf} ::pipeline} env]
(a/pipeline-async size (env to) af (env from)))
(defmethod -compile ::batch
[{{from ::from
to ::to
size ::size
timeout ::timeout
rf ::rf
init ::init-fn
finally ::finally-fn
async? ::async?
:or {rf conj init (constantly []) finally identity}}
::batch} env]
(let [from (env from)
to (env to)]
(if async?
(ma/batch! from to size timeout rf init finally)
(a/thread (ma/batch!! from to size timeout rf init finally)))))
(defmethod -compile ::mult
[{{from ::from to :to*} ::mult} env]
(let [mult (a/mult (env from))]
(doseq [ch to] (a/tap mult (env ch)))
mult))
(defmethod -compile ::pubsub
[{{pub ::pub sub ::sub tf ::topic-fn} ::pubsub} env]
(let [p (a/pub (env pub) tf)]
(doseq [{:keys [:sub/topic :sub/chan]} sub]
(a/sub p topic (env chan)))
p))
(defmethod -compile ::produce
[{{ch ::to f ::fn async? ::async?} ::produce} env]
(let [ch (env ch)]
(if async?
(ma/produce-call! ch f)
(a/thread (ma/produce-call!! ch f)))))
(defmethod -compile ::consume
[{{ch ::from f ::fn async? ::async? checked? ::checked?} ::consume} env]
(let [ch (env ch)]
(if async?
((if checked?
ma/consume-checked-call!
ma/consume-call!) ch f)
(a/thread ((if checked?
ma/consume-checked-call!!
ma/consume-call!!) ch f)))))
(defmethod -compile ::split
[{{from ::from to ::to-map f ::fn
dropping? ::dropping?} ::split} env]
((if dropping? ma/split?! ma/split!) f (env from) (env to)))
(defmethod -compile ::reductions
[{{from ::from
to ::to
rf ::rf
init ::rf
async? ::async?} ::reductions} env]
(let [from (env from)
to (env to)]
(if async?
(ma/reductions! rf init from to)
(a/thread
(ma/reductions!! rf init from to)))))
jimmyhmiller/PlayGround
(ns testing-stuff.solidity
(:require [promesa.core :as p]
[cloth.core :as cloth]
[cloth.contracts :as c]
[cuerdas.core :as cc]
[cheshire.core :as json]
[clojure.core.async :as async]))
(def compiled (c/compile-solidity "/Users/jimmymiller/Documents/Code/PlayGround/testing-stuff/contracts/Crowdsale.sol"))
compiled
(def abi (json/parse-string (get-in compiled [:contracts contract-key :abi]) true))