Skip to content

Commit

Permalink
Add Q# rational tag
Browse files Browse the repository at this point in the history
  • Loading branch information
gilch committed Sep 29, 2024
1 parent 8a30e99 commit 94621a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/hissp/macros.lissp
Original file line number Diff line number Diff line change
Expand Up @@ -2417,6 +2417,18 @@ Hidden doctest adds bundled macros for REPL-consistent behavior.
(-<>> (.format "b'{}'"))
ast..literal_eval))

(defmacro Q\# Q
<#; ``Q#`` 'Rational' Exact fraction tag.
;;
;; .. code-block:: REPL
;;
;; #> Q#2/3
;; >>> # Fraction(2, 3)
;; ... __import__('pickle').loads(b'cfractions\nFraction\n(I2\nI3\ntR.')
;; Fraction(2, 3)
;;
(fractions..Fraction (hissp..demunge Q)))

(defmacro en\# f
<#;``en#`` tag.
;; Wrap a function applicable to a tuple as a function of its elements.
Expand Down

0 comments on commit 94621a5

Please sign in to comment.