18 lines
766 B
Plaintext
18 lines
766 B
Plaintext
#include <order/interpreter.h>
|
|
|
|
#define ORDER_PP_DEF_8hailstone ORDER_PP_FN( \
|
|
8fn(8N, \
|
|
8cond((8equal(8N, 1), 8seq(1)) \
|
|
(8is_0(8remainder(8N, 2)), \
|
|
8seq_push_front(8N, 8hailstone(8quotient(8N, 2)))) \
|
|
(8else, \
|
|
8seq_push_front(8N, 8hailstone(8inc(8times(8N, 3))))))) )
|
|
|
|
ORDER_PP(
|
|
8lets((8H, 8seq_map(8to_lit, 8hailstone(27)))
|
|
(8S, 8seq_size(8H)),
|
|
8print(8(h(27) - length:) 8to_lit(8S) 8comma 8space
|
|
8(starts with:) 8seq_take(4, 8H) 8comma 8space
|
|
8(ends with:) 8seq_drop(8minus(8S, 4), 8H))
|
|
) )
|