Skip to main content
Commonmark migration
Source Link

#APL NARS 35 chars

APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the basic types ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite types ('Tensor 3' 'Tensor 4' etc 'Matrix', 'List', 'String')
  ⍝ follow the example in: https://codegolf.stackexchange.com/a/39745
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄v=1:'List'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}
  h←{'Int'≢type ⍵:¯1⋄(⍵<1)∨⍵>2e5:¯1⋄v ⍵} 
  h 1
10
  h 1.32
¯1
  h 7878
8057
  h¨3 5 12
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0003
¯1
  h ¯2
¯1
  h 0
¯1
  h 200000
201200
  h 200001
¯1
  

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the basic types ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite types ('Tensor 3' 'Tensor 4' etc 'Matrix', 'List', 'String')
  ⍝ follow the example in: https://codegolf.stackexchange.com/a/39745
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄v=1:'List'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}
  h←{'Int'≢type ⍵:¯1⋄(⍵<1)∨⍵>2e5:¯1⋄v ⍵} 
  h 1
10
  h 1.32
¯1
  h 7878
8057
  h¨3 5 12
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0003
¯1
  h ¯2
¯1
  h 0
¯1
  h 200000
201200
  h 200001
¯1
  

APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the basic types ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite types ('Tensor 3' 'Tensor 4' etc 'Matrix', 'List', 'String')
  ⍝ follow the example in: https://codegolf.stackexchange.com/a/39745
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄v=1:'List'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}
  h←{'Int'≢type ⍵:¯1⋄(⍵<1)∨⍵>2e5:¯1⋄v ⍵} 
  h 1
10
  h 1.32
¯1
  h 7878
8057
  h¨3 5 12
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0003
¯1
  h ¯2
¯1
  h 0
¯1
  h 200000
201200
  h 200001
¯1
  
added 162 characters in body
Source Link
user58988
user58988

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the scalarbasic typetypes ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite typetypes ('Tensor 3' 'Tensor 4' etc 'Matrix', 'List', 'String')
  ⍝ follow the example in: https://codegolf.stackexchange.com/a/39745
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄(v=1)∧⍬≡0↑⍵'Char'⋄v=1:'List Numeric'⋄⍵≢+⍵'List'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}  
  h←{'Int'≢type ⍵:¯1⋄(⍵<1)∨⍵>2e5:¯1⋄v ⍵} 
  h 1  
10
  h 1.37  32
¯1
  h 7878  
8057
  h¨3 5 12    
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.00020003
¯1
  h ¯2
¯1
  h 0
¯1
  h 200000
201200
  h 200001
¯1
  

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the scalar type ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite type ('Tensor 3' 'Tensor 4' etc 'Matrix', 'String')
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄(v=1)∧⍬≡0↑⍵:'List Numeric'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}  
  h←{'Int'≢type ⍵:¯1⋄v ⍵} 
  h 1  
10
  h 1.37  
¯1
  h 7878  
8057
  h¨3 5 12    
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0002
¯1
  

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the basic types ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite types ('Tensor 3' 'Tensor 4' etc 'Matrix', 'List', 'String')
  ⍝ follow the example in: https://codegolf.stackexchange.com/a/39745
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄v=1:'List'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}
  h←{'Int'≢type ⍵:¯1⋄(⍵<1)∨⍵>2e5:¯1⋄v ⍵} 
  h 1
10
  h 1.32
¯1
  h 7878
8057
  h¨3 5 12
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0003
¯1
  h ¯2
¯1
  h 0
¯1
  h 200000
201200
  h 200001
¯1
  
added 631 characters in body
Source Link
user58988
user58988

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  v¨3⍝ return the one string for the scalar type ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite type ('Tensor 3' 'Tensor 4' etc 'Matrix', 'String')
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄(v=1)∧⍬≡0↑⍵:'List Numeric'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}  
  h←{'Int'≢type ⍵:¯1⋄v ⍵} 
  h 1  
10
  h 1.37  
¯1
  h 7878  
8057
  h¨3 5 12    
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0002
¯1
  

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number

  v¨3 5 12
13 15 23

#APL NARS 35 chars

r←v a;c
r←c←0
A:r+←1⋄c+←r≠⍎⌽⍕r⋄→A×⍳c<a

it is the function v; "⍎⌽⍕"r traslate number r in string, reverse that string, traslate from string to number. Test and help functions:

  ⍝ return the one string for the scalar type ('Char', 'Int', 'Float', 'Complex or Quaternion or Oction')
  ⍝ or one string for composite type ('Tensor 3' 'Tensor 4' etc 'Matrix', 'String')
  type←{v←⍴⍴⍵⋄v>2:'Tensor ',⍕v⋄v=2:'Matrix'⋄(v=1)∧''≡0↑⍵:'String'⋄''≡0↑⍵:'Char'⋄(v=1)∧⍬≡0↑⍵:'List Numeric'⋄⍵≢+⍵:'Complex or Quaternion or Oction'⋄⍵=⌈⍵:'Int'⋄'Float'}  
  h←{'Int'≢type ⍵:¯1⋄v ⍵} 
  h 1  
10
  h 1.37  
¯1
  h 7878  
8057
  h¨3 5 12    
13 15 23 
  h 6 7 8
¯1
  h '123'
¯1
  h '1'
¯1
  h 1.0
10
  h 1.0002
¯1
  
deleted 1 character in body
Source Link
user58988
user58988
Loading
Source Link
user58988
user58988
Loading