Hello,
this is a very basic and therefore somewhat embarrising one, but … cannot figure it out.
I have a list, e.g, {2, 9, 2, 9, 1, 10, 1, 1, 3, 1, 8, 2, 8, 2} (representing a solution of a numbers puzzle but not important) and I need to make it the number 292911011318282. So I need to take an element multiply it by 10 if it is <10, otherwise 100 and add the rest of the list applying the same function. Therefore this seems to be the very basic right-reduce of functional programming and certainly there is that function somewhere in Mathematica but I do not see it and I fail misserably simulating it with a own function for quite some time now.
It should do (Scheme):
(define (right-reduce combine initial s)
(if (empty-stream? s)
initial
(combine (head s)
(right-reduce combine initial (tail s)))))
just for Lists in Mathematica (and of topic: are there (potentially) endless streams in Mathematica with lazy evaluation such as there are in Scheme or Haskell?).
I cannot solve my problem by hand as there are a few thousand solutions to be compared and I also should learn how to right-reduce in Mathematica so - please…
so embarrising.