I am trying to use the reduce function in a more complex way then what it is usually intended for. I’m not even sure if this is possible, but here’s what I’m trying to do:
Given a list (1 2 3) and two constants, let’s have them be 9 and 13, I’m trying to use reduce to end up with:
(+ 1 (* 9 (+ 2 (* 9 (+ 3 (* 9 13))))))
I tried a method where I added 13 to the back of then list, so I had (1 2 3 13) then tried doing some mapping with Lambda and reduce, but I can’t get the correct answer.
I would post my code that I’ve tried but my internet went out and I’m typing this on my phone, so sorry I can’t show what I tried to do, but the goal is the form of the expression above using reduce