Skip to content

Commit d08ac3d

Browse files
Make pr a dynamic var (#821)
Hi, could you please review patch to dynamically bind core `pr` fn. It fixes #820. Thanks Co-authored-by: ikappaki <[email protected]> Co-authored-by: Chris Rink <[email protected]>
1 parent 56757b6 commit d08ac3d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
* Generate Protocol functions with nicer names based on the protocol function and dispatch type (#803)
2424
* Loosen the dependency specification for Immutables and Pyrsistent to allow for a wider version range (#805)
2525
* Allow `case` forms with only a default expression (#807)
26+
* Make `pr` a dynamic variable (#820)
2627

2728
### Fixed
2829
* Fix issue with `(count nil)` throwing an exception (#759)

src/basilisp/core.lpy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4116,7 +4116,10 @@
41164116
value bound to :lpy:var:`*print-sep*` (default is an ASCII space).
41174117

41184118
Note that some dynamically created Basilisp forms (such keywords and symbols) and
4119-
Python objects may not be readable again."
4119+
Python objects may not be readable again.
4120+
4121+
It can be dynamically bound."
4122+
{:dynamic true}
41204123
([] nil)
41214124
([x]
41224125
(.write *out* (repr x))

tests/basilisp/test_core_fns.lpy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,3 +2084,11 @@
20842084
(finally
20852085
(when (bio/exists? load-dir-test)
20862086
(shutil/rmtree load-dir-test))))))
2087+
2088+
;;;;;;;;;;;;;;
2089+
;; printing ;;
2090+
;;;;;;;;;;;;;;
2091+
2092+
(deftest pr-test
2093+
(testing "is dynamic"
2094+
(is (= '(1) (binding [pr (fn [& more] more)] (pr 1))))))

0 commit comments

Comments
 (0)