calvinmm / lolcode-dsl

2 stars 1 forks source link

LOLCODE Math #6

Closed calvinmm closed 10 years ago

calvinmm commented 10 years ago

We need to find documentation on doing math in LOLCODE :cat:.

As of right now, the only good documentation source did not contain it.

irvinshen commented 10 years ago
  - Operators (all math, as of v1.0, is integer math)
    - a UP b        : a +
    - UPZ a!![b     : a += b (b=1)
    - a NERF b      : a - b
    - NERFZ a!![b]  : a -= b (b=1)
    - a TIEMZ b     : a * b
    - TIEMZD a!![b] : a *= b (b=1)
    - a OVAR b      : a / b
    - OVARZ a!![b]  : a /= b (b=1)

http://lolcode-ctools.googlecode.com/svn/doc/spec/lolcode-v1.0-rec.txt

SUM OF — addition
DIFF OF — subtraction
PRODUKT OF — multiplication
QUOSHUNT OF — division
MOD OF — division remainder
BIGGR OF — maximum
SMALLR OF — minimum

http://progopedia.com/language/lolcode/

So it looks like it's not actually a standard, and we can do whatever we want actually

CorbynS commented 10 years ago

I say we do standard notation for now, and we can add in whatever key words we want later on

Edit: I like the first one though.

calvinmm commented 10 years ago

I like the first one as well, I think it shouldn't be too difficult to implement math as we can define our own operators.

I think the order we implement them should be:

UP
NERF
TIEMZ
OVAR

Afterwards, we can look into doing the a +=b style :sailboat:

@irvinshen what do you think?

irvinshen commented 10 years ago

Honestly it really all depends on how we're writing it. The main difference is prefix vs. infix (and whatever the += is), and the way the code works right now, I'm not sure whether either has an advantage over the other.

Since the first looks more interesting (and it's the popular opinion), I wouldn't have an issue with it.

calvinmm commented 10 years ago

Basic (int) operations have been implemented in ede6ce0d5f5dd04b9347e7ff4319b15899e04122