Commit Graph

308 Commits

Author SHA1 Message Date
Mateusz Piątkowski
9b846d8115 Function reference 2022-09-11 20:05:29 +02:00
Mateusz Piątkowski
b4984d5c61 minor fixes 2022-09-11 18:02:27 +02:00
Mateusz Piątkowski
9956cf8993 more functions 2022-09-11 17:27:16 +02:00
Mateusz Piątkowski
b1bed2c7da instrument function description 2022-09-11 17:04:42 +02:00
Mateusz Piątkowski
4209a495ea Documentation on builtin functions 2022-09-11 16:59:51 +02:00
Robert Bendun
9213d5219a All stuff from this file is builtin 2022-09-11 16:30:27 +02:00
Robert Bendun
0743a9b7c4 Added pause
It's faking to be a note, but does not play anything when played
2022-09-11 16:19:10 +02:00
Robert Bendun
91f401a13a builtin mix; fixed vectorized equality 2022-09-05 23:52:26 +02:00
Robert Bendun
d77f844c81 Hashing functions; builtins hash, uniq and unique 2022-09-05 23:17:40 +02:00
Robert Bendun
ab0ba8d4c8 Algorithms like min don't flatten all the way
To restore previous behaviour one can use `min (flat x)`
2022-09-05 22:30:11 +02:00
Robert Bendun
eb822a4a6e '&' operator can merge arrays; 'down' builtin works 2022-09-05 20:47:15 +02:00
Robert Bendun
de92564cc1 Error reporting improvement for number operations; added power operator 2022-09-04 19:44:33 +02:00
Robert Bendun
497a4bcc6a Improvement of builtin functions; added try builtin
Including moving functions from lambdas into global scope, adding
documentation, improvement of error reporting
2022-09-04 17:46:04 +02:00
Robert Bendun
421f8111f0 builtin_for now reports nice error message when given wrong arguments 2022-09-04 14:11:06 +02:00
Robert Bendun
aabcc42625 Error reporting when too many closing parens at the end 2022-09-04 13:48:06 +02:00
Robert Bendun
f2a78cd331 Index operator now reports when given unindexable lhs 2022-09-04 13:25:55 +02:00
Robert Bendun
1597b678e1 Report error when index is too large 2022-09-04 13:16:40 +02:00
Robert Bendun
3b1500313c Operators associate to the left now
This should be default behaviour but somehow we missed it.
2022-09-04 12:04:19 +02:00
Robert Bendun
00b11087b4 When playing empty chord user gets pause with default length 2022-08-29 21:48:35 +02:00
Robert Bendun
c0af952fc6 Improved rhythm of primes example 2022-08-29 21:45:17 +02:00
Robert Bendun
7b5e43293a For as builtin and new example that plays primes 2022-08-29 21:38:15 +02:00
Robert Bendun
1fa2ec6b76 Vectorized equality and index operations 2022-08-29 21:22:46 +02:00
Robert Bendun
2b29522293 New operator: modulo operator '%' 2022-08-29 20:37:11 +02:00
Robert Bendun
b8feb4043e New builtin: n primes generator 2022-08-29 20:29:45 +02:00
Robert Bendun
5c53bb9e9f Nicer undefiend operator message 2022-08-21 20:39:35 +02:00
Robert Bendun
43555cbc1c Improved interactive mode interaction with errors 2022-08-21 20:24:49 +02:00
Robert Bendun
cb5eedb2a5 Unexpected empty source error improved 2022-08-21 20:01:59 +02:00
Robert Bendun
183907a0ed Improved error location reporting 2022-08-21 19:24:33 +02:00
Robert Bendun
99482d4c7c Improved examples; multiplication = repeat operator 2022-08-21 17:34:03 +02:00
Robert Bendun
b9eb3f957d play as evaluation operator 2022-08-21 16:49:54 +02:00
Robert Bendun
5c47b7b808 par improvement: allow actions like octave changes inside
This is implemented with default action idea. During evaluation of
expresions sequence all but return expressions is passed to
default_action. Par sets default action to `action_play` which plays
given value if it's musical value.
2022-08-21 15:52:54 +02:00
Robert Bendun
2452b95a90 Par now accepts arrays 2022-08-21 14:49:39 +02:00
Robert Bendun
e3164395de Range function for Musique language 2022-08-21 13:45:34 +02:00
Robert Bendun
da1ac0dcf7 {floor, ceil, round} available in Musique language 2022-08-21 13:19:16 +02:00
Robert Bendun
617fbac98f Unified rounding implementation 2022-08-21 12:26:45 +02:00
Robert Bendun
eb36ad2c93 Implemented Number::{ceil, floor, round, pow, inverse}
Except that pow only accepts integer exponents, since nth root is not
that quick to implement and simple blind implementation may have
performance issues.
2022-08-21 00:43:04 +02:00
Robert Bendun
ab6ed8f45c Report nice error when without MIDI connection 2022-08-19 16:06:33 +02:00
Robert Bendun
b06ad84514 File hierarchy cleanup by removing etc folder
And moving it's content into scripts and editor directories.
2022-08-18 23:03:21 +02:00
Robert Bendun
e16a28dfdc Separated makefile into smaller scripts to improve readability 2022-08-18 22:58:41 +02:00
Robert Bendun
7fb6df219c Successfully separated small portion of include/musique.hh 2022-08-18 22:48:11 +02:00
Robert Bendun
0b3dc2bb57 Move src/musique.hh to include/musique.hh
This is preparation for separation of public musique interface and
implementation details shared across files.
2022-08-18 22:44:04 +02:00
Robert Bendun
81f512d69d Builtin function handlers definition now in separate file
Same as in commit before, we try to cleanup src/interpreter.cc from all
of builtin function noise.
2022-08-18 22:37:40 +02:00
Robert Bendun
831de5abe5 Builtin operator handlers definiton now in separate file
Interpreter constructor and file in general is very unreadable
and busy now. To limit noise separate builtin operators from
src/interpreter.cc into their own file src/builtin_operators.cc

This also allows to see which functions are used as implementation
detail of which operations.
2022-08-18 22:21:04 +02:00
Robert Bendun
a3d0a942e4 Ensure when adding new operators we add them right
Operators not only are needed to be defined by their implementation in
Interpreter constructor, but also are needed to be included in
precedense resolution.

To prevent partial definition we predefine number of builtin operators
as numeric constant and test against it in all relevant places.
2022-08-18 22:07:13 +02:00
Robert Bendun
e090778db9 Added '&' operator that joins chords together.
For example 'c & g' makes chord 'chord c g'
2022-08-18 22:07:13 +02:00
Robert Bendun
881dc8975a Missing variable error implementation 2022-08-18 22:07:13 +02:00
Robert Bendun
75c9eefd50 Ignoring new LSP 2022-08-18 22:07:13 +02:00
Robert Bendun
d8f8214556 Tests now compile again 2022-07-30 13:45:23 +02:00
Robert Bendun
0e796d5efc Minor cleanup 2022-07-30 13:40:59 +02:00
2ea507dde2 Par accepts arrays of notes 2022-06-23 07:49:38 +02:00