The direct translation of the C expression to Lisp would actually be (-> a (-> b (-> c d))), which is fine to read from left to right as well. As lispm said, this can be reduced to (-> a b c d) due to the flexibility of prefix operations.
The direct translation of the Lisp expression you shared to C would be: d(c(b(a))), which just like the Lisp expression, evaluates from the middle out. Both are fine to read from left to right though.
> The direct translation of the C expression to Lisp would actually be (-> a (-> b (-> c d)))
Not really. -> looks like binary infix operator, but it is really an unary postfix operator (parametrized by field). Because field itself is not a first-class entity in C.
Either -> is a binary operator or is is not an operator in the expression at all, and the unary postfix operators are ->b, ->c, and ->d. In the latter case, that gives us (->d (->c (->b a))) in Lisp, which I can see how ypu could get, but I don't agree.
#include <stdio.h>
#include <stdlib.h>
struct foo {
int a;
};
int main() {
struct foo *f = malloc(sizeof(struct foo));
f->a = 5;
printf("%d\n", f->b);
free(f);
return 0;
}
test.c:11:21: error: no member named 'b' in 'struct foo'
11 | printf("%d\n", f->b);
| ~ ^
1 error generated.
What do you mean when you say fields are not first class in C?
I think that most problematic for prefix notation are not arithmetic operations, but field accessors.
In C you have a->b->c->d, in Lisp it would be (d (c (b a))), which makes you to jump to the center and read it from the inside-out.