Skip to content

Instantly share code, notes, and snippets.

@tiye
Created February 3, 2024 18:45
Show Gist options
  • Save tiye/f008562fed9bbb291e492a261df9ad7d to your computer and use it in GitHub Desktop.
Save tiye/f008562fed9bbb291e492a261df9ad7d to your computer and use it in GitHub Desktop.
run with `cr -1 compact.cirru`
{} (:package |app)
:configs $ {} (:init-fn |app.main/main!) (:package |app) (:reload-fn |app.main/main!)
:modules $ []
:files $ {}
|app.lib $ %{} :FileEntry
:ns $ %{} :CodeEntry (:doc |)
:code $ quote (ns app.lib)
:defs $ {}
|call-lib $ %{} :CodeEntry (:doc |)
:code $ quote
defn call-lib () $ println "|Calling lib"
|fibo $ %{} :CodeEntry (:doc |)
:code $ quote
defn fibo (x)
if (&< x 3) 1 $ &+
fibo $ &- x 1
fibo $ &- x 2
|app.main $ %{} :FileEntry
:ns $ %{} :CodeEntry (:doc |)
:code $ quote
ns app.main $ :require
app.lib :refer $ call-lib fibo
:defs $ {}
|main! $ %{} :CodeEntry (:doc |)
:code $ quote
defn main! ()
; println "|Calling main function:" $ + 1 2 3 4 10
; println $ range 100
; call-lib
println $ fibo 34
; println $ re 0 1000000 0
|re $ %{} :CodeEntry (:doc |)
:code $ quote
defn re (acc limit x)
if (>= x limit) acc $ recur (+ acc x) limit (inc x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment