Skip to main content
none-excepting code
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 293

APL (Dyalog), 68 76 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(⍺w⍵≡0'*'0)∨(t∧⍵≡0)∨⍺w≡0'÷':⍬ n∊⍨r←⍵(⍎w)⍺:r ⍬}⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL's results for ÷0 and 0*0 and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 41 bytes otherwise. 41 bytes otherwise:

w←⎕ (w,n),n⍪∘.{0::⍬ ÷n∊⍨r←⍵(⍎w)⍺:r}⍨n←⍳10 

Try it online!

APL (Dyalog), 68 76 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(⍺w⍵≡0'*'0)∨(t∧⍵≡0)∨⍺w≡0'÷':⍬ n∊⍨r←⍵(⍎w)⍺:r ⍬}⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL's results for ÷0 and 0*0 and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 41 bytes otherwise. Try it online!

APL (Dyalog), 68 76 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(⍺w⍵≡0'*'0)∨(t∧⍵≡0)∨⍺w≡0'÷':⍬ n∊⍨r←⍵(⍎w)⍺:r ⍬}⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL's results for ÷0 and 0*0 and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 41 bytes otherwise:

w←⎕ (w,n),n⍪∘.{0::⍬ ÷n∊⍨r←⍵(⍎w)⍺:r}⍨n←⍳10 

Try it online!

spacing and special case
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 293

APL (Dyalog), 6868 76 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(⍺w⍵≡0'*'0)∨(t∧⍵≡0)∨⍺w≡0'÷':' ' n∊⍨r←⍵(⍎w)⍺:r ' '}⍨n←⍳10 

Try it online!Try it online!

Much of the code is to circumvent that APL allows some divisions by zeroAPL's results for ÷0 and 0*0 and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 4341 bytes otherwise. Try it online!Try it online!

APL (Dyalog), 68 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(t∧⍵≡0)∨⍺w≡0'÷':' ' n∊⍨r←⍵(⍎w)⍺:r ' '}⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL allows some divisions by zero and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 43 bytes otherwise. Try it online!

APL (Dyalog), 68 76 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(⍺w⍵≡0'*'0)∨(t∧⍵≡0)∨⍺w≡0'÷': n∊⍨r←⍵(⍎w)⍺:r }⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL's results for ÷0 and 0*0 and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 41 bytes otherwise. Try it online!

without special casing.
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 293

APL (Dyalog), 68 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand. Much of the code is to circumvent that APL allows some divisions by zero and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(t∧⍵≡0)∨⍺w≡0'÷':' ' n∊⍨r←⍵(⍎w)⍺:r ' '}⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL allows some divisions by zero and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 43 bytes otherwise. Try it online!

APL (Dyalog), 68 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand. Much of the code is to circumvent that APL allows some divisions by zero and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(t∧⍵≡0)∨⍺w≡0'÷':' ' n∊⍨r←⍵(⍎w)⍺:r ' '}⍨n←⍳10 

Try it online!

APL (Dyalog), 68 bytes

Requires ⎕IO←0 which is default on many systems. Prompts for input and expects a single character representing the operand.

t←'|'=w←⎕ (w,n),n⍪⍉⍣t∘.{(t∧⍵≡0)∨⍺w≡0'÷':' ' n∊⍨r←⍵(⍎w)⍺:r ' '}⍨n←⍳10 

Try it online!

Much of the code is to circumvent that APL allows some divisions by zero and to counteract that APL's modulo (|) has its arguments reversed compared to most other languages. Would have been only 43 bytes otherwise. Try it online!

Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 293
Loading