Category talk:Wren-complex: Difference between revisions

m
→‎Source code: Now uses Wren S/H lexer.
(→‎Source code: Removed type aliases and changed Complex.tau to be consistent with Num.tau.)
m (→‎Source code: Now uses Wren S/H lexer.)
 
(3 intermediate revisions by the same user not shown)
Line 9:
===Source code===
 
<langsyntaxhighlight ecmascriptlang="wren">/* Module "complex.wren" */
 
import "./trait" for Cloneable
Line 35:
static one { Complex.new_( 1, 0) }
static two { Complex.new_( 2, 0) }
static three { Complex.new_( 3, 0) }
static four { Complex.new_( 4, 0) }
static five { Complex.new_( 5, 0) }
static six { Complex.new_( 6, 0) }
static seven { Complex.new_( 7, 0) }
static eight { Complex.new_( 8, 0) }
static nine { Complex.new_( 9, 0) }
static ten { Complex.new_(10, 0) }
static imagMinusOne { Complex.new_( 0, -1) }
static imagOne { Complex.new_( 0, 1) }
static imagTwo { Complex.new_( 0, 2) }
static imagThree { Complex.new_( 0, 3) }
static imagFour { Complex.new_( 0, 4) }
static imagFive { Complex.new_( 0, 5) }
static imagSix { Complex.new_( 0, 6) }
static imagSeven { Complex.new_( 0, 7) }
static imagEight { Complex.new_( 0, 8) }
static imagNine { Complex.new_( 0, 9) }
static imagTen { Complex.new_( 0, 10) }
static i { Complex.new_( 0, 1) } // same as imagOne
Line 950 ⟶ 964:
static sum(a) { a.reduce { |acc, x| acc + x } }
static prod(a) { a[1..-1].reduce(a[0]) { |acc, x| acc * x } }
}</langsyntaxhighlight>
9,482

edits