From ea0618468098b9c6517b7f78fb6cf6924598ea41 Mon Sep 17 00:00:00 2001 From: Brandon Flores Date: Tue, 27 Feb 2024 02:44:18 -0600 Subject: [PATCH] Moved `CliffordNumbers.subscript_string` to a better place --- src/CliffordNumbers.jl | 15 --------------- src/show.jl | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/CliffordNumbers.jl b/src/CliffordNumbers.jl index cf8f69a..4eb68e0 100644 --- a/src/CliffordNumbers.jl +++ b/src/CliffordNumbers.jl @@ -8,21 +8,6 @@ encompasses all types that may be used to construct a `CliffordNumber`. """ const BaseNumber = Union{Real,Complex} -""" - CliffordNumbers.subscript_string(x::Number) -> String - -Produces a string representation of a number in subscript format. -""" -function subscript_string(x::Number) - str = collect(string(x)) - for (n,c) in enumerate(str) - ('0' <= c <= '9') && (str[n] = c + 0x2050) - (c === '-') && (str[n] = '₋') - (c === '+') && (str[n] = '₊') - end - return String(str) -end - # Contains tools for working with Hamming weights of integers include("hamming.jl") # Tools for defining quadratic forms/metric signatures (convention may not be great) diff --git a/src/show.jl b/src/show.jl index 63c655d..315578a 100644 --- a/src/show.jl +++ b/src/show.jl @@ -1,5 +1,20 @@ #---Pretty printing methods for exported types-----------------------------------------------------# +""" + CliffordNumbers.subscript_string(x::Number) -> String + +Produces a string representation of a number in subscript format. +""" +function subscript_string(x::Number) + str = collect(string(x)) + for (n,c) in enumerate(str) + ('0' <= c <= '9') && (str[n] = c + 0x2050) + (c === '-') && (str[n] = '₋') + (c === '+') && (str[n] = '₊') + end + return String(str) +end + """ CliffordNumbers.to_basis_str(b::BitIndex; [label], [pseudoscalar])