Skip to content

Commit

Permalink
v1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
candid82 committed Dec 26, 2023
1 parent 53756ef commit 48d8a92
Show file tree
Hide file tree
Showing 22 changed files with 368 additions and 410 deletions.
2 changes: 1 addition & 1 deletion core/procs.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
PRINT_IF_NOT_NIL
)

const VERSION = "v1.3.3"
const VERSION = "v1.3.4"

const (
CLJ Dialect = iota
Expand Down
13 changes: 13 additions & 0 deletions docs/joker.time.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ <h2 id="_index">Index</h2>
<li>
<a href="#ansi-c">ansi-c</a>
</li>
<li>
<a href="#day-of-year">day-of-year</a>
</li>
<li>
<a href="#format">format</a>
</li>
Expand Down Expand Up @@ -369,6 +372,16 @@ <h3 class="Function" id="add-date">add-date</h3>
<p class="var-docstr">Returns the time t + (years, months, days).</p>


</li>
<li>
<h3 class="Function" id="day-of-year">day-of-year</h3>
<span class="var-kind Function">Function</span>
<span class="var-added">v1.3.4</span>
<pre class="var-usage"><div><code>(day-of-year t)</code></div>
</pre>
<p class="var-docstr">Returns the day of the year specified by t, in the range [1,365] for non-leap years, and [1,366] in leap years.</p>


</li>
<li>
<h3 class="Function" id="format">format</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/main.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions std/base64.joke
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
(ns
^{:go-imports []
:doc "Implements base64 encoding as specified by RFC 4648."}
(ns ^{:go-imports []
:doc "Implements base64 encoding as specified by RFC 4648."}
base64)

(defn ^String decode-string
"Returns the bytes represented by the base64 string s."
{:added "1.0"
:go "decodeString(s)"}
:go "decodeString(s)"}
[^String s])

(defn ^String encode-string
"Returns the base64 encoding of s."
{:added "1.0"
:go "encodeString(s)"}
:go "encodeString(s)"}
[^String s])
5 changes: 2 additions & 3 deletions std/bolt.joke
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns
^{:go-imports []
:doc "Provide API for Bolt embedded database https://github.com/etcd-io/bbolt.
(ns ^{:go-imports []
:doc "Provide API for Bolt embedded database https://github.com/etcd-io/bbolt.

Example:

Expand Down
23 changes: 11 additions & 12 deletions std/crypto.joke
Original file line number Diff line number Diff line change
@@ -1,59 +1,58 @@
(ns
^{:go-imports ["crypto/sha256" "crypto/sha512" "crypto/md5" "crypto/sha1"]
:doc "Implements common cryptographic and hash functions."}
(ns ^{:go-imports ["crypto/sha256" "crypto/sha512" "crypto/md5" "crypto/sha1"]
:doc "Implements common cryptographic and hash functions."}
crypto)

(defn ^String hmac
"Returns HMAC signature for message and key using specified algorithm.
Algorithm is one of the following: :sha1, :sha224, :sha256, :sha384, :sha512."
{:added "1.0"
:go "hmacSum(algorithm, message, key)"}
:go "hmacSum(algorithm, message, key)"}
[^Keyword algorithm ^String message ^String key])

(defn ^String sha256
"Returns the SHA256 checksum of the data."
{:added "1.0"
:go "! t := sha256.Sum256([]byte(data)); _res := string(t[:])"}
:go "! t := sha256.Sum256([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String sha224
"Returns the SHA224 checksum of the data."
{:added "1.0"
:go "! t := sha256.Sum224([]byte(data)); _res := string(t[:])"}
:go "! t := sha256.Sum224([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String sha384
"Returns the SHA384 checksum of the data."
{:added "1.0"
:go "! t := sha512.Sum384([]byte(data)); _res := string(t[:])"}
:go "! t := sha512.Sum384([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String sha512
"Returns the SHA512 checksum of the data."
{:added "1.0"
:go "! t := sha512.Sum512([]byte(data)); _res := string(t[:])"}
:go "! t := sha512.Sum512([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String sha512-224
"Returns the SHA512/224 checksum of the data."
{:added "1.0"
:go "! t := sha512.Sum512_224([]byte(data)); _res := string(t[:])"}
:go "! t := sha512.Sum512_224([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String sha512-256
"Returns the SHA512/256 checksum of the data."
{:added "1.0"
:go "! t := sha512.Sum512_256([]byte(data)); _res := string(t[:])"}
:go "! t := sha512.Sum512_256([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String md5
"Returns the MD5 checksum of the data."
{:added "1.0"
:go "! t := md5.Sum([]byte(data)); _res := string(t[:])"}
:go "! t := md5.Sum([]byte(data)); _res := string(t[:])"}
[^String data])

(defn ^String sha1
"Returns the SHA1 checksum of the data."
{:added "1.0"
:go "! t := sha1.Sum([]byte(data)); _res := string(t[:])"}
:go "! t := sha1.Sum([]byte(data)); _res := string(t[:])"}
[^String data])
17 changes: 8 additions & 9 deletions std/csv.joke
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns
^{:go-imports []
:doc "Reads and writes comma-separated values (CSV) files as defined in RFC 4180."}
(ns ^{:go-imports []
:doc "Reads and writes comma-separated values (CSV) files as defined in RFC 4180."}
csv)

(defn csv-seq
Expand Down Expand Up @@ -34,8 +33,8 @@
This is done even if the field delimiter, comma, is white space.
Default value is false."
{:added "1.0"
:go {1 "csvSeqOpts(rdr, EmptyArrayMap())"
2 "csvSeqOpts(rdr, opts)"}}
:go {1 "csvSeqOpts(rdr, EmptyArrayMap())"
2 "csvSeqOpts(rdr, opts)"}}
([^Object rdr])
([^Object rdr ^Map opts]))

Expand All @@ -48,8 +47,8 @@

:use-crlf - if true, uses \\r\\n as the line terminator. Default value is false."
{:added "1.0"
:go {1 "writeString(data, EmptyArrayMap())"
2 "writeString(data, opts)"}}
:go {1 "writeString(data, EmptyArrayMap())"
2 "writeString(data, opts)"}}
([^Seqable data])
([^Seqable data ^Map opts]))

Expand All @@ -59,8 +58,8 @@
data must be Seqable, each element of which must be Seqable as well.
opts is as in joker.csv/write-string."
{:added "1.0"
:go {2 "write(f, data, EmptyArrayMap())"
3 "write(f, data, opts)"}}
:go {2 "write(f, data, EmptyArrayMap())"
3 "write(f, data, opts)"}}
([^IOWriter f ^Seqable data])
([^IOWriter f ^Seqable data ^Map opts]))

Expand Down
61 changes: 29 additions & 32 deletions std/filepath.joke
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
(ns
^{:go-imports ["path/filepath"]
:doc "Implements utility routines for manipulating filename paths."}
(ns ^{:go-imports ["path/filepath"]
:doc "Implements utility routines for manipulating filename paths."}
filepath)

(defn file-seq
"Returns a seq of maps with info about files or directories under root."
{:added "1.0"
:go "fileSeq(root)"}
:go "fileSeq(root)"}
[^String root])

(defn ^String abs
Expand All @@ -15,15 +14,15 @@
The absolute path name for a given file is not guaranteed to be unique.
Calls clean on the result."
{:added "1.0"
:go "! _res, err := filepath.Abs(path); PanicOnErr(err)"}
:go "! _res, err := filepath.Abs(path); PanicOnErr(err)"}
[^String path])

(defn ^String base
"Returns the last element of path. Trailing path separators are removed before
extracting the last element. If the path is empty, returns \".\". If the path consists
entirely of separators, returns a single separator."
{:added "1.0"
:go "filepath.Base(path)"}
:go "filepath.Base(path)"}
[^String path])

(defn ^String clean
Expand All @@ -43,7 +42,7 @@ Finally, any occurrences of slash are replaced by separator.

If the result of this process is an empty string, returns the string \".\"."
{:added "1.0"
:go "filepath.Clean(path)"}
:go "filepath.Clean(path)"}
[^String path])

(defn ^String dir
Expand All @@ -52,29 +51,29 @@ If the result of this process is an empty string, returns the string \".\"."
If the path is empty, returns \".\". If the path consists entirely of separators,
returns a single separator. The returned path does not end in a separator unless it is the root directory."
{:added "1.0"
:go "filepath.Dir(path)"}
:go "filepath.Dir(path)"}
[^String path])

(defn ^String eval-symlinks
"Returns the path name after the evaluation of any symbolic links. If path is relative the result will be
relative to the current directory, unless one of the components is an absolute symbolic link.
Calls clean on the result."
{:added "1.0"
:go "! _res, err := filepath.EvalSymlinks(path); PanicOnErr(err)"}
:go "! _res, err := filepath.EvalSymlinks(path); PanicOnErr(err)"}
[^String path])

(defn ^String ext
"Returns the file name extension used by path. The extension is the suffix beginning at the final dot
in the final element of path; it is empty if there is no dot."
{:added "1.0"
:go "filepath.Ext(path)"}
:go "filepath.Ext(path)"}
[^String path])

(defn ^String from-slash
"Returns the result of replacing each slash ('/') character in path with a separator character.
Multiple slashes are replaced by multiple separators."
{:added "1.0"
:go "filepath.FromSlash(path)"}
:go "filepath.FromSlash(path)"}
[^String path])

(defn ^{:tag [String]} glob
Expand All @@ -85,21 +84,21 @@ If the result of this process is an empty string, returns the string \".\"."
Ignores file system errors such as I/O errors reading directories.
Throws exception when pattern is malformed."
{:added "1.0"
:go "! _res, err := filepath.Glob(pattern); PanicOnErr(err)"}
:go "! _res, err := filepath.Glob(pattern); PanicOnErr(err)"}
[^String pattern])

(defn ^Boolean abs?
"Reports whether the path is absolute."
{:added "1.0"
:go "filepath.IsAbs(path)"}
:go "filepath.IsAbs(path)"}
[^String path])

(defn ^String join
"Joins any number of path elements into a single path, adding a separator if necessary.
Calls clean on the result; in particular, all empty strings are ignored. On Windows,
the result is a UNC path if and only if the first path element is a UNC path."
{:added "1.0"
:go "filepath.Join(elems...)"}
:go "filepath.Join(elems...)"}
[& ^String elems])

(defn ^Boolean matches?
Expand All @@ -108,7 +107,7 @@ If the result of this process is an empty string, returns the string \".\"."
Throws exception if pattern is malformed.
On Windows, escaping is disabled. Instead, '\\' is treated as path separator."
{:added "1.0"
:go "! _res, err := filepath.Match(pattern, name); PanicOnErr(err)"}
:go "! _res, err := filepath.Match(pattern, name); PanicOnErr(err)"}
[^String pattern ^String name])

(defn ^String rel
Expand All @@ -118,50 +117,48 @@ If the result of this process is an empty string, returns the string \".\"."
relative to basepath or if knowing the current working directory would be necessary to compute it.
Calls clean on the result."
{:added "1.0"
:go "! _res, err := filepath.Rel(basepath, targpath); PanicOnErr(err)"}
:go "! _res, err := filepath.Rel(basepath, targpath); PanicOnErr(err)"}
[^String basepath ^String targpath])

(defn split
"Splits path immediately following the final separator, separating it into a directory and file name component.
If there is no separator in path, returns an empty dir and file set to path. The returned values have
the property that path = dir+file."
{:added "1.0"
:go "! _dir, _file := filepath.Split(path); _res := NewVectorFrom(MakeString(_dir), MakeString(_file))"}
:go "! _dir, _file := filepath.Split(path); _res := NewVectorFrom(MakeString(_dir), MakeString(_file))"}
[^String path])

(defn ^{:tag [String]} split-list
"Splits a list of paths joined by the OS-specific list-separator, usually found in PATH or GOPATH environment variables.
Returns an empty slice when passed an empty string."
{:added "1.0"
:go "filepath.SplitList(path)"}
:go "filepath.SplitList(path)"}
[^String path])

(defn ^String to-slash
"Returns the result of replacing each separator character in path with a slash ('/') character.
Multiple separators are replaced by multiple slashes."
{:added "1.0"
:go "filepath.ToSlash(path)"}
:go "filepath.ToSlash(path)"}
[^String path])

(defn ^String volume-name
"Returns leading volume name. Given \"C:\\foo\\bar\" it returns \"C:\" on Windows. Given \"\\\\host\\share\\foo\"
returns \"\\\\host\\share\". On other platforms it returns \"\"."
{:added "1.0"
:go "filepath.VolumeName(path)"}
:go "filepath.VolumeName(path)"}
[^String path])

(def
^{:doc "OS-specific path separator."
:added "1.0"
:tag String
:const true
:go "string(filepath.Separator)"}
(def ^{:doc "OS-specific path separator."
:added "1.0"
:tag String
:const true
:go "string(filepath.Separator)"}
separator)

(def
^{:doc "OS-specific path list separator."
:added "1.0"
:tag String
:const true
:go "string(filepath.ListSeparator)"}
(def ^{:doc "OS-specific path list separator."
:added "1.0"
:tag String
:const true
:go "string(filepath.ListSeparator)"}
list-separator)
9 changes: 4 additions & 5 deletions std/hex.joke
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
(ns
^{:go-imports ["encoding/hex"]
:doc "Implements hexadecimal encoding and decoding."}
(ns ^{:go-imports ["encoding/hex"]
:doc "Implements hexadecimal encoding and decoding."}
hex)

(defn ^String decode-string
"Returns the bytes represented by the hexadecimal string s."
{:added "1.0"
:go "! t, err := hex.DecodeString(s); PanicOnErr(err); _res := string(t)"}
:go "! t, err := hex.DecodeString(s); PanicOnErr(err); _res := string(t)"}
[^String s])

(defn ^String encode-string
"Returns the hexadecimal encoding of s."
{:added "1.0"
:go "hex.EncodeToString([]byte(s))"}
:go "hex.EncodeToString([]byte(s))"}
[^String s])
9 changes: 4 additions & 5 deletions std/html.joke
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
(ns
^{:go-imports ["html"]
:doc "Provides functions for escaping and unescaping HTML text."}
(ns ^{:go-imports ["html"]
:doc "Provides functions for escaping and unescaping HTML text."}
html)

(defn ^String escape
"Escapes special characters like < to become &lt;. It escapes only five such characters: <, >, &, ' and \"."
{:added "1.0"
:go "html.EscapeString(s)"}
:go "html.EscapeString(s)"}
[^String s])

(defn ^String unescape
"Unescapes entities like &lt; to become <."
{:added "1.0"
:go "html.UnescapeString(s)"}
:go "html.UnescapeString(s)"}
[^String s])
Loading

0 comments on commit 48d8a92

Please sign in to comment.