File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ function show(io::IO, x::Unitlike)
170170 showoperators = get (io, :showoperators , false )
171171 first = " "
172172 sep = showoperators ? " *" : " "
173- foreach (sortexp (typeof (x) . parameters[ 1 ] )) do y
173+ foreach (sortexp (x )) do y
174174 print (io,first)
175175 showrep (io,y)
176176 first = sep
182182 sortexp(xs)
183183Sort units to show positive exponents first.
184184"""
185- function sortexp (xs)
186- vcat ([x for x in xs if power (x) >= 0 ],
187- [x for x in xs if power (x) < 0 ])
188- end
185+ sortexp (xs) = sort! (collect (xs), by = u-> signbit (power (u)), alg = InsertionSort)
186+ @generated sortexp (:: Dimensions{D} ) where D = (sortexp (D)... ,)
187+ @generated sortexp (:: Units{U} ) where U = (sortexp (U)... ,)
189188
190189"""
191190 showrep(io::IO, x::Unit)
You can’t perform that action at this time.
0 commit comments