AnyLang Programming Language Comparison/Anylang Core Concepts

From Wikibooks, open books for an open world
Jump to: navigation, search

AnyLang CoreConcepts[edit]

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_syntax basic array syntax
core_arrayop.count return the total number of elements in an array
core_arrayop.delete_at delete an array element
core_arrayop.dim init array to N elements
core_arrayop.extend append multiple elements at the highest index. array is flattened into individual elements.
core_arrayop.find return true if element found in list
core_arrayop.get_baseindex get the base index for the first element in all arrays
core_arrayop.join return a string from joined array elements
core_arrayop.last_index return the index of last element in an array (note that len does not necc eq maxindex)
core_arrayop.listfind_nocase return one or more element found in a list as list one or more element found in an array as array
core_arrayop.map_index just like map but also include array index
core_arrayop.max return the index of the element with the maximum value
core_arrayop.min return the index of the element with the minimum value
core_arrayop.modulo return array elements modulo N (skip elements) create a new array
core_arrayop.prepend insert element at the lowest index
core_arrayop.range return a range of countables from x to y
core_arrayop.reorder reorder certain elements of an array while leaving the order of the remaining elements indeterminate
core_arrayop.reverse reverse the elements in an array return one or more element found in an array as array
core_arrayop.set_baseindex get or set the default base index for all arrays
core_arrayop.slice return a slice (subsection) of elements from the array as another array
core_arrayop.sort array sort
core_arrayop.unappend remove and return element at the highest index
core_arrayop.unique remove duplicate elements from array and return the unique elements as an array
core_arrayop.unprepend remove and return element at the lowest index combine the elements from two arrays together in alternating order

core concept -- character

core_chrop.ascii_range output a range of ascii characters
core_chrop.char_to_code specify a character and get back the corresponding character code (ASCII only)
core_chrop.code_to_char specify a char code and get back the corresponding character (ASCII only)
core_chrop.newline_char specify a newline in a string
core_chrop.section_char specify a section char (windows alt+0167)
core_chrop.tab_char tab char in a string

core concept -- dictionary

core_dictionaryop.addkey add a new key to the dictt
core_dictionaryop.dropkeys delete multiple key-value pairs from dictt
core_dictionaryop.each enumerate the name-value pairs in a dictt
core_dictionaryop.haskey return true if a specific key exists in the dictt
core_dictionaryop.haskeys count the total number of keys or return true if the dictt has any keys
core_dictionaryop.hasvalue return true if a specific value exists in the dictt
core_dictionaryop.keepkeys delete multiple key-value pairs from dictt keep only those supplied in a list.
core_dictionaryop.keys enumerate or iterate the keys in a dictt
core_dictionaryop.addmerge merge pairs from addon_dictt into starter_dictt, but never let a blank value in addon_dictt overwrite a nonblank in starter_dictt
core_dictionaryop.merge merge key value pairs from one dictt into another to form a combined dictt
core_dictionaryop.modifykeys modify dictionary keys in place
core_dictionaryop.newliteral create a new dictionary literal
core_dictionaryop.bbpair dictionary with name and keyref
core_dictionaryop.removekey delete a key from the dictt
core_dictionaryop.values enumerate or iterate over the values in a dictt

core concept -- operators

core_langop.and Logical_And
core_langop.bit_and Bitwise_And
core_langop.bit_left_shift Bitwise_Leftshift
core_langop.bit_not Bitwise_Not
core_langop.bit_or Bitwise_Or
core_langop.bit_right_shift Bitwise_Rightshift
core_langop.bit_xor Bitwise_Xor
core_langop.compare_op Overview Of Comparison Operators
core_langop.not Logical_Not

core concept -- mathematics

core_mathop.bin_to_dec binary to decimal
core_mathop.compare_between numeric comparison
core_mathop.compare_gt numeric comparison greater than
core_mathop.compare_lt numeric comparison less than
core_mathop.cos cosine
core_mathop.hex_to_dec hexadecimal to decimal
core_mathop.min_max compare values and return the minimum or maximum
core_mathop.power compute x to the power of n
core_mathop.randint generate a random integer
core_mathop.sin sine
core_mathop.tan tangent

core concept -- set operations

core_setop.add add an element to a set
core_setop.difference new set with elements in s but not in t
core_setop.intersect new set with elements common to s and t
core_setop.len cardinality of set s
core_setop.member test x for membership in s
core_setop.nonmember test x for non-membership in s
core_setop.scopy new set with a shallow copy of s
core_setop.subset test whether every element in s is in t
core_setop.superset test whether every element in t is in s
core_setop.symdiff new set with elements in either s or t but not both
core_setop.union new set with elements from both s and t

core concept -- string operations

core_stringop.basic_syntax basic string declaration and string literal syntax
core_stringop.case_lc lowercase transformation of the string
core_stringop.case_swap uppercase characters converted to lowercase and vice versa
core_stringop.case_tc string with title case transformation of the string
core_stringop.case_togg toggle between all uppercase and all lowercase
core_stringop.case_uc uppercase transformation of the string
core_stringop.chomp remove trailing newline
core_stringop.concat the concatenation of arguments
core_stringop.concat_nb the concatenation of arguments if and only if all are non-blank
core_stringop.count count the occurrences of str2 in str1
core_stringop.csplit an array with each element consisting of a single character from string
core_stringop.dedent left-justify a multi-line string
core_stringop.eq true if two strings are identical
core_stringop.eq_nocase true if two strings are identical ( case-insensitive )
core_stringop.find true if strNeedle matches any substring in strHaystack
core_stringop.find_nocase true if str1 contains str2 (case-insensitive )
core_stringop.find_qw true if sNeedle matches an entire space-delimited word in sHaystack
core_stringop.get_region a subregion of a string enclosed inside TagBeg and TagEnd (tag can be regex or string)
core_stringop.gsub regex replace on str1 with str2
core_stringop.indexof integer index of sNeedle in sHaystack
core_stringop.lstrip trim spaces from a string
core_stringop.repeat repeat a string N times
core_stringop.replace replace on str1 with str2
core_stringop.reverse reverse all characters in the string
core_stringop.rstrip trim spaces from a string
core_stringop.split split on a string-delim (or regex-delim) and return array
core_stringop.splitlines split a string on newlines and return array
core_stringop.strip trim spaces from a string
core_stringop.substr a substring of a string
core_stringop.ucfirst string with first letter as uppercase
core_stringop.wsplit split on whitespace and return an array

core concept -- table operations

core_tableop.delete_col delete a column from a SimpleTable
core_tableop.delete_rec delete rows
core_tableop.insert_col create a new column in a SimpleTable
core_tableop.insert_rec insert a row into a SimpleTable
core_tableop.merge combine two or more tables left to right
core_tableop.querymeta metadata on the last run query
core_tableop.select_col choose all values from a single column as a list, this is just a variation of
core_tableop.select_rec select rows in the same manner as a SQL SELECT statement
core_tableop.sort_rec sort the rows of a SimpleTable
core_tableop.union combine two or more tables top to bottom (must have the same fieldnames)
core_tableop.update_rec update rows in the same manner as a SQL UPDATE statement

core concept -- text operations

core_txtop.lines_fromfile textfile to array with one line per array element
core_txtop.splitfile split a large text file into many smaller files
core_txtop.str_fromfile get the entire content of a text file and assign it to a string variable
core_txtop.str_tofile spit out an entire string to a single text file