1
0
mirror of https://github.com/janet-lang/janet synced 2024-09-28 15:08:40 +00:00

Strip whitespace in boot.dst

This commit is contained in:
Calvin Rose 2018-05-18 22:18:34 -04:00
parent c2199646be
commit 5b62630a9b

View File

@ -62,7 +62,7 @@
(defn one? [x] (== x 1))
(defn integer? [x] (= (type x) :integer))
(defn real? [x] (= (type x) :real))
(defn number? [x]
(defn number? [x]
(def t (type x))
(if (= t :integer) true (= t :real)))
(defn fiber? [x] (= (type x) :fiber))
@ -77,10 +77,10 @@
(defn array? [x] (= (type x) :array))
(defn tuple? [x] (= (type x) :tuple))
(defn boolean? [x] (= (type x) :boolean))
(defn bytes? [x]
(defn bytes? [x]
(def t (type x))
(if (= t :string) true (if (= t :symbol) true (= t :buffer))))
(defn dictionary? [x]
(defn dictionary? [x]
(def t (type x))
(if (= t :table) true (= t :struct)))
(defn indexed? [x]
@ -959,12 +959,12 @@ onvalue."
(when tail (file.write stdout " (tailcall)"))
(file.write stdout "\n"))))
(defn eval
(defn eval
"Evaluates a string in the current environment. If more control over the
environment is needed, use run-context."
[str]
(var state (string str))
(defn chunks [buf]
(defn chunks [buf]
(def ret state)
(:= state nil)
(if ret
@ -987,14 +987,15 @@ environment is needed, use run-context."
(defn checkmodule
[f testpath]
(if f f (do
(def p (string.replace-all "?" normname testpath))
(def p (string.replace-all "?" normname testpath))
(file.open p))))
(reduce checkmodule nil module.paths))
(def require
(def require
"Require a module with the given name. Will search all of the paths in
module.paths, then the path as a raw file path. Returns the new environment
returned from compiling and running the file."
returned from compiling and running the file."
(do
(def cache @{})
(def loading @{})
@ -1041,7 +1042,7 @@ symbols into the current environment, prepending a given prefix as needed.
(use the :as or :prefix option to set a prefix). If no prefix is provided,
use the name of the module as a prefix."
(def upath (string (ast.unwrap path)))
(def argm (map (fn [x]
(def argm (map (fn [x]
(if (and (symbol? x) (= (get x 0) 58))
x
(string x)))