Giter VIP home page Giter VIP logo

Comments (4)

daveyarwood avatar daveyarwood commented on September 27, 2024

The context here is that Alda 1 was implemented in Clojure, and any Lisp expressions were literally evaluated as Clojure code. Clojure (as well as other Lisps) includes keywords like :a and :sharp, and it's more idiomatic to use keywords than symbols (e.g. 'a and 'sharp) so that's why it was the way it was in Alda 1.

Alda 2 was a rewrite in Go, so we lost the Clojure part and I had to implement a new Lisp. I chose to make it as deliberately simple as possible, using only the most basic Lisp primitives, like strings, and symbols. It's not uncommon to see something like '(a sharp) in Lisp languages, so although it looks weird and has more parentheses, I see it as the Lisp Way.

Clojure is not the only Lisp that has keywords. Common Lisp and Emacs Lisp also have them. In light of that, I'm not opposed to adding support for keywords to alda-lisp, and I don't think it would be difficult to do so.

However: supporting both ways -- (pitch :a :sharp) and (pitch '(a sharp)) would add complexity to the language, so I wouldn't want to do it just for the sake of doing it. I'm imagining having to document both ways of doing things, both for pitch and for key-signature, and Alda users needing to understand two different syntaxes for the same feature.

To make matters worse: even if we added keywords, we still couldn't support the Alda 1 way of expressing key signatures because we don't have maps, e.g. {:f [:sharp] :c [:sharp] :g [:sharp]}. I think it would be doubly confusing if we supported doing it the Alda 1 way for pitch, but NOT for key-signature. My perspective on this is that it's better to draw a line in the sand and say that the Lisp in Alda 2 is not Clojure, it's a new, way simpler Lisp.

Happy to hear other thoughts on this, of course. Is there a strong use case to be able to write a score that works in both Alda 1 and 2? (I hope the answer is no! My dream is to never need to support Alda 1 again 😄 )

from alda.

UlyssesZh avatar UlyssesZh commented on September 27, 2024

What about implementing (pitch 'a 'sharp) as well as (pitch '(a sharp))? Pros: avoids extra parentheses, avoids uncommon Lisp expression like '(a sharp), and avoids having to implement keywords.

key-signature seems to be more complicated because it must accept a list/map whose length is not determined. I think we need to discuss more on that.

I am not familiar with Lisp and its variants. What does it actually mean by writing a "quoted list"? Is it different from a vector (maybe nested) of symbols?

There are some advantages of implementing vectors and maps.
Using square brackets to denote vectors has an advantage of consistency when we have nested vectors (because we have '(f (sharp)) instead of '(f '(sharp)), which looks inconsistent).
Also, not using maps to define a key signature can lead some input to become valid but strange (or ambiguous), like (key-sig '(f (sharp) f (flat))).

Is there a strong use case to be able to write a score that works in both Alda 1 and 2?

I am thinking of multiple people using different versions of Alda that may exchange the scores they wrote. It would be annoying (and maybe affecting the originality of music art if we consider the Alda codes to be the artwork itself) if I have to modify the work that others made to make it playable on my own machine. This is still definitely not a strong use case, though.

from alda.

UlyssesZh avatar UlyssesZh commented on September 27, 2024

By the way, I realize that this is not a bug because it is intended. Could you please move this issue to "discussions" if that is necessary? Sorry for that.

from alda.

daveyarwood avatar daveyarwood commented on September 27, 2024

No problem! I was just thinking the same thing. Will move this to discussions.

from alda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.