Fork me on GitHub
#clojure-europe
<
2022-04-11
>
pez07:04:14

Good morning! I'm happy with having taken the next step with the mini-language for Calva document notation: A command that creates VS Code documents from the notation. With this in place users can 1. ”record” the state of some editing session 2. send us the notation 3. we can recreate it, and start investigating the problem. We'll see if it will make the difference I think it will make, regarding bug reports. I am taking the opportunity to celebrate prematurely. 😃

😻 1
pez07:04:04

This is the text I produce first in the video clip:

(ns pez.pirate-lang§  (:require [clojure.string :as string]))§§(def english-o {:alphabet    "|abcdefghijklmnopqrstuvwxyz"§                :vowels      "aeiou"§                :pirate-char "o"})§§(def swedish-o {:alphabet    "|1abcdefghijklmnopqrstuvwxyz"§                :vowels      "aeiouåäö"§                :pirate-char "o"})§§(defn- configure§  [{:keys [alphabet vowels pirate-char]}]§  (let [alphabet   (set (seq (string/upper-case alphabet)))§        vowels     (set (seq (string/upper-case vowels)))§        consonants (set (remove vowels alphabet))§        pirates    (if (vowels pirate-char)§                     vowels§                     consonants)]§    {:pirate-char pirate-char§     :pirates pirates}))§§(defn to-pirate-talk§  [text language]§  (let [{:keys [pirate-char pirates]} (configure language)]§    (apply str (mapcat (fn [c]§                         (if (pirates (first (string/upper-case c)))§                           (interpose pirate-char (repeat 2 c))§                           [c]))§                       text))))§§(defn from-pirate-talk§  [text language]§  (let [{:keys [pirate-char pirates]} (configure language)§        pattern (re-pattern (str "(?i)([" (apply str pirates) "])" pirate-char "\\1"))]§    (string/replace text pattern "$1")))§§(comment§  (to-pirate-talk "Have you heard about Pirate talk?" english-o)§  ;; => "HoHavove yoyou hohearordod aboboutot PoPiroratote totalolkok?"§§  (from-pirate-talk "HoHavove yoyou hohearordod aboboutot PoPiroratote totalolkok?" english-o)§  ;; => "Have you heard about Pirate talk?"§  )

pez07:04:15

You can grab the Calva VSIX from this issue https://github.com/BetterThanTomorrow/calva/issues/1662 And recreate the document from the above text. 😃

genRaiy08:04:03

Good morning

thomas08:04:03

Morning lovely people!

otfrom09:04:30

you're gonna need a bigger boat