clojure: If I am creating an operator staircase, how do I define the identity for the operator in general? -
I was wondering how you made The only thing I do not know is how to define the initial How do I start the initial value in the loop above the Thanks in advance! I think if you want to start with If you want to define binary operators, I think that you just start from * out of
+ In the end, then going to the other direction, using the following function
(fb) b, and
+ is out of
+ By applying the same pattern, get a staircase of hyper-hyper-quality work of more hyperense, so I decided to try an infinite list of increasing hyperparators and try to code. Or. I came with this, which is very close! :
(operator-stair [defer operator-ladder [] (repeat (fn [f] (fn [ab] (loop [bottom b result a] (if (> = 0 Below) Results (recurring) (below the DEC) (FA results)))) (FN [AB] (APB))) (DEF OPS (operator-ladder)) ((NHPS) 3 5); ; - & gt; 6 (inc is an arity one so it should ignore one args?) ((Nth ops 1) 3 5) ;; - & gt; 8 (right knee) ((nth ops 2) 3 5) ;; - & gt; 18 (Oops, one stop! Otherwise correctly multiply.) Is basically applicable (fn [a b] (* a b)) ((nth ops 3) 3 5) ;; ---- & gt; 10 9 2 (wow)
results in a normal way! I've made it
a because it works, but for this, for example, this should be 0, while the product should be 1.
result so that it works in all cases in normal cases?
inc You can define only oriented operator. So the 0th step is "one plus"; The first step is "N times: one plus", which is basically
# (+ %%) ; The second step is "N Bar: Add N", which is
# (* %%) ; The third step is "N times: multiplied by", which is
# (pow %%) ... and so on.
+ to
inc , and the rest are in the same way Receive what you did as you did.
Comments
Post a Comment