Jump to content

AnyLang Programming Language Comparison/Anylang Core Concepts

From Wikibooks, open books for an open world

AnyLang CoreConcepts

[edit | edit source]

The following is the central list of AnyLang Core Concepts. These are programming concepts that are common enough to be compared and applied across multiple mainstream programming languages. Moreover, these are considered the most significant elements, based on the guiding motivations of this book.

core concept—array

core_arrayop.append(aka array_push) insert a single-element at the highest index. array treated as a single nested element
core_arrayop.basic_syntaxbasic array syntax
core_arrayop.countreturn the total number of elements in an array
core_arrayop.delete_atdelete an array element
core_arrayop.diminit array to N elements
core_arrayop.extendappend multiple elements at the highest index. array is flattened into individual elements.
core_arrayop.findreturn true if element found in list
core_arrayop.get_baseindexget the base index for the first element in all arrays
core_arrayop.joinreturn a string from joined array elements
core_arrayop.last_indexreturn the index of last element in an array (note that len does not necc eq maxindex)
core_arrayop.listfind_nocasereturn one or more element found in a list as list
core_arrayop.mapone or more element found in an array as array
core_arrayop.map_indexjust like map but also include array index
core_arrayop.maxreturn the index of the element with the maximum value
core_arrayop.minreturn the index of the element with the minimum value
core_arrayop.moduloreturn array elements modulo N (skip elements)
core_arrayop.newcreate a new array
core_arrayop.prependinsert element at the lowest index
core_arrayop.rangereturn a range of countables from x to y
core_arrayop.reorderreorder certain elements of an array while leaving the order of the remaining elements indeterminate
core_arrayop.reversereverse the elements in an array
core_arrayop.selectreturn one or more element found in an array as array
core_arrayop.set_baseindexget or set the default base index for all arrays
core_arrayop.slicereturn a slice (subsection) of elements from the array as another array
core_arrayop.sortarray sort
core_arrayop.unappendremove and return element at the highest index
core_arrayop.uniqueremove duplicate elements from array and return the unique elements as an array
core_arrayop.unprependremove and return element at the lowest index
core_arrayop.zipcombine the elements from two arrays together in alternating order

core concept—character

core_chrop.ascii_rangeoutput a range of ascii characters
core_chrop.char_to_codespecify a character and get back the corresponding character code (ASCII only)
core_chrop.code_to_charspecify a char code and get back the corresponding character (ASCII only)
core_chrop.newline_charspecify a newline in a string
core_chrop.section_charspecify a section char (windows alt+0167)
core_chrop.tab_chartab char in a string

core concept—dictionary

core_dictionaryop.addkeyadd a new key to the dictt
core_dictionaryop.dropkeysdelete multiple key-value pairs from dictt
core_dictionaryop.eachenumerate the name-value pairs in a dictt
core_dictionaryop.haskeyreturn true if a specific key exists in the dictt
core_dictionaryop.haskeyscount the total number of keys or return true if the dictt has any keys
core_dictionaryop.hasvaluereturn true if a specific value exists in the dictt
core_dictionaryop.keepkeysdelete multiple key-value pairs from dictt keep only those supplied in a list.
core_dictionaryop.keysenumerate or iterate the keys in a dictt
core_dictionaryop.addmergemerge pairs from addon_dictt into starter_dictt, but never let a blank value in addon_dictt overwrite a nonblank in starter_dictt
core_dictionaryop.mergemerge key value pairs from one dictt into another to form a combined dictt
core_dictionaryop.modifykeysmodify dictionary keys in place
core_dictionaryop.newliteralcreate a new dictionary literal
core_dictionaryop.bbpairdictionary with name and keyref
core_dictionaryop.removekeydelete a key from the dictt
core_dictionaryop.valuesenumerate or iterate over the values in a dictt

core concept—operators

core_langop.andLogical_And
core_langop.bit_andBitwise_And
core_langop.bit_left_shiftBitwise_Leftshift
core_langop.bit_notBitwise_Not
core_langop.bit_orBitwise_Or
core_langop.bit_right_shiftBitwise_Rightshift
core_langop.bit_xorBitwise_Xor
core_langop.compare_opOverview Of Comparison Operators
core_langop.notLogical_Not

core concept—mathematics

core_mathop.bin_to_decbinary to decimal
core_mathop.compare_betweennumeric comparison
core_mathop.compare_gtnumeric comparison greater than
core_mathop.compare_ltnumeric comparison less than
core_mathop.coscosine
core_mathop.hex_to_dechexadecimal to decimal
core_mathop.min_maxcompare values and return the minimum or maximum
core_mathop.powercompute x to the power of n
core_mathop.randintgenerate a random integer
core_mathop.sinsine
core_mathop.tantangent

core concept—set operations

core_setop.addadd an element to a set
core_setop.differencenew set with elements in s but not in t
core_setop.intersectnew set with elements common to s and t
core_setop.lencardinality of set s
core_setop.membertest x for membership in s
core_setop.nonmembertest x for non-membership in s
core_setop.scopynew set with a shallow copy of s
core_setop.subsettest whether every element in s is in t
core_setop.supersettest whether every element in t is in s
core_setop.symdiffnew set with elements in either s or t but not both
core_setop.unionnew set with elements from both s and t

core concept—string operations

core_stringop.basic_syntaxbasic string declaration and string literal syntax
core_stringop.case_lclowercase transformation of the string
core_stringop.case_swapuppercase characters converted to lowercase and vice versa
core_stringop.case_tcstring with title case transformation of the string
core_stringop.case_toggtoggle between all uppercase and all lowercase
core_stringop.case_ucuppercase transformation of the string
core_stringop.chompremove trailing newline
core_stringop.concatthe concatenation of arguments
core_stringop.concat_nbthe concatenation of arguments if and only if all are non-blank
core_stringop.countcount the occurrences of str2 in str1
core_stringop.csplitan array with each element consisting of a single character from string
core_stringop.dedentleft-justify a multi-line string
core_stringop.eqtrue if two strings are identical
core_stringop.eq_nocasetrue if two strings are identical ( case-insensitive )
core_stringop.findtrue if strNeedle matches any substring in strHaystack
core_stringop.find_nocasetrue if str1 contains str2 (case-insensitive )
core_stringop.find_qwtrue if sNeedle matches an entire space-delimited word in sHaystack
core_stringop.get_regiona subregion of a string enclosed inside TagBeg and TagEnd (tag can be regex or string)
core_stringop.gsubregex replace on str1 with str2
core_stringop.indexofinteger index of sNeedle in sHaystack
core_stringop.lstriptrim spaces from a string
core_stringop.repeatrepeat a string N times
core_stringop.replacereplace on str1 with str2
core_stringop.reversereverse all characters in the string
core_stringop.rstriptrim spaces from a string
core_stringop.splitsplit on a string-delim (or regex-delim) and return array
core_stringop.splitlinessplit a string on newlines and return array
core_stringop.striptrim spaces from a string
core_stringop.substra substring of a string
core_stringop.ucfirststring with first letter as uppercase
core_stringop.wsplitsplit on whitespace and return an array

core concept—table operations

core_tableop.delete_coldelete a column from a SimpleTable
core_tableop.delete_recdelete rows
core_tableop.insert_colcreate a new column in a SimpleTable
core_tableop.insert_recinsert a row into a SimpleTable
core_tableop.mergecombine two or more tables left to right
core_tableop.querymetametadata on the last run query
core_tableop.select_colchoose all values from a single column as a list, this is just a variation of arrayop.map
core_tableop.select_recselect rows in the same manner as a SQL SELECT statement
core_tableop.sort_recsort the rows of a SimpleTable
core_tableop.unioncombine two or more tables top to bottom (must have the same fieldnames)
core_tableop.update_recupdate rows in the same manner as a SQL UPDATE statement

core concept—text operations

core_txtop.lines_fromfiletextfile to array with one line per array element
core_txtop.splitfilesplit a large text file into many smaller files
core_txtop.str_fromfileget the entire content of a text file and assign it to a string variable
core_txtop.str_tofilespit out an entire string to a single text file