Scheme procedure - list->hook lst Convert the procedure list of LST to a hook.
It will compliment the hook->list procedure already there. :) I found the hook->list procedure in C but I cannot find a good place to add list->hook. Thoughts? Cheers, amar<n...@disroot.org> -------------------------------------------------------------------------------- ;;; Full procedure (define (list->hook lst) "Convert the procedure list of LST to a hook." (define (adder h lst arity) (if (null? lst) h (let ((proc (car lst))) (if (procedure? proc) (if (equal? arity (car (procedure-minimum-arity proc))) (begin (add-hook! h proc #t) (adder h (cdr lst) arity)) (error (format #f "In procedure list->hook: Wrong number of arguments to ~s, expected arity ~s" proc arity))) (error (format #f "In procedure list->hook: Wrong type argument ~s, expecting a procedure." proc)))))) (if (null? lst) (make-hook) (let ((proc (car lst))) (if (procedure? proc) (let* ((arity (car (procedure-minimum-arity proc))) (hook (make-hook arity))) (adder hook lst arity)) (error (format #f "In procedure list->hook: Wrong type argument: ~s in list, expected a procedure." proc))))))