3 ms·
This is their example of Fizzbuzz: https://github.com/magicmouse/beads-examples/blob/master/Example%20-%20FizzBuzz/fizzbuzz.beads https://github.com/magicmouse/
by jsight 5y ago
This is their example of Fizzbuzz: https://github.com/magicmouse/beads-examples/blob/master/Example%20-%20FizzBuzz/fizzbuzz.beads https://github.com/magicmouse/beads-examples/blob/master/Exa...
But this is supposed to replace Excel somehow? Along with basically every other language.
I can't accuse them of not being ambitious.
- JustSomeNobody 5y agoI'm struggling to see the advantage over currently popular languages.
- magicmouse 5y agoCompared to HTML/CSS/JS, Beads is much simpler. You can learn Beads in probably under 10 hours, while CSS takes at least 100 hours to master. Most of the older popular languages like C, C++, Java, have huge external libraries you have to learn to make graphical interactive software. So for the target application area, which is graphical interactive software, Beads is far simpler, and has many features to avoid error at compile time, and keep running with fault tolerance at execution time.
- OskarS 5y ago// this shows a persistent value FizzBuzz grid // whatever cell you pick is remembered for a month Wait, what?
- ZiiS 5y agoGiven the implementation is `cookie_write(KEY, my_state, duration:1 day)` I am fairly sure even this example has a bug.
- magicmouse 5y agoI am not aware of any bug in this code. It works, and the selection persists. Of course it is a silly project. Classic FizzBuzz is just too simple a task to show off any language features, so the task was souped up so that it draws a 10x10 grid of the results, and lets you pick one of the 100 cells to highlight. It persists this selection for a day to show how one can save up to 1kb of state information trivially inside the browser's cookie system, which is simpler to use than the IndexDB database (which is also available to use if you wish). 1Kb is enough to store a reasonable amount of data, and since Beads has a built-in graph database (not as fancy as Neo4J), you can store a subtree into the cookie with one line, and no encoding/decoding necessary, as that is performed by the runtime library for you (a nicety). The convenience of working with a graph database internally, instead of the typical collection of data structures that one sees in older languages such as scalars, tuples, lists, dictionaries, queues, and pointers, is an advantage that only becomes apparent after some use of the language; i encourage you to take it for a spin.
- kortex 5y agoThat's neat, but imho start with the plain fizzbuzz first. Everyone has it in their lexicon so it acts as a first-pass Rosetta stone for what the language syntax is like. Adding extra bits implies you need those to get the job done.
- magicmouse 5y agoI just updated the program to allow arbitrary arrays of words and factors for division, so now it is a fizz-buzz-jazz version of the program, and it gets even shorter once you go to table driven data. var ss = "" var color = ALICE_BLUE loop across:WORDS index:wordx if mod(b.cell_seq, PRIMES[wordx]) == 0 WORDS[wordx] &=> ss color = COLORS[wordx] if ss == "" // plain cell ss = to_str(b.cell_seq)
- electroly 5y agoOP means that the comment says it's persisted for a month, but the actual code persists for a day.
- magicmouse 5y agoAh, i see i forgot to update the comment when i changed to one day so i could test it easier... thanks for pointing that out, will correct.