(Teletype) Pre-2.1 Operators and Features


#122

lol my bad too for trusting so blind without checking first :grin:

edit: can we have a NOT then? :stuck_out_tongue_closed_eyes:


#123

“!” is a standard short form for “not” operators (NE) in just about every programming language, I’ve actually found myself trying to use it in TT scripts a number of times. In that regard I don’t consider it arbitrary, although the learning required to read it could be higher than the letter based abbreviation NE if you’ve not programmed before.

I’m in favour of MZ though… Mod 0 is such a common task for building progressive scripts.


#124

We could always add it as another alias to EZ

I think I’d want to write out a truth table to make sure they are actually the same…


#125

I was rather joking :slight_smile:

Not that the ! symbol wouldn’t be cool as common in other languages.


#126

I’d like to add a vote in favour of the shortened aliases for math operators. I’m not a programmer, but I feel like writing logic and math operators in their short form is a lot more convenient, and sometimes might make a difference between being able to fit stuff in one line or not.
It’s really not that complicated, Most aliases are pretty self explanatory (like == being equal, and > being greater than), there’s just a few that might need getting used to them like ! (logical not) or != (EZ), || (OR) and && (AND), so really not that much of a hassle imho. Some are actually even easier to remember (at least for me), eg. >> is much easier to me than RSH, especially the arithmetic ones do make more sense to me in their short form, do I have to write MULT or MUL? I can never remember that, * is so much easier.


#127

EZ is “equals zero”, the current NOT op is NE “not equals” I believe.


#128

EZ and NOT would be actually the same thing, took me sam to realise too.

EZ 0 //true
NOT 0 //true
EZ [X>0] //false
NOT [X>0] //false

that is, if x > 0 equals to true

(good to know he needs that truth table proof too :slight_smile: )


#129

I guess that’s true in this case… I’m so used to thinking about “not” pertaining to more than numbers, but since TT only really deals with numbers this makes sense. As long as the only logic we can do produces binary results then I can see how NOT and EZ could be the same.

This seems different than the current NE op I think… which is more like != in other languages. I guess now that I think about it more, what I’m looking for with a not or ! operator is more like != generally…

What about the “logical not” as mentioned by @papernoise? I’m still trying to think of a use case, but it feels like there probably is one that’s just not coming to me.


#130

Yes, I am sure those symbols are common and wide spread. Also there might be good reason that some of them have to be used doubled (==) and some don’t (>) but can (<<) while other are not be found on my keyboard (||)…

It’s just a feedback: I find it confusing and get along better with letter abbreviations. I am afraid that won’t change by explaining to me that it’s logical and easy to use. As described above for me this is related to the common use of those symbols while the longer form is not already connected to a special syntax. The good thing is they are there and everyone can use them anyway. I don’t expect anyone to take my stupidness into account. Just wanted to participate in the discussion to give a head up to the possibility that there are people using teletype who are not familiar with just about every programming language. Not so much on this forum perhaps.

I think the basic operators tend to be three or two letters but I experience the same thing quite regularly with the different versions of RESET vs. RES and PRESET vs. PRE. I would not want a symbol for this though…


#131

Sincere apologies if this came across in any accusatory or condescending way, that wasn’t my intention. I wasn’t trying to suggest that you should know this or that it’s easy to learn, just that it’s a standard and it would be worth including here along with the letter abbreviations.

This is not about being “stupid” in any way, and learning to code is not easy or fast. And these things aren’t necessarily logical, which isn’t what I was trying to suggest. It isn’t arbitrary though, even though the logic isn’t clear.

IMO, if we can also bake some coding standards into TT syntax then learning TT will also be learning generic coding knowledge that can be applied to other things (i.e. Supercollider, Max/MSP, Processing, etc…)

This is two “pipes”, on a Mac keyboard it’s shift+\ (x 2).


#132

It was just an example to say that it can be confusing as well. Though everything becomes easy once you get the basic logic of it. And btw. || is just two times |, which on my keyboard is right above , though that is probably different on other keyboards.

I should mention that what made me learn all these abbreviations was getting into bytebeat (through Bitwiz first, and the Equation Composer later). In bytebeat all these operators in their C form are the heart of what you do. Especially bitwise shifting.
Now, why some are just one character and some are double… no idea. Basic math operators are usually just the standard ones we know from school, so +, -, >, <, etc. are just how they’ve been before computers where even invented I guess. >> and << are double to represents the shifting of the bits. Others might be double to differentiate them from their bitwise counterpart. Example: In C and C++ you can do a normal AND (&&) or a bitwise AND (&), hence the need to have two versions of AND. As far as I understand it, the normal AND works between two numbers, while the bitwise one does the logic AND on each bit (though somebody can certainly explain that better than I can).


#133

i’d prefer we all agree to stick with C’s bitwise vs. logical conventions.

so, re: NZ (yes, which is the same as NOT, which could also be !) is not the same as a bitwise not, which in C is ~

at this point there are no bitwise operators in teletype, unless you count LSH and RSH (which could be aliased to << and >>). i love bitwise ops truly, but the nomenclature will be tricky if there is demand for these.

we have logical AND and OR presently, both which are incredibly useful


new topic: renaming AT (previously mentioned AUTOTRIG functionality, where each script/input can basically become a metronome.) this feature is similar to an echo or repeat.

(paste from github discussion):

This idea seems great, however I’d like to critique the name, and chosen abbreviation AT. To me this reads as at, as in @ or ‘located at’. I considered ATR though ‘TR’ in teletype means the TR outputs, not the ‘SCRIPT’ input jacks. Also something more plain-english like forth’s AGAIN, though this more specifically refers to recursion and wouldn’t make sense when working across different scripts.

E for echo and R for repeat are unused. a single letter might be good given it’ll be a somewhat primary function, similar to M for metronome.

any thoughts?


#134

+1 for E (echo)

Twenty characters


#135

One more naming thing re: ‘MSPB’.
Why can’t we just use BPM? It would be analogous to N for note or V for volt – these ops allow you to write note numbers or voltage amounts and teletype converts them to it’s machine-language form of those human-expressions.
Teletype uses milliseconds for time, but we humans often think of time in terms of BPM, thus it could be used directly as a translation layer from musician speak to computer speak.

eg:
M BPM 160 // set the metro to 160 beats per minute
TR.TIME DIV BPM 160 4 // set trigger pulse width to a 16th note at 160 BPM


#136

I like, with 20 characters.


#137

Having reread the TL thread I very much agree.

I thought briefly that maybe the STACK ops could be abused / enhanced a bit to get the TL functionality on the cheap (e.g. extend the stack size and allow STACK.EXEC n) but you’d still burn lots of script space setting up the stack… so TL wins :slight_smile:


#138

To me R seems to be the more simple and intuitive solution of both.


#139

Not sure what you want to say here? Right above the comma I have the Letter L on my tt keyboard - If I use two of them as an alias for OR I get an error message, same with two letters I. Also I see that this is not what you typed above. Honestly I am not that stupid!

Thanks - Can’t find that inverted slant on a Mac keyboard though and the shift+ fingering does not work on the TT keyboard. It gives a questionmark, which fits good again… :cry:

I think I prefer aliiases/abbreviations made of letters that I can see on my keyboard - it’s just more accessible.


#140

Do you have a German keyboard? The layout might be very different than what I’m looking at :slight_smile: the keyboard that comes with TT should have all these characters visible somewhere, but I can remember the layout at the moment.

I’m not arguing against the letter abbreviations, they’re totally fine and work.

If you plan to do any other type of coding though these characters will be required, even for Max/MSP.

(Also, shift+\ means press shift and the \ (the backslash) at the same time, not the + key :slight_smile: )


#141

+1 for R (Repeat)

(echo to me sounds more like in the audio domain)