This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; This is improved example of *RPN calculator* originally made CapitalEx from Discord/Concatenative | |
; https://gist.github.com/Capital-EX/d08a37765ef898cd432f662ffc7aaf98 | |
rye .needs { fyne } | |
do\in fyne { | |
append-a: fn { n } { value-a .get-text .concat n |set-text* value-a } | |
num-button: fn { n } { button n [ 'append-a n ] } | |
calc-button: fn { lbl op1 } { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; # Rye HOFs demo | |
; | |
numbers: { 1 2 3 4 } | |
; | |
; map | |
; | |
numbers |map { + 100 } |prn ; add 100 to all numbers | |
numbers |map { .factor-of 2 } |prn ; turn to 1 if even and 0 otherwise | |
numbers |map { :x , x * x } |prn ; run to it's squares |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clojpression-puzzle | |
(:require [clojure.test :refer [is]])) | |
(def compress (partial transduce (comp (partition-by identity) | |
(mapcat (fn [[c & _ :as cs]] | |
[(count cs) c]))) | |
str)) | |
(defn run [& _] | |
(is (= (compress "AAABBAAC") "3A2B2A1C"))) |