You Can’t Have a Function Repository without Having Some Fun

On the left is a maze with a Wolfie circle up at top and Spikey at the bottom, and a red line moving through it. On the right is a Mondrian-style artwork with red, yellow, white, and black squares.

This post, written by Bob Sandheinrich, was originally published on the Wolfram Blog. The original post can be viewed here.

While programming in the Wolfram Language, I am able to quickly and easily get results — one of the best aspects of writing code in a high-level language. The Wolfram Language is so easy to use that I have the freedom to pursue ideas on a whim, even if I know those ideas may not accomplish anything great or work toward a larger goal. In most cases, within a few minutes I figure out if the idea is a dead end. I also figure out if I am on the path to creating something useful or, better yet, fun.

This kind of willingness to experiment with code doesn’t happen with every programming language. When I’m not working with code in a very serious way for a living, I’ve been able to create a team-making tool for my recreational sports league and a GIF-making tool to amuse friends. Sometimes, I am arrogant enough to think that these kinds of tools would be useful (or fun!) to other people.

The Wolfram Language is large and august. It contains thousands of symbols for performing computations in many domains. With each version release, the language grows at an increasing rate. Wolfram Language users can usually maintain an expertise within a limited domain and read documentation whenever they want to explore outward. But for developers at Wolfram who are tasked with expanding the Wolfram Language, a broad understanding is crucial. The durability of the language over decades depends on consistency among all domains. Because of this requirement, the design of new functions is a very deliberate and serious endeavor. Adding a quick, hacky side project, even if it is useful and interesting to the Wolfram Language, is not a simple task, and it may never reach the standard required to be included.

When you look at Wolfram Language documentation, you see very serious function names like CircularQuaternionMatrixDistribution and NDEigensystem. These are not side projects or frivolities. With some exceptions, the documentation is unlikely to inspire mirth in the reader.

Luckily, for over a year now we have had an outlet that is perfect for lighthearted code, the Wolfram Function Repository. To paraphrase a well-coiffed man, I’m not just a developer of the Function Repository; I’m also a client. I can submit the fun code I write that has almost no chance of making it into the Wolfram Language because the Function Repository does not have the rigid requirements of the Wolfram Language.

You may have some questions about whether or not to submit your own imperfect or frivolous code. Maybe this quick Q&A will give you the inspiration you need:

  • Q: What if the design is inconsistent with other domains of the Wolfram Language?
    A: That’s fine.
  • Q: Is exhaustive error handling a requirement?
    A: No big deal.
  • Q: What if the function won’t handle edge cases?
    A: There are almost always tricky edge cases! We will take it anyway.
  • Q: What if it’s silly?
    A: Please submit it now.
  • Q: What if it involves anthropomorphized birds?
    A: I will email you every day until you submit it.

The following are some of my favorite playful Function Repository entries. As you will see, I am not the only one who has found this to be a useful outlet for spreading computational joy. But since, as I said, I am arrogant, I’ll start with one of my creations, which I call “Junior.”

Bob

The Bob resource function makes things bob up and down in a notebook. Yes, it’s stupid. And I can say that because I created it. If you find a serious use case, congratulations! Still, it makes me smile, and I hope it makes others smile too.

A screenshot of a video with bobbing plots on a chart

WolfieSay and Friends

There are several fun ways to display content in a notebook, and fun ways to generate the content. Rather than show each function alone, I will make a single masterpiece.

Wolf cartoon (Wolfie) in red top hat with a speech bubble filled with wavy, nonsense text. Below is a bird with a speech bubble fixed with Latin reading “I hold a wolf by the ears,” written in rainbow text. Everything is encased in a wooden frame.

If anyone enjoys xkcd as much as me, they will love this one:

Plotted chart with shaky lines and font that is similar to the xkcd comic

Random

As you might imagine, we get a lot of random stuff submitted. Literally random. Here are some random entries that put the “fun” in “Function Repository”:

RandomMandala function, with a flower-like design
RandomMaze function showing a random maze
RandomMondrian function showing Mondrian-style artwork

Games

When we first opened the Function Repository for submissions, several of the first submissions were games. Some people had made Wolfram Language versions of games in Mathematica years ago and were waiting for a good opportunity to share them. The quality assurance testing of these was not a chore (send more, please).

Random Sudoku puzzle filled with blanks and numbers
Lights Out game, with a grid filled with white and black squares in a random pattern
A small grid of gray squares with metrics at the top, showing the output of a Minesweeper game
A 2048 game board with two boxes with the number 2
Game board similar to Tetris, with an L-shaped block falling from the top of the screen

The Greatest, Most Fun Function of All

The greatest, most fun function of all is the one you are going to send us. Sorry, I know that was lame and disappointing. I needed to use this section header so that you would stop playing Minesweeper and finish reading. The functions here are fun, but I know there are other hidden gems out there, waiting on lonely hard drives, yearning for the chance to be discovered.

So it’s time to get serious about fun. We want your silly, absurd, stupid functions. I can’t remain the only person with a Function Repository entry that shares both their name and sense of humor. Chase, Harmony, Sue, do your worst. Submit them. I promise we will laugh with you, not at you.

--

--

Tech-Based Teaching Editor
Tech-Based Teaching: Computational Thinking in the Classroom

Tech-Based Teaching is all about computational thinking, edtech, and the ways that tech enriches learning. Want to contribute? Reach out to edutech@wolfram.com.