Simon Albrecht <[email protected]> writes:
> The subject certainly seems cryptic – it’s difficult to summarize, but
> an example will make it clear immediately.
> I want to write a scheme procedure, which takes a pair like #'(3 . 7)
> and returns a list with all the numbers in the range: #'(3 4 5 6 7)
> How is this done most easily?

You mean something like this?

#+BEGIN_SRC scheme :results output
(define pair (cons 3 7))
(define (range first last)
  (if (>= first (+ last 1))
    '()
    (cons first (range (+ first 1) last))))
(display (range (car pair) (cdr pair)))
#+END_SRC

#+RESULTS:
: (3 4 5 6 7)

HTH
Patrick




_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to