mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
core: change globals to vars in test
This commit is contained in:
parent
b8e1784a00
commit
619089aead
@ -1,5 +1,5 @@
|
||||
(defmodule IO
|
||||
(defn color-table []
|
||||
(def color-table
|
||||
[[@"black" @"30"]
|
||||
[@"red" @"31"]
|
||||
[@"green" @"32"]
|
||||
@ -24,14 +24,14 @@
|
||||
[@"bg-cyan" @"46"]
|
||||
[@"bg-white" @"47"]])
|
||||
|
||||
(def len-color-table 23) ; should be a count-macro
|
||||
(def len-color-table (Array.count &color-table))
|
||||
|
||||
(defn color-name-to-ansi [cname]
|
||||
(let [res @""]
|
||||
(do
|
||||
(for [i 0 len-color-table]
|
||||
(if (String.= cname (Array.nth (Array.nth &(color-table) i) 0))
|
||||
(set! res @(Array.nth (Array.nth &(color-table) i) 1))
|
||||
(if (String.= cname (Array.nth (Array.nth &color-table i) 0))
|
||||
(set! res @(Array.nth (Array.nth &color-table i) 1))
|
||||
()))
|
||||
(String.append @"\x1b[" (String.append res @"m")))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user