These are examples with specifications posted in our GitHub repository, and are included in the SDK which you can download at Beadslang.com.
Beads is not a minor rehash of Python or JS. It is a clean sheet design, carefully crafted to catch as many errors at compile time as possible so you spend less time debugging. These examples barely scratch the surface of the full range of Beads features, such as:
- can run in reverse (AKA time-travel-debugging)
- automatic refresh of screen areas when the underlying model changes
- protected arithmetic like Excel
- units of measure like 3 m + 2 ft (even at runtime)
- a proportional layout system that responds to size changes beautifully
- greatly simplified regular expressions
- a simple and flexible module system
- no make system needed for most projects
Example: Temperature control
This is a simple temperature control which demonstrates the physical units of measurement in Beads, and how you can have a dual control and either one will update the model and refresh the other version of the control that uses the same data, all without locks or conflicts arising.
Here is a short video talking about it.
Example: Cycler utility
This handy utility shows how you can run a program inside another program in Beads (by using the monitor keyword instead of program on the first line of code).
Here is a short video talking about it.
Example: Heat transfer simulation
In this example we show how you can use the physical units of measure features in the Beads language, where you can easily switch between the different temperature scales. Beads includes all the basic units used in engineering and science, with the unit conversions built into the language.
Example: Animate1 – Animation using the HTML Canvas
In this example we show how you can use the HTML canvas layer to achieve smooth animation effects.
Example: Animate1 – Animation program execution
In this example we show a prototype of a way of illustrating program execution, as we call and return from functions:
Example: Beads versus Python
In this short 200 word example we take an existing Python program and rewrite it in Beads. They Python version draws to the console as if we were in 1970’s, while the Beads version runs in the browser (or could be emitted for Desktop or Mobile platforms), and resizes even while running without skipping a beat.
The Python version is slightly shorter, but imports 4 libraries, and uses about 15 external functions. Beads uses only 7 external functions, and they are the same ones used in every program. The Python version uses a complex multi-threated scheme that requires semaphores and locking of critical sections. A rather advanced set of concepts. The Python version requires an external file to be read, because it doesn’t have a powerful literal syntax.
Example: HTTP form that re-arranges its layout
It is very common to need to have input forms and collect user data. This example shows how beads can rearrange a form based on the pixel density and size of a screen. As you make the window larger or smaller it resizes all the elements. This is different than HTML Flex boxes, as it completely rearranges the form using IF statements and can accomodate a very wide range of display densities and sizes. This means your forms can work on mobile devices which can have pixel densities 5 times that of a desktop. Many desktop forms are unusable on mobile. Complexity rating: 1200 words
The classic board game. Complexity rating: 1500 words
Example: Tic-tac-toe client/server version
The classic board game, but in multiplayer form, where you can play or watch 12 different pairs of people playing across the internet, using TCP sockets. We write both the client and the server in Beads. The server publishes the game state, and the client subscribe to the published shared mutable state. Each of the players receives without any message handling code the updated state of the game. The clients make their moves by invoking remote function calls. You code the program as a standalone, then split the code into two parts. Client/server has never been so easy. No messy API’s for message handling, all encoding and decoding is done automatically, and packets are sent in binary not JSON for maxiumum compactness and performance. A complexity rating of 1500 words.
Example: Tic-tac-toe game standalone version
The classic children’s game, two player (no AI). Complexity rating: 520 words
Example: Color picker utility
A handy tool for programming; shows the HTML named colors, sorted in a convenient to use sort order. Approx. 1300 words.
Example: Bearsweeper game
The classic Minesweeper game, recast with a Bear in the starring role. Complexity rating: 1000 words
Example: Lumberjack game
A very simple wood chopping game, built for little kids. A rewrite of an existing React/TS game that is can be run here. We compare the two implementations to see how it differs in word count, number of dependencies, memory usage. Complexity rating: 750 words
The classic Apple calculator program, except without the bugs that Apple has! Complexity rating: 500 words
Example: Snake game
The classic snake game as popularized by Nokia cellphones. Probably the most fun per line of code ever made. Program complexity rating: 500 words.
Example: Sort method contest
The classic bubble sorting algorithm is pitted against the just slightly more complicated but a zillion times faster Quicksort amethod. Watch the two side by side sort the same number list, and see why Quicksort is so much more clever, by moving things larger distances. The larger the sample size the more terrible the bubble sort works. Program complexity rating: 440 words.
Example: Wristwatch simulation
This simple program simulates a wristwatch. Program complexity rating: 180 words.
Example: Analog clock
This simple program will draw a clock on the screen. This is among the shortest possible graphical programs one can imagine. Program complexity rating: 150 words.