Back
byte (clj)
(source)function
(byte x)
Coerce to byte
Examples
cognitect-labs/aws-api
(ns s3-examples
(:require [clojure.core.async :as a]
[clojure.spec.alpha :as s]
[clojure.spec.gen.alpha :as gen]
[clojure.java.io :as io]
[clojure.repl :as repl]
[cognitect.aws.client.api :as aws]))
;; Body is blob type, for which we accept a byte-array or an InputStream
(aws/invoke s3 {:op :PutObject :request {:Bucket bucket-name :Key "hello.txt"
:Body (.getBytes "Oh hai!")}})
hraberg/deuce
(ns deuce.emacs.bytecode
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c])
(:refer-clojure :exclude []))
(defun byte-code (bytestr vector maxdepth)
"Function used internally in byte-compiled code.
The first argument, BYTESTR, is a string of byte code;
the second, VECTOR, a vector of constants;
the third, MAXDEPTH, the maximum stack depth used in this function.
If the third argument is incorrect, Emacs may crash."
)
hraberg/deuce
(ns deuce.emacs.print
(:use [deuce.emacs-lisp :only (defun defvar)])
(:require [clojure.core :as c]
[clojure.string :as s]
[deuce.emacs.buffer :as buffer]
[deuce.emacs.data :as data]
[deuce.emacs.editfns :as editfns]
[deuce.emacs.fns :as fns])
(:refer-clojure :exclude [print]))
(defvar print-escape-multibyte nil
"Non-nil means print multibyte characters in strings as \\xXXXX.
(XXXX is the hex representation of the character code.)
This affects only `prin1'.")
(defvar print-escape-nonascii nil
"Non-nil means print unibyte non-ASCII chars in strings as \\OOO.
(OOO is the octal representation of the character code.)
Only single-byte characters are affected, and only in `prin1'.
When the output goes in a multibyte buffer, this feature is
enabled regardless of the value of the variable.")
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 [
clojure.java.shell/sh [t/Any :*
;would be nice (combine :* and kw args)
; t/Str :*
;& :optional {:in t/Any ;; any valid input to clojure.java.io/copy
; :inc-enc t/Str :out-env (t/U ':bytes t/Str)
; :env (t/U (Array t/Str) (t/Map t/Any t/Any))
; :dir (t/U t/Str java.io.File)}
:-> '{:exit t/Str
:out (t/U (Array byte) t/Str)
:err t/Str}]
clojure.java.browse/browse-url [t/Any :-> t/Any]
clojure.java.io/delete-file [clojure.java.io/Coercions (t/? t/Any) :-> t/Any]
clojure.java.io/make-parents [(t/+ clojure.java.io/Coercions) :-> t/Any]
clojure.java.io/file [(t/+ clojure.java.io/Coercions) :-> java.io.File]
clojure.java.io/as-relative-path [clojure.java.io/Coercions :-> t/Str]
;; TODO second arg is flattened IOFactoryOpts
clojure.java.io/reader [clojure.java.io/IOFactory :-> java.io.BufferedReader]
;; TODO second arg is flattened IOFactoryOpts
clojure.java.io/writer [clojure.java.io/IOFactory :-> java.io.BufferedWriter]
clojure.java.io/resource [t/Str (t/? ClassLoader) :-> (t/Nilable java.net.URL)]
clojure.stacktrace/e [:-> t/Any]
clojure.stacktrace/print-cause-trace [Throwable :-> t/Any]
clojure.stacktrace/print-stack-trace [Throwable :-> t/Any]
clojure.stacktrace/print-throwable [Throwable :-> t/Any]
clojure.stacktrace/root-cause [Throwable :-> Throwable]
;; FIXME keyword arguments
clojure.reflect/reflect [(t/+ t/Any) :-> (t/Map t/Any t/Any)]
clojure.inspector/atom? [t/Any :-> t/Bool]
clojure.inspector/collection-tag [t/Any :-> t/Keyword]
clojure.inspector/tree-model [t/Any :-> t/Any]
clojure.inspector/old-table-model [t/AnySeqable :-> t/Any]
clojure.inspector/inspect [t/Any :-> javax.swing.JFrame]
clojure.inspector/inspect-tree [t/Any :-> javax.swing.JFrame]
clojure.inspector/inspect-table [t/AnySeqable :-> javax.swing.JFrame]
])
#?@(:cljs [] :default [
cc/class? (t/Pred Class)
cc/bytes? (t/Pred (Array byte))
cc/resolve [(t/? t/Any) t/Sym :-> (t/U t/AnyVar Class nil)]
cc/ns-resolve (t/IFn [(t/U t/Sym t/Namespace) t/Sym :-> (t/U t/AnyVar Class nil)]
; should &env arg be more accurate?
[(t/U t/Sym t/Namespace) t/Any t/Sym :-> (t/U t/AnyVar Class nil)])
cc/extenders [t/Any :-> (t/Seqable (t/Nilable Class))]
])
;coercions
#?@(:cljs [] :default [
cc/bigdec [(t/U t/Str t/Num) :-> BigDecimal]
cc/bigint [(t/U t/Str t/Num) :-> clojure.lang.BigInt]
cc/biginteger [(t/U t/Str t/Num) :-> java.math.BigInteger]
])
cc/boolean [t/Any :-> t/Bool]
cc/parse-boolean [t/Str :-> (t/Option t/Bool)]
cc/byte [(t/U Character t/Num) :-> Byte]
#?@(:cljs [
cc/char [(t/U t/Str t/Num) :-> t/Str]
] :default [
cc/char [(t/U Character t/Num) :-> Character]
])
cc/double [t/Num :-> #?(:cljs t/Num :default Double)]
cc/parse-double [t/Str :-> (t/Option #?(:cljs t/Num :default Double))]
;array ctors
#?@(:cljs [] :default [
cc/boolean-array (t/IFn [(t/U t/Num (t/Seqable t/Bool)) :-> (Array boolean)]
[t/Num (t/U t/Bool (t/Seqable t/Bool)) :-> (Array boolean)])
cc/byte-array (t/IFn [(t/U t/Num (t/Seqable Byte)) :-> (Array byte)]
[t/Num (t/U Byte (t/Seqable Byte)) :-> (Array byte)])
cc/char-array (t/IFn [(t/U t/Num (t/Seqable Character)) :-> (Array char)]
[t/Num (t/U t/Num (t/Seqable Character)) :-> (Array char)])
cc/short-array (t/IFn [(t/U t/Num (t/Seqable Short)) :-> (Array short)]
[t/Num (t/U Short (t/Seqable Short)) :-> (Array short)])
cc/int-array (t/IFn [(t/U t/Num (t/Seqable t/Num)) :-> (Array int)]
[t/Num (t/U t/Num (t/Seqable t/Num)) :-> (Array int)])
cc/double-array (t/IFn [(t/U t/Num (t/Seqable t/Num)) :-> (Array double)]
[t/Num (t/U t/Num (t/Seqable t/Num)) :-> (Array double)])
])
;cast to java array
;; TODO rethink input and output types. eg.,
;; cc/booleans [(ReadyOnlyArray boolean) :-> (t/U nil (Array boolean))]
;; TODO objects??
;; cc/objects [(ReadyOnlyArray Object) :-> (t/U nil (ReadyOnlyArray Object))]
;;
;; TODO propagate to Numbers/booleans etc
;cc/booleans [t/Any :-> (t/U nil (Array boolean))]
;cc/bytes [t/Any :-> (t/U nil (Array byte))]
;cc/chars [t/Any :-> (t/U nil (Array char))]
;cc/shorts [t/Any :-> (t/U nil (Array short))]
;cc/ints [t/Any :-> (t/U nil (Array int))]
;cc/longs [t/Any :-> (t/U nil (Array long))]
;cc/floats [t/Any :-> (t/U nil (Array float))]
;cc/doubles [t/Any :-> (t/U nil (Array double))]
fluree/db
(ns json-ld.lists
(:require [fluree.db.method.ipfs.core :as ipfs]
[fluree.db.db.json-ld :as jld-db]
[fluree.db.json-ld.transact :as jld-tx]
[clojure.core.async :as async]
[fluree.db.flake :as flake]
[fluree.db.json-ld.api :as fluree]
[fluree.db.util.async :refer [<?? go-try channel?]]
[fluree.db.query.range :as query-range]
[fluree.db.constants :as const]
[fluree.db.dbproto :as dbproto]
[fluree.db.did :as did]
[fluree.db.conn.proto :as conn-proto]
[fluree.db.util.json :as json]
[fluree.json-ld :as json-ld]
[fluree.db.indexer.default :as indexer]
[fluree.db.indexer.proto :as idx-proto]
[fluree.db.util.log :as log]
[fluree.db.index :as index]))
(def ipfs-conn @(fluree/connect-ipfs
{:server nil ;; use default
;; ledger defaults used for newly created ledgers
:defaults {:ipns {:key "self"} ;; publish to ipns by default using the provided key/profile
:indexer {:reindex-min-bytes 5000
:reindex-max-bytes 10000000}
:context {:id "@id"
:type "@type"
:schema "http://schema.org/"
:sh "http://www.w3.org/ns/shacl#"
:rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
:rdfs "http://www.w3.org/2000/01/rdf-schema#"
:wiki "https://www.wikidata.org/wiki/"
:skos "http://www.w3.org/2008/05/skos#"
:f "https://ns.flur.ee/ledger#"}
:did (did/private->did-map "8ce4eca704d653dec594703c81a84c403c39f262e54ed014ed857438933a2e1c")}}))