Native, fast starting Clojure interpreter for scripting
EPL-1.0 License
Bot releases are hidden (Show)
Published by borkdude over 4 years ago
#317: add clojure.repl/pst
#371: fix argument parsing: using --nrepl-server
without port fails when another argument followed
#372: add support for next.jdbc
and PostgresQL
(require '[next.jdbc :as jdbc]
'[clojure.pprint :refer [print-table]])
(defn query []
(let [db {:dbtype "postgres"
:dbname "medline"
:host "localhost"
:port 5555
:user "develop"
:password "develop"}]
(jdbc/execute!
(jdbc/get-datasource db)
["select main_id, published from who_ictrp limit 5"])))
(print-table (query))
$ ./bb /tmp/jdbc.clj
| :who_ictrp/main_id | :who_ictrp/published |
|--------------------+----------------------|
| NCT04085224 | 2019-09-10 |
| NCT04086225 | 2019-01-17 |
| NCT04084184 | 2019-03-15 |
| NCT04084197 | 2018-12-19 |
| NCT04085042 | 2020-06-01 |
Note: at the moment, only PostgresQL is supported. MySQL and sqlite are under investigation. If you have any working GraalVM examples of these databases in combination with Clojure and JDBC, let me know.
Special thanks to @yogthos for providing an example at https://github.com/yogthos/graal-web-app-example/tree/postgres.
borkdude/babashka.curl#16: parse errors into :err
value
clojure.core/load-string
now can parse multiple values and resets to the original namespace
add BigDecimal
and ClassNotFoundException
#375: add clojure.pprint/print-table
clojure.data.xml
.pom.xml
file.clojure.core
: load-string
, memoize
, xml-seq
cheshire.core
namespaceloop
bindings can refer to preceding ones like in let
clojure.repl/dir
when given a non-existent namespaceclojure.repl/apropos
and clojure.repl/source
(only works with code loaded from source, not with native code)resolve
can now be used as a normal functionclj-yaml.core
mark
and unmark
clojure.repl
namespace in REPL and Socket REPL at startupjava.lang.Comparable
. This makes bb
compatible with the arrangement library.java.net.DatagramSocket
, java.net.DatagramPacket
and java.net.InetAddress
. This makes bb
suited for implementing a statsd client.:form-params
#317: add clojure.repl/find-doc
#318: support :refer :all
and :use
to enhance compatibility with existing Clojure code.
borkdude/sci#303: add support for :rename
in :require
#353: when using a main argument (-m foo.bar
), the system property babashka.main
will be set.
This is useful in the situation when a script has a -main
function but must also be able to execute when invoked as a file with the -f
option:
(defn -main [& args]
...)
(when-not (System/getProperty "babashka.main")
(apply -main *command-line-args*))
#344: add nREPL documentation
#345: add test for .deleteOnExit
#346: implement nREPL close
and ls-sessions
operations
#347: fix issue with reader conditional
#348: support multiple top level forms in an nREPL eval
op. This fixes support for vim fireplace:
#349: send output to client while evaluating expression in nREPL server
Fixes:
PushbackInputStream
classBufferedOutputStream
when writing bencode in nREPL server100 Continue
.java.lang.Runtime
to support shutdown-hooks. See docs.Published by borkdude over 4 years ago
Thanks @jeroenvandijk, @rymndhng and @lispyclouds for contributing to this release. Also thanks to @bbatsov for his help on implementing an nREPL server.
#301: add nREPL server. You can start an nREPL server with bb --nrepl-server 1667
and then connect to it from your favorite editor.
#307: add java.io.FileReader
#310: add java.nio.FileSystem
and java.nio.FileSystems
#312: add .getMessage
method on ex-info
add clojure.core/*print-length*
add java.lang.Byte
add bencode.core
's read-bencode
and write-bencode
functions
add note taking app example
Always check CHANGES.md for breaking changes before upgrading.
babashka.curl
functions now return a response map with :status
, :headers
and :body
, whereas before it only returned the body.find-ns
didn't return nil for non-existing namespacerequire
is now a normal function instead of a special formcognitect.transit
namespace. Note: only reader
, read
, writer
and write
are currently supported.
$ echo "{:a 1}" | jet --to transit | ./bb '(transit/read (transit/reader System/in :json))'
{:a 1}
java.lang.NumberFormatException
, java.lang.RuntimeException
,java.util.MissingResourceException
and java.util.Properties
classes.$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {cprop {:mvn/version "0.1.16"}}}')
$ export ANSWER=43
$ bb "
(require '[cprop.core :refer [load-config]])
(spit \"config.edn\" {:answer 42})
(load-config :file \"config.edn\")"
{:answer 43}
ns-unmap
. Thanks @sogaiu.*ns*
after load-file
babashka.curl
to 3104d234a63fca71f0d3557c5d3dc23f4fbc294f
curl
in babashka Docker image
1666
for --socket-repl
optionPublished by borkdude over 4 years ago
Thanks @lispyclouds for contributing to this release.
clojure.pprint/pprint
clojure.core/eval
and clojure.core/read-string
babashka.curl
:$ ./bb '(-> (curl/get "https://clojure.org") (subs 0 10))'
"<!DOCTYPE "
See babashka.curl for usage.
Published by borkdude over 4 years ago
Thanks @sogaiu and @jeroenvandijk for contributing to this release.
spit
, slurp
and file-seq
re-groups
and re-matcher
clojure.core.async/go
macro by falling back on threadstry
bodyif
(thanks @jeroenvandijk)clojure.repl/doc
tools.cli
alias in user
namespaceclojure.repl/doc
)ns-imports
, ns-refers
and ns-map
clojure.pprint/pprint
backed by fipp
:clj
branch is taken when present and when not preceded by a :bb
branch.Added in clojure.core
: satisfies?
, promise
, deliver
, prefers
Support checking if something is a clojure.core.async
channel:
$ bb '(satisfies? clojure.core.async.impl.protocols/ReadPort (async/chan))'
true
Add java.lang.Long
, java.math.BigInteger
and java.security.MessageDigest
.
Babashka now has a Dockerfile
and is published to Docker hub.
Thanks @stijnopheide, @cldwalker, @jeroenvandijk and @hden for their contributions.