Comments (4)
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.
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.
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.
No problem! I was just thinking the same thing. Will move this to discussions.
from alda.
Related Issues (20)
- player processes get stuck HOT 14
- How to make Pedal On and Off in Alda HOT 4
- Can't Create Chord with Cram Expression HOT 6
- Alda REPL: "Play right away" offset calculation doesn't work with voices HOT 1
- Alda REPL server sometimes "claims" more than 1 player on startup
- Exiting Alda REPL in "server only" mode kills all player processes
- Alda REPL "skips" rests at the end of a line
- open /tmp/alda-doctor1917232005/1666820313.mid: no such file or directory HOT 6
- Are there any PORTABLE version of alda that can run without java? HOT 1
- Time to play is too long HOT 15
- can I see debug messages while the player is running? HOT 4
- Lisp function `part` got deleted in Alda 2 HOT 1
- No way to download Alda 2 HOT 4
- `exec java` resolving to the wrong path HOT 4
- cannot run alda HOT 3
- No Sound HOT 5
- client/parser/scanner.go: invalid rune quoting HOT 9
- Can i generate an mp3 with my code? HOT 3
- [BUG] MIDI failure in JVM on fresh install cause alda and alda-player to both fail HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alda.