TodePond / DreamBerd

perfect programming language
https://dreamberd.computer
Other
10.6k stars 298 forks source link

Feature: Distributed Computing #609

Open vivaansinghvi07 opened 2 months ago

vivaansinghvi07 commented 2 months ago

Inspired by #582

As the title suggests, all DreamBerd numbers will be distributed. This means that they will have a value basically equivalent to a normal distribution with some mean and some standard deviation, and collapse to some atomic only under special circumstances.

Here are some examples of using these numbers:

const const num = 1!
const const other = 2!

if 1 < 2 { 
   print "Lower"!
}

This returns prints Lower, because, on average, 1 is lower than 2. What if you want something more realistic? Well, the << is already used for bit-shifting. Therefore, let's use the <<< operator to force both numbers to collapse and then evaluated.

if 1 <<< 2 {
   print "Lower"!  // most of the time
}

Addition, subtraction, multiplication, and other operations with these numbers will follow the appropriate formulae for doing so. The number will collapse in occasions such as printing, or using it in any operation not involving another number.

vivaansinghvi07 commented 2 months ago

If this is made a feature, I will add it to the interpreter :)