News for hackers. Stuff that matters.
Re:The Sparkling Programming Language by cmiller1 on Monday November 16, 2015 @12:02PM (#10575534)
I threw together a quick, naive, FizzBuzz in it on their online demo, was surprised to find that it doesn't have a modulus operator. Can anyone come up with something simpler?

  let divisible = fn (x, y){
    return (x-(x/y*y))==0;
  };
  for let i=1;i<=30;i++ {
    if divisible(i,15){
      print("FizzBuzz");
    }else if divisible(i,3){
      print("Fizz");
    }else if divisible(i,5){
      print("Buzz");
    }else{
      print(i);
    }
  }
Edit: Correction, apparently it does have a modulo operator.
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @12:17PM (#10575627)
Hi, author here. Sparkling does have a modulo operator, it's spelled '%', just as in C (in fact, it maps directly to C's % operator).
Re:The Sparkling Programming Language by cmiller1 on Monday November 16, 2015 @12:22PM (#10575662)
Oh! I didn't see it in the list of operators on the tutorial so I assumed it didn't.
Re:The Sparkling Programming Language by H2CO3 on Monday November 16, 2015 @12:30PM (#10575706)
No problem – documentation may still be somewhat incomplete at some places, sorry for that.