waterbearlang / waterbear

Visual block syntax for programming languages
http://waterbearlang.com/
357 stars 88 forks source link

Add a few missing math blocks #1237

Closed CelticMinstrel closed 8 years ago

CelticMinstrel commented 8 years ago

Just roots, logs, and signum, basically.

dethe commented 8 years ago

There's a parse error in runtime.js which is causing tests to fail.

CelticMinstrel commented 8 years ago

By the way, is there a way for the log block to reference the existing e constant rather than duplicating it?

dethe commented 8 years ago

I don't see why not.

CelticMinstrel commented 8 years ago

I don't know how to do that...

dethe commented 8 years ago

Looks good. :shipit:

CelticMinstrel commented 8 years ago

It would be nice if I could do something like this:

<wb-expression ns="math" type="number" fn="log">
    <wb-value type="number" value="1">logarithm of</wb-value>
    <wb-value type="number">to base
        <wb-expression ref="e"></wb-expression>
    </wb-value>
</wb-expression>

(That's hypothetical syntax based on XML schemas.)

dethe commented 8 years ago

Oh, I see what you mean. It's going a little bit the other way because I'm a) trying to make expressions reactive and b) keeping things consistent so we don't have too many different patterns for doing things. I'll look for ways to avoid duplication or automate the generation of the necessary functions.

CelticMinstrel commented 8 years ago

I'm guessing that means there's no way to do that at the moment?