module Calculator.Help (help) where -------------------------------------------------------------------------------- import Calculator.Color (bold) import Calculator.Prim.Definitions (binaryOps, defFuns, defVars, unaryOps) -------------------------------------------------------------------------------- import Data.List (intercalate, intersperse) -------------------------------------------------------------------------------- help :: [String] help = [ bold "Commands:" , " :var x=pi -- Binds x to pi" , " :func f(x)=x+1 -- Binds f(x) to \"x + 1\"" , " :func f(x,y)=x+y -- Binds f(x, y) to \"x + y\"" , " :reset -- Reset variable and function bindings" , " :plot -- For plotting (detailed below)" , " :show -- Display all variable bindings" , " :? or :help -- Display this help message" , bold "Unary Operators: " ++ intersperse ' ' (map fst unaryOps) , bold "Binary Operators: " ++ intersperse ' ' (map fst binaryOps) , bold "Pre-defined variables: " ++ intercalate ", " (map fst defVars) , bold "Provided Functions: " , " " ++ intercalate ", " (map fst defFuns) , bold "Spaces are ignored in most places" , " :func f ( x ) = x + x + x -- works" , " but not everywhere, e.g in commands" , " : func ... -- doesn't work" , bold "Plotting: " , " :plot f (0, 1)" , " -- Plot a single argument function 'f' in range (0, 1)" , " :plot f (0, 1) (1, 2)" , " -- Plot a two argument function 'f' in range (0, 1)" , " -- where the second argument can be varied between 1 and 2" ] --------------------------------------------------------------------------------