scheme-score

Check-in [6106f8b49c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement sequences as (i)lists. This may not be a good choice.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:6106f8b49c2618f4ac9f4af8016919821ee04ce8fc168eda49b191419e7d0d3c
User & Date: wcm 2019-04-27 20:10:09
Context
2019-04-28
02:28
Tweak music-modify to take an (i)alist, rather than a single key-value binding. check-in: 6e9fcf38cb user: wcm tags: trunk
2019-04-27
20:10
Implement sequences as (i)lists. This may not be a good choice. check-in: 6106f8b49c user: wcm tags: trunk
02:22
No need for the numbers egg anymore check-in: 20ddc68da5 user: wcm tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to score.scm.



1
2
3
4
5
6
7
..
10
11
12
13
14
15
16
17
18
19
20


21
22


23
24


25
26
27
28
29
30
31


;;; Primitives

(define-record-type note
  (make-note duration pitch)
  note?
  (duration prim-duration)
  (pitch prim-pitch))
................................................................................
  (make-rest duration)
  rest?
  (duration rest-duration))

(define (prim? x)
  (or (note? x) (rest? x)))

;; Horizontally-appended musics, created by music-append.
(define-record-type sequence
  (make-sequence head tail)
  sequence?


  (head sequence-head)
  (tail sequence-tail))



;; Vertically-'zipped' musics, created by music-simul.


(define-record-type simultaneity
  (make-simultaneity part1 part2)
  simultaneity?
  (part1 simultaneity-part1)
  (part2 simultaneity-part2))

;;; Modifiers
>
>







 







|
<
<
|
>
>
|
|
>
>

|
>
>







1
2
3
4
5
6
7
8
9
..
12
13
14
15
16
17
18
19


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(import (srfi 116))

;;; Primitives

(define-record-type note
  (make-note duration pitch)
  note?
  (duration prim-duration)
  (pitch prim-pitch))
................................................................................
  (make-rest duration)
  rest?
  (duration rest-duration))

(define (prim? x)
  (or (note? x) (rest? x)))

;; Horizontally-appended musics are simply ilists of music values.


(define (sequence? x) (ipair? x))

(define (music-append m1 m2)
  (cond ((and (sequence? m1) (sequence? m2)) (iappend m1 m2))
        ((sequence? m1) (iappend m1 (ilist m2)))
        ((sequence? m2) (ipair m1 m2))
        (else (ilist m1 m2))))

;; Vertically-'zipped' musics, created by music-simul.  Unlike
;; sequenced musics, we need to be able to traverse the component
;; music values.
(define-record-type simultaneity
  (make-simultaneity part1 part2)
  simultaneity?
  (part1 simultaneity-part1)
  (part2 simultaneity-part2))

;;; Modifiers