aboutsummaryrefslogtreecommitdiffstats
path: root/notes/original_plan.txt
blob: 38224aea745e7eb9aa31573acaa152cafe43bc99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

lexing/parsing options:
- reuse old spectrum code as-as
- modify spectrum code as iterator
- nom (from s-expr example)

sexpr_expr
    Integer(i64)
    Float(f64)
    String(String)
    Boolean(bool)
    Symbol(String)
    List: vec of expr

later add:
    Vector
    Quote


--- basic CAS

canonical_expr
    
    Number
      Integer
      Rational
        denominator always positive
        both are non-zero integers
      Float
      Constant (pi, etc)
    Sum
      at least two members
      no members are Sum
      at most one member is a number
    Product
      at least two members
      no members are Product
      at most one member is a number
    Power
    Factorial
      unary
      simplify if operand is a positive integer
    UnaryFunction
      eg, sin, cos

simple test cases:

  (+ 1 2 3) => 6
  (/ c (^ d 2)) => (* c (^ d -2))
  (- a (* 2 b)) => (+ a (* -2 b))
  (- a b) => (+ a (* -1 b))
  (* a (* b c)) => (* a b c)

- parse sexpr into canonical expression
- rational number

more expr:
    Complex (split up Number)
    Limit
    Series
    Equation(left, right)
    Vector
    Operator (?)
    Derivative (?)
    Integral (?)