- Markdown style
[](https://youtu.be/nTQUwghvy5Q)
- HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
(ns prefix-tree) | |
;Record representing a node in the prefix tree. | |
;strings: The set of strings that the present node represents | |
;edges: Map representing edges emanating from this node. | |
;The key being the first letter of the label and the value being the label and the actual node being pointed to." | |
(defrecord Node [strings edges]) | |
(defn shorter-string [a b] | |
"Return the shorter string of the two being passed in." |
public sealed interface Shape permits Shape.Rectangle, Shape.Square, Shape.Circle { | |
record Circle(double radius) implements Shape {} | |
record Rectangle(double length, double width) implements Shape {} | |
record Square(double side) implements Shape {} | |
} | |
public class Main { | |
public static double calculateArea(Shape shape) { | |
return switch (shape) { |
(ns webdav | |
(:require [clojure.string :as str] | |
[clojure.data.xml :as xml] | |
[org.httpkit.server :as hk-server])) | |
;; add the XML namespace that we'll use later | |
(xml/alias-uri 'd "DAV:") | |
(defn dissoc-in | |
"Should be in the standard library..." |
A minimal example of creating a (mostly) working FUSE filesystem using Clojure. NOTE: I have only tested this with OSX, and it assumes you have already installed libfuse.
Create an empty directory at /tmp/meld
to serve as your mount point,
put these files in a directory called meld
, then:
(ns radix | |
(:require [clojure.string :as string])) | |
(use 'clojure.java.io) | |
(use 'clojure.pprint) | |
(println "Loading names... ") | |
(time (def names | |
(with-open | |
[rdr (reader | |
"/usr/share/dict/ProperNames")] |
~ $ clj -Ttools install io.github.babashka/http-server '{:git/tag "v0.1.4"}' :as serve | |
Checking out: https://github.com/clojure/tools.tools.git at 9c5baa56cff02de98737a71d4dab098b268cd68b | |
Error building classpath. Failed to read artifact descriptor for org.clojure:tools.deps.alpha:jar:0.14.1212 | |
org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.clojure:tools.deps.alpha:jar:0.14.1212 | |
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:259) | |
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:175) | |
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255) | |
at clojure.tools.deps.alpha.extensions.maven$read_descriptor.invokeStatic(maven.clj:115) | |
at clojure.tools.deps.alpha.extensions.maven$fn__1137.invokeStatic(maven.clj:143) |
(ns example | |
(:require ["bitcoinjs-lib$default" :as btc] | |
["tiny-secp256k1" :as secp] | |
["ecpair$default" :as ecpair] | |
["axios$default" :as axios] | |
[promesa.core :as p] | |
[cljs-bean.core :refer [->clj]])) | |
(def ecpf (ecpair/ECPairFactory. secp)) |
@echo off | |
set ARGS=%* | |
bb.exe -f gh_releases.clj %ARGS% |
(require '[babashka.deps :as deps]) | |
(deps/add-deps '{:deps {borkdude/gh-artifacts | |
{:git/url "https://github.com/borkdude/gh-release-artifact" | |
:git/sha "2f8898d84126a4e922c490f8614211a8b0cf67cd"}}}) | |
(assert (System/getenv "GITHUB_TOKEN") "GITHUB_TOKEN env var not set") | |
(require '[borkdude.gh-release-artifact :as gh]) | |
(def args | |
(into {} | |
(for [[arg-name arg-val] (partition 2 (rest *command-line-args*))] |