Hi, I'm Thomas, chief developer of the SBTCVM project, and all around artist and programmer. I do have more of an understanding of balanced ternary than most i would say.
var remain3=+
var remain5=+
uiter fbnum,fbloop,@1,@100
stop
label fbloop
divmod fbnum,@3
set remain3
divmod fbnum,@5
set remain5
if remain3,@0 gsub fizz
if remain3,@0 return
if remain5,@0 gsub buzz
if remain5,@0 return
dumpd fbnum
newline
return
label fizz
if remain5,@0 goto fizzbuzz
prline Fizz
return
label fizzbuzz
prline FizzBuzz
return
label buzz
prline Buzz
return
Other/Info: Figured I'd contribute something a bit more obscure. :) SSTNPL is an architecture-specialized programming language thats used with my SBTCVM ternary computer simulator. Yes, its a bit clunkier-looking than most of the examples here, but mainly down to it using labeled GOTOs...
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Hi, I'm Thomas, chief developer of the SBTCVM project, and all around artist and programmer. I do have more of an understanding of balanced ternary than most i would say.
SSTNPL is somthing i put together for SBTCVM specifically. its kinda somehwhere between an assembler (as it compiles to SBTCVM's assembly language), and C, with a bit of a primitive syntax, and a fairly static structure. Its simple, but it does have a few neat features like 2-axis array-like tables, and a module system.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
let fizzbuzz n =
let rec loop i max div3 div5 =
if i < max then
match i = div3, i = div5 with
| true, true -> print_endline "FizzBuzz"; loop (i + 1) max (div3 + 3) (div5 + 5)
| true, false -> print_endline "Fizz"; loop (i + 1) max (div3 + 3) div5
| false, true -> print_endline "Buzz"; loop (i + 1) max div3 (div5 + 5)
| false, false -> print_endline (string_of_int i); loop (i + 1) max div3 div5
in
loop 1 n 3 5
let _ = fizzbuzz 100
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
I'm software developer working to solve problems and create robots to solve problems and create robots to solve problems and create robots to... yeah I really love recursion...
Location
Jakarta, Indonesia
Education
Monash University (Graduate), BINUS University (Undergraduate)
Other/Info: The above code execute console.log command for each number. And yes, this is compiled on JSFuck based on the original code:
var i;
for (i = 1; i <= 100; i++){
var fb = 0;
if (i % 3 == 0){
console.log("Fizz");
fb = 1;
}
if (i % 5 == 0){
console.log("Buzz");
fb = 1;
}
if (fb == 0) console.log(i);
}
Trying to decode the first snippet on JSUnFuck will likely to cause browsers to hang.
Interestingly, this one can be exported to C with minimal modifications:
#include <stdio.h>
int main(){
int i;
for (i = 1; i <= 100; i++){
int fb = 0;
if (i % 3 == 0){
printf("Fizz");
fb = 1;
}
if (i % 5 == 0){
printf("Buzz");
fb = 1;
}
if (fb == 0) printf("%d", i);
printf("\n");
}
}
JavaScript should be welcoming to my folks who are currently learning C thanks to similarity in syntaxes. (If you're reading this, good luck in facing your mid-term exams next week!)
Language: ReasonML
Sketch: sketch.sh/s/XABe2ghxBqncDWTTKpNK8n/
Language: SSTNPL
Code:
Other/Info: Figured I'd contribute something a bit more obscure. :) SSTNPL is an architecture-specialized programming language thats used with my SBTCVM ternary computer simulator. Yes, its a bit clunkier-looking than most of the examples here, but mainly down to it using labeled GOTOs...
Very interesing, thank you for sharing. Never heard of SSTNPL and even a quick google search doesn't render many results. 👍 Thanks!
SSTNPL is somthing i put together for SBTCVM specifically. its kinda somehwhere between an assembler (as it compiles to SBTCVM's assembly language), and C, with a bit of a primitive syntax, and a fairly static structure. Its simple, but it does have a few neat features like 2-axis array-like tables, and a module system.
as far as SBTCVM itself, the blog's about page has a good overview of it:
sbtcvm.blogspot.com/p/about.html
Language: Smalltalk
Code:
👏👏👏, never used that language.
Language: Emacs Lisp
Code:
Language: Lua
Code:
Other/info: I guess I'll start the challenge off.
This is a pretty simple function in lua of the FizzBuzz challenge.
Language: OCaml
Code:
Interesting! What kind of work is OCaml used for? 😊
Compilers, Proof Assistants, Static Verification Tools. Facebook uses it a lot under the hood.
Interesting.
Welcome to dev.to btw (saw you joined today).
I've learnt a lot since this old thread, here's how i'd attempt this question in an interview today:
Language: Erlang
Code:
Short version, generate a list (of strings and integers), don’t bother printing:
Full version, print one term per line. Here we have to convert integers to strings:
Language: Python
Code:
Language: JavaScript
Code: gist.github.com/reinhart1010/d2b81...
Other/Info: The above code execute
console.logcommand for each number. And yes, this is compiled on JSFuck based on the original code:Trying to decode the first snippet on JSUnFuck will likely to cause browsers to hang.
Interestingly, this one can be exported to C with minimal modifications:
JavaScript should be welcoming to my folks who are currently learning C thanks to similarity in syntaxes. (If you're reading this, good luck in facing your mid-term exams next week!)
Language: Java (8 and above)
Code:
Language: Javascript
Code:
Language: Haskell
Code:
I did write solutions in Javascript and Racket for a similar challenge a while ago.
Since nobody has done Javascript yet, here's a crazy implementation.
Consider how easy it is to extend to print
'fazz'for multiples of 7.Here's my implementation in Racket
The
print-listfunction is a bit redundant, since(map fizzbuzz (range 1 101))will already print the resulting list to the console.