>>8
I didn't save it, it is just bruteforce, though. The main loop was something like this: (let ((1op '(+ -)) (2op ('+ - mod div *)) (op1 (lambda (x) `(,x 9))) (op2 (lambda (f g) (lambda (x y) `(,f (,g ,x ,y))))))
(append*
(for*/list ((o1 1op) (o2 1op) (o3 1op)
(o4 1op) (o5 1op) (o6 1op) (o7 1op)
(f 2op) (g 2op) (h 2op))
(let ((x (op1 o1)) (y (op1 o2)) (z (op1 o3)) (w (op1 o4))
(f (op2 o5 f)) (g (op2 o6 g)) (h (op2 o7 h)))
(list (f (g (h x y) z) w)
(f (g x (h y z)) w)
(f x (g (h y z) w))
(f x (g y (h z w)))))))
Then the generated code was evaled, with mod and div returning 0 on bad inputs, filter non-exact-positive-integers, remove expressions with the same result, sort, pretty print.
>>8
I didn't save it, it is just bruteforce, though. The main loop was something like this: (let ((1op '(+ -)) (2op ('+ - mod div *)) (op1 (lambda (x) `(,x 9))) (op2 (lambda (f g) (lambda (x y) `(,f (,g ,x ,y))))))
(append*
(for*/list ((o1 1op) (o2 1op) (o3 1op)
(o4 1op) (o5 1op) (o6 1op) (o7 1op)
(f 2op) (g 2op) (h 2op))
(let ((x (op1 o1)) (y (op1 o2)) (z (op1 o3)) (w (op1 o4))
(f (op2 o5 f)) (g (op2 o6 g)) (h (op2 o7 h)))
(list (f (g (h x y) z) w)
(f (g x (h y z)) w)
(f x (g (h y z) w))
(f x (g y (h z w)))))))
Then the generated code was evaled, with mod and div returning 0 on bad inputs, filter non-exact-positive-integers, remove expressions with the same result, sort, pretty print.
>>15 You didn't find these because you're not checking (f (g x y) (h z w)).
Oh, right. Good catch.
Name:
Anonymous2013-09-01 20:22
C can be a bit understanding with pointers and assign things appropriately, but when you added another level (arrays) I think the assignment was forced into something that didn't work. That's my take on it. I think I will put up a bounty so you can get a better answer.
Name:
Anonymous2013-09-01 21:08
It’s from the Germanic root gel which has produced both English yellow and German gelb (OED).