(def lstnum '(76 85 71 83 84 89 96 84 98 97 75 85 92 64 89 87 90 65 100))
1 n = 0 1 1 1 2 1 1 3 3 1 1 4 6 4 1 n = 4
Each new level of the triangle has 1's on the ends; the interior numbers are the sums of the two numbers above them. Write a program (binomial n) to produce a list of binomial coefficients for the power n using the Pascal's triangle technique. For example, (binomial 2) = (1 2 1). You may write auxiliary functions as needed. binomial should be a set of recursive programs that manipulate lists, for example, make a new row (1 3 3 1) from an existing row (1 2 1).
Operators have precedence, which determines the
order in which operations are performed when an expression is not
parenthesized. We will assume that = has precedence 1,
+ - have precedence 5, and * / have precedence 6.
A subexpression needs to be parenthesized if its precedence is less
than or equal to the precedence of its surroundings; otherwise, it
should not be parenthesized. Make an auxiliary function that
includes precedence as an argument. The starting precedence can be 0,
so that any operator will be higher in precedence.
Example: (tojava '(= x (* (+ a b) c))) = "x=(a+b)*c;"
We will assume that a unary minus should always be parenthesized, and that it has a precedence of 6.
For functions that are not in the operator list, such as sin, make the name be Math. followed by the function name, and make a function call form. For example, (sin x) would become "Math.sin(x)" .
The function (str ...) makes a string out of its arguments.