HI,

You could look at the Zippers library http://clojure.org/other_libraries
which is useful for editing nested structures in a functional way...
or perhaps you might use one of the Clojure reference types to hold
the notes?

Cheers,
James

On Dec 22, 8:09 am, PM <peter.mccull...@gmail.com> wrote:
> I'm a new Clojure user.  I've been working my way through SICP and the
> videos that accompany it, and I've also read the Clojure book.  I
> already do a lot of work with a music notation library (JMSL) in Java,
> and I'd like to see if I could do some tasks more simply in Clojure.
>
> One of the issues I run into is how to represent a musical score using
> immutable objects.  A naïve representation of a score might look
> something like:
>
> - Score contains measures
> - Measures contain staves
> - Staves contain tracks
> - Tracks contain notes
> - Notes contain articulations, dynamics, and other extras.
>
> I've mocked it up before using structmaps, but I get stuck when it
> comes to doing all this with immutable structures.  Immutability is no
> problem for a system like Lilypond where the score data is fixed when
> the program runs, but in a system where some of these items may be
> changing as the score is edited, how do you handle that?  Returning a
> new note via assoc implies that a track's contents would also change,
> making it a new track, and so on up the chain. (?)
>
> I have to be missing something, and probably something glaring.  I
> understand that I could easily do this with mutable code, but if
> anyone could provide some insight into this, it would be greatly
> appreciated.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to