Beta

Arithmetic function plotter

10 of 11ivosdc
Description
Loading description...
Arrays
Strings
ASCII Art
Fundamentals
  • Please sign in or sign up to leave a comment.
  • yannickngassa Avatar

    This comment has been hidden.

  • JohanWiltink Avatar

    Function arguments are named and represented inconsistently in the description and the initial solution ( and possibly other places ).

    I'd suggest calling them by the same name everywhere, and representing specifically the f argument ( the first one ) as a string, which ATM it is, and not as a function ( which ATM it is not ) in the description examples. I haven't checked the test headers, but the same goes for them. Should you decide to make the first argument a function, then of course represent it as a function everywhere.

  • JohanWiltink Avatar

    I like this kata!

    I suspect you could have gotten a different idea from all my issues, suggestions and comments, but I quite like the premise; it's just a number of design and implementation details I feel are worth improving ( which is .. kind of a pat on the back with a wrecking ball :yum: ).

  • JohanWiltink Avatar

    This comment has been hidden.

  • JohanWiltink Avatar

    This comment has been hidden.

  • JohanWiltink Avatar

    It appears the x parameter is the middle of the output grid. That middle is of course defined by two coordinates, and it would seem its y coordinate is also defined by x.

    Is this correct; is this the best way to define the middle of the grid ( I think not ); and if correct, shouldn't this be described more fully?

  • JohanWiltink Avatar

    Use appropriate datatypes. The function argument could be a function, unstringified.

    This would also facilitate translations into languages that do not have eval, like Haskell; I would like to translate this into Haskell, but I'd have to write a parser from string to function and put it in Preloaded ( that's what it is for ), because writing a parser is a bit outside the scope of this kata.

  • Voile Avatar

    This comment has been hidden.

  • smile67 Avatar
    f(x) = x * x * x; (x: 1)  (scala: 0.2)  (range: 0 / 2)
    Your solution:
    
    [ '|..........',
      '|..........',
      '|..........',
      '|..........',
      '|..........',
      '|....+.....',
      '|..........',
      '|..........',
      '|..........',
      '|..+.......',
      '++---------' ]
      
    My solution:
    [ '|..........',
      '|.....+....',
      '|..........',
      '|..........',
      '|..........',
      '|....+.....',
      '|..........',
      '|...+......',
      '|..........',
      '|..+.......',
      '+++--------' ]
      
      
      f(x) = x * x * x; (x: 1)  (scala: 0.2)  (range: -1 / 3)
      Your solution:
    [ '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|....+..........',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|..+............',
      '----+++--------------',
      '..+..|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '+....|...............' ]
      
      My solution:
    [ '.....|...............',
      '.....|......+........',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|.....+.........',
      '.....|...............',
      '.....|...............',
      '.....|...............',
      '.....|....+..........',
      '.....|...............',
      '.....|...+...........',
      '.....|...............',
      '.....|..+............',
      '---+++++-------------',
      '..+..|...............',
      '.....|...............',
      '.+...|...............',
      '.....|...............',
      '+....|...............' ]
      
      So what about these gaps in your plot, for every x in range not every possible f(x) is calculated?
    
  • smile67 Avatar

    .

  • ZED.CWT Avatar

    There are no need to wrap plot in a function class explicitly, especially for such trivial purpose Also it should be a prototype function since it's not referencing anything in Calculator scope Moreover, it's 9102 already, please use class syntax

  • ZED.CWT Avatar

    Please use Test.assertDeepEquals(actual, expected[, message]) to test objects results

  • ZED.CWT Avatar

    Needs Random Tests.