This is the first question for this language, and I decided I would do a FizzBuzz.

I used a template literal as a proof of concept, same goes for the pipe (|>). The code creates a function that recreates the traditional FizzBuzz in FreezeFlame:

var fizzBuzz = (max) -> {
    for(var i = 0; i < max + 1; i++) {
        (if i % 3 === 0 || i % 5 === 0 then "#{i % 3 == 0 ? 'Fizz' : ''}#{i % 5 === 0 ? 'Buzz' : ''}" else i) |> console.log

This is equivalent to the following in JavaScript:

var fizzBuzz = (max) => {
    for(var i = 0; i < max + 1; i++){
        console.log((i % 3===0||i % 5===0 ? `${i % 3 == 0 ? 'Fizz' : ''}${i % 5 === 0 ? 'Buzz' : ''}` : i));

The following features are used:

  • FreezeFlame ternary (if ... then ... else ...)
  • FreezeFlame template literals (#{...})
  • JS ternary (... ? ... : ...)
  • FreezeFlame pipe (... |> ...)
  • FreezeFlame function ((...) -> { ... })

My main worries are the testing.

FreezeFlame GitHub



I'm sorry to say this but this solution is needlessly complicated. You are doubling up on your divisibility checks. This is a well known interview question where the goal is to really just to check that you can order your if statements correctly. It is kind of cool that you never really do a i % 3 == 0 && i % == 5 check (or i % 15 == 0), but at what cost?

What is the purpose of this language? Is FizzBuzz really suppose to show off the language?

I hate to sound this harsh, but I am not really feeling this language. Is it probably a useful educational experience? Sure, but I:

  1. Don't think this example really showcases anything about your language, except for maybe the pipe operator.
  2. (Maybe better for your other question) Not sure about the goal of the language.
  3. I feel like most of the stuff (maybe not all, but most) could be simulated with macros. Hence, instead of creating a whole new language, you could use something like SweetJS to emulate most of the stuff you have done.
  4. Not really sure how template literals showcase anything about your language, Javascript does it nearly identical to your way.

I know this is discouraging. I remember someone saying something along the lines of getting the urge to make a programming language and then laying down for a while until the urge wears off.

Before I become too discouraging, however, maybe you should really think about code you disliked in Javascript and analyze it closely. Then write it the way you want it to look like and then consider what you want. Maybe if you want to use template literals so badly, you can find a way to describe them easier in FreezeFlame?

  • \$\begingroup\$ I'd like to share the full purpose of the language, but that is a little beyond the scope of a comment. Perhaps I will edit the question? I do agree, however, that this doesn't showcase much of the language. \$\endgroup\$ Sep 12 '18 at 2:52
  • 1
    \$\begingroup\$ @FreezePhoenix I'd like to hear the intention, it's probably a good thing to do before you begin a language. You may want to edit the original FreezeFlame question instead though. \$\endgroup\$
    – Dair
    Sep 12 '18 at 3:21
  • \$\begingroup\$ K, I'll edit the question. \$\endgroup\$ Sep 12 '18 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.