Skip to content

Commit 34aea38

Browse files
committed
Fix some things
1 parent 2dbec9b commit 34aea38

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/basilisp/core.lpy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2589,7 +2589,7 @@
25892589
([]
25902590
(iterate inc 0))
25912591
([end]
2592-
(lazy-seq (cons 0 (range 1 end))))
2592+
(range 0 end))
25932593
([start end]
25942594
(lazy-seq
25952595
(when (< start end)

src/basilisp/pprint.lpy

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
;; Dynamic Vars for Configuration ;;
1515
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1616

17-
(def ^{:doc "The base used for printing integer literals and rationals. Default is 10."
17+
(def ^{:doc "The base used for printing integer literals and rationals.
18+
19+
Default is 10."
1820
:dynamic true}
1921
*print-base*
2022
10)
@@ -37,6 +39,7 @@
3739
nil)
3840

3941
(def ^{:doc "If bound to ``true``, calls to :lpy:fn:`write` will use pretty printing.
42+
4043
Default is ``false``, but :lpy:fn:`pprint` binds the value to ``true``."
4144
:dynamic true}
4245
*print-pretty*
@@ -45,12 +48,16 @@
4548
(def ^{:doc "If bound to ``true``, integers and rationals will be printed with a radix
4649
prefix. For bases 2, 8, and 16 the prefix will be ``#b``, ``#o`` and ``#x``
4750
respectively. All other bases will be specified as ``#XXr`` where ``XX`` is
48-
the decimal value of :lpy:var:`*print-base*`."
51+
the decimal value of :lpy:var:`*print-base*`.
52+
53+
Default is ``false``."
4954
:dynamic true}
5055
*print-radix*
5156
false)
5257

53-
(def ^{:doc "The soft upper limit for the length of the right margin. Default is 72."
58+
(def ^{:doc "The soft upper limit for the length of the right margin.
59+
60+
Default is 72."
5461
:dynamic true}
5562
*print-right-margin*
5663
72)
@@ -222,7 +229,15 @@
222229
(split-queue-with comparator (pop buffer))))
223230

224231
(defprotocol PrettyWriter
225-
"Protocol defining a writer type for pretty printing with the XP algorithm."
232+
"Protocol defining a writer type for pretty printing with the XP algorithm.
233+
234+
Callers should generally not be calling ``PrettyWriter`` protocol methods directly,
235+
but should instead call the other helper functions and macros directly.
236+
237+
.. seealso::
238+
239+
:lpy:fn:`pprint-logical-block`, :lpy:fn:`print-length-loop`,
240+
:lpy:fn:`pprint-newline`, :lpy:fn:`pprint-indent`"
226241
(start-block [this prefix per-line-prefix suffix])
227242
(end-block [this])
228243
(pp-indent [this relative-to offset])
@@ -287,9 +302,7 @@
287302
(and miser-width
288303
max-col
289304
(>= (.-start-col (.-block token)) (- max-col miser-width))
290-
(emit-linear-nl? token section)))
291-
;; TODO: figure out how to handle these newline types
292-
:fill nil))
305+
(emit-linear-nl? token section)))))
293306

294307
;; Generate the newline and subsequent indent from a newline token token.
295308
(gen-nl [token]

tests/basilisp/test_core_fns.lpy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@
808808
(is (= '(0 1 2 3 4) (take 5 (range)))))
809809

810810
(testing "1-arity"
811+
(is (= '() (range 0)))
811812
(is (= '(0 1 2) (take 5 (range 3))))
812813
(is (= '(0 1 2) (range 3)))
813814
(is (= '(0 1 2 3 4) (take 5 (range 10)))))

0 commit comments

Comments
 (0)