Files
bara-lang/examples/interop.clj
T
dimgigov 87d6028487 Phase 1-4: Reader, Runtime, Macros, Nim Interop — 543x faster than JVM Clojure
- Reader: maps, sets, syntax-quote, dispatch macros, metadata
- Runtime: CljVal type system, 80+ core functions (collections, strings, math, IO)
- Emitter: full CljVal-based code generation, macro expansion, inline fns
- Macros: defmacro with compile-time evaluator, ->, ->>, and, or, when, cond, for, doseq
- Nim Interop: nim/module/function syntax, auto-import, type mapping
- CLI: cljnim -e '<code>' for quick evaluation
- Tests: 60 unit tests (reader + emitter)
- Benchmarks: AOT suite showing 543x startup, 679x factorial vs JVM Clojure
- CI: GitLab CI pipeline
- Runtime library: lib/cljnim_runtime.nim (1070+ lines)
2026-05-08 16:34:39 +03:00

18 lines
569 B
Clojure

; Nim Interop — Достъп до Nim стандартната библиотека
(println "=== Nim Math Interop ===")
; math.sin, math.cos, math.sqrt
(println (nim/math/sin 0.0))
(println (nim/math/cos 0.0))
(println (nim/math/sqrt 4.0))
(println (nim/math/pow 2.0 10.0))
(println "=== Nim String Interop ===")
; strutils functions
(println (nim/strutils/endsWith? "hello world" "world"))
(println (nim/strutils/startsWith? "hello" "hel"))
(println (nim/strutils/toUpper "clojure"))
(println (nim/strutils/toLower "NIM"))
(println (nim/strutils/repeat "ha" 3))