[lit][generate-title]
[lit]
A code atlas is a categorical index of things that code can do. It is designed to help a non-coder assist the design of a programming language. An atlas based primarily on the [[Fig-programming-language]] is offered on this page.
[lit]
variables:
- commands to create variables
- commands to set variables (can be combined with creating variables)
- commands to reference variables (rarely needed; parameters suffice mostly)
- commands to remove or “un-set” variables
input:
- commands to get the number of seconds past midnight
- commands to get input from the keyboard or piped from other programs
- commands to get lines from files
- commands to get the clock time or date as a string
- commands to open a file, or put its contents into an array
- commands to get file from a url online
- commands to pause for a certain number of seconds or parts of a second
- commands to get parameters from the command line
output:
- commands to put text on the screen and go to the next line
- commands to put text on the screen and stay on the same line
- commands to write a line of text to a file
- commands to manually update the screen after drawing graphics (or auto-update after each graphic is drawn; which can be considerably slower)
- commands to clear the text screen, graphics screen, or both
- commands to move to the middle of the screen (mostly found in logo)
- commands to change graphics mode or resolution or window size
- commands to change the colour of text or highlighting
- commands to move the next place to draw a dot or circle or start a line
- commands to draw a dot or circle or line, rectangle, polygon, ellipse or image
basic math:
- commands to add, subtract, multiply or divide (perhaps to/from/by variables)
- commands to get octal, binary or hex representations of a number
- commands to get the cosine, sine, tangent or arctangent of a value in degrees or radians (mostly useful to designing graphics programs)
- commands to convert between degrees and radians
- commands to convert between other units (inches to/from cm., etc.)
- commands to get the modulus of two numbers
- commands to convert numbers to integer or float (whole or decimal values)
- commands to get the square or other root, or find exponents of numbers
loops:
- commands to create a simple loop, or break from (stop) loops (“while”)
- commands to create loops with a condition at the top or bottom (“do while/until”)
- commands to iterate (loop through) a range of numbers
- commands to iterate (loop through) an array of characters, lines of text, or other items
- commands to mark the bottom of a loop
conditionals:
- commands to run code if a condition is true, such as:
- a value is non-zero, or non-zero in length
- two values match exactly
- the first value is greater than the second
- the first value is lesser than the second
- a value is found in a string or array
- commands to mark the bottom of a conditional
- commands to run code if an error is encountered
- commands to mark the bottom of an error-based conditional
- commands to divide a conditional between what code to run if the condition is true, and what code to run instead if it is false
functions:
a function in python or many other languages is a section of code which is like a miniature program. defining a function is like making your own command.
functions are normally defined with a name, an optional list of parameters (or important details) and the code that follows the line that names them. functions can be nameless, i.e. lambdas.
the bottom line of a function is usually marked with a brace, or keyword or change in indentation. a function without a return value is called a “sub.”
- commands to start a single-line or multi-line function or lambda
- commands to get parameters (usually done automatically)
- commands to get get global variables in a local function
- commands to mark the bottom line of a function
- commands to leave the function and return a value, or:
- commands to change the functions return value without leaving the function
functions are one of the more difficult concepts for beginners, but one of the most useful and powerful things about programming (unless you are using objects. a function within an object is usually called a “method.”)
the above commands regard defining functions, but since most commands can also be called functions (especially if they have input parameters and return values) the following commands are also worth considering:
- commands to mark a section of another language allowed as inline code
- commands to import a section of code or access code libraries
- commands to convert text to upper or lower case
- commands to convert numeric values to string values, or string to numeric
- commands to run shell code (call the operating system, or run applications) and/or copy the output to an array
- commands to return the ascii or unicode value of a character, or return a character from the numeric code
- commands to return the length of a string or array
- commands to return a 0 or false for non-zero/non-zero-length values, or a -1 or true for zero or zero-length values
- commands to trim whitespace from the left or right of a string, or both
- commands to join an array into a string, or split a string into an array, or replace part of a string with another string
- commands to swap two or more values
- commands to open and close files, quit a program or leave the program environment
- commands to perform operating system level tasks such as rename or delete files, change the current folder, or create or remove folders
- commands to locate the position of text or item inside a string or array (or return another value if not found)
- commands to sort or reverse an array, or reverse a string
- commands to get text or items from the left, right or middle of a string or array
- commands to replace an item in an array
- commands to convert a string or numeric to an array type
- commands to create, edit, append or remove items from arrays or hash tables
the possibilities for commands to add are practically limitless, but you can build a language to keep yourself busy for years out of the above command concepts. the above lists practically every feature of the entire fig language, so there are quite a lot of programs you create out of those features.
you may find there are entire categories of features you dont care about including in your language at all. the above lists include:
- 10 commands related to strings or text on the screen
- 9 math or numeric conversion commands
- 9 condition-related commands
- 6 graphics-related commands
- 6 commands for defining functions
- 5 commands for loops
- 5 commands for dealing with variables
- 4 related to files online or local files
- 4 related to arrays
- 3 related to the os
- 3 related to the time
- 2 for importing or marking inline code
- 1 for the keyboard /stdin
thats almost 70 types of commands; any of those that arent important enough to use right away, you could skip adding to your first language.
[lit]
home: [lit]https://freesoftwareresistance.neocities.org[lit]