Personally, I dislike "uses" specifications.
Here's how I would address your argument/result specification:
psolve=: 1 {:: p.@|.
quad=: 'Not quadratic'"_`psolve@.(0 ~: {.)
Probably not what you intended though...
Thanks,
--
Raul
On Fri, Nov 6, 2015 at 6:18 PM, Kip Murray <[email protected]> wrote:
> Most of us have heard of the quadratic formula
>
> x = ( -b +or- %: (b^2 - 4ac) )/2a (roughly standard math notation)
>
> for solving ax^2 + bx + c = 0 for x .
>
> Your mission, should you decide to accept it, is to write a verb quad
> that takes
> vector a,b,c as argument, says “Not quadratic” if a is 0 , and otherwise
> uses the quadratic formula to find the values of x, reporting them in a
> vector.
>
> quad 2 _8 6
> 3 1
>
> quad 0 _8 6
> Not quadratic
>
> --Kip Murray
>
>
>
> --
> Sent from Gmail Mobile
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm