JPhrases/TypeChange
< JPhrases
Jump to navigation
Jump to search
13C. Type Change
m0=: [: 0&": 10 #. #: Character binary format of integer y m1=: 1: ": |:@(10 10 #: >:@i.) Character form of column # heading m2=: ] { '0123456789abcdef'"_ Character form of #, bases 2 thru 16 m3=: <"1 Box lists of array y m4=:16"_#.'0123456789abcdef' i.] Decimal from hexadecimal characters y m5=: 10"_ #. '0123456789' i. ] Decimal from decimal characters y m6=: ". Convert rows of y to numbers (default 0) d7=: [ ]`[@.(0: = #@]) ".@] # from character y, x if y not a number m8=: [:}.[:".[:'0 '&,*./@
(e.&'0123456789'@]) # ]# from character, empty if not character m9=: ". Execute each row of character table y m10=: +/@:". Sum of numbers in character table y m11=: ":@,. Format numeric list y as table d12=: [:}."1[:": (10^[)+([:,.]) Format list y as x-wide col with leading 0s d13=: [ n24 } m25@] Format y with 0s replaced by x d14=: ":"_1 Row-wise format of y by x d15=: ": Format y in fields <.x wide and 1|x decimals m16=: #@": Number of characters in format of y n17=: rn=: 'MDCLXVI' Roman numerals m18=: rn&i. Roman numerals y in code m19=: {&1000 500 100 50 10 5 1 Decode decimal values from indices y m20=: [: | [:-/]+//.~0:,~2:</\] Decimal number from values of Roman m21=: DFR=: m20@m19@m18 Decimal from Roman m22=: RFD=:#&rn@(5 2 5 2 5 2 5&#:) Roman from Decimal (no refinements) v23=: [: <"1 $ #: [: m26 [:,'1' =] Indices of '1' in character table y n24=: [`(v23@{:@])`({.@]) Gerund for amend m25=: [: ": ] ,: ] = 0: Laminate boolean array locating free 0s in y m26=: +/ {. \: Indices of 1s in Boolean list y
y 12.34 4 0 7.8 0 6 0 8.9 123.45 0 0 10.11 ' ' d13 y 12.34 4 7.8 6 8.9 123.45 10.11 DFR 'MCMIX' 1909 RFD 1909 MDCCCCVIIII