#lang racket (define prefix-list-r (lambda (op L-accum L-todo) (if (null? L-todo) L-accum ; add the next element to the end and recurse (prefix-list-r op ; new L-accum (append L_accum (list (op (last L-accum) (first L-todo)))) (rest L-todo)) ) ) ) (define prefix-list (lambda (op L) (prefix-list-r op (list (first L)) (rest L))))