The Egel Language
DIR home1: # Egel interpreter builtin combinators 2: 3: ## system 4: 5: The 'system' module defines primitive combinators. 6: 7: + `System::k` *x y* - k combinator 8: 9: + `System::id` *x* - identity combinator 10: 11: + `System::max_int` - maximum for integers 12: 13: + `System::+` *x y* - addition 14: 15: + `System::!-` *x* - monadic minus 16: 17: + `System::+` *x y* - substraction 18: 19: + `System::*` *x y* - multiplication 20: 21: + `System::/` *x y* - division 22: 23: + `System::%` *x y* - modulo 24: 25: + `System::<` *x y* - builtin less 26: 27: + `System::<=` *x y* - builtin less or equals 28: 29: + `System::>` *x y* - builtin greater 30: 31: + `System::>=` *x y* - builtin greater or equals 32: 33: + `System::==` *x y* - builtin equality 34: 35: + `System::/=` *x y* - builtin inequality 36: 37: + `System::&` *x y* - bitwise and 38: 39: + `System::$` *x y* - bitwise or 40: 41: + `System::^` *x y* - bitwise xor 42: 43: + `System::!~` *x* - bitwise complement 44: 45: + `System::<<` *x y* - bitwise left shift 46: 47: + `System::>>` *x y* - bitwise right shift 48: 49: + `System::to_int` *x* - Try and convert an object to int 50: 51: + `System::to_float` *x* - try and convert an object to float 52: 53: + `System::to_complex` *x* - try and convert an object to complex 54: 55: + `System::to_text` *x* - try and convert an object to text 56: 57: + `System::from_complex` *z* - convert complex to tuple 58: 59: + `String::to_chars` *s* - create a list of chars from a string 60: 61: + `String::from_chars` *s* - create a string from a list of chars 62: 63: + `System::version` - version information of this executable 64: 65: + `System::arg` *n* - the n-th application argument, or none 66: 67: + `System::get_env` *s* - the value of environment variable, or none 68: 69: + `System::app_to_list` *o0 .. on* - arguments to list 70: 71: + `System::list_to_app` *{o0 .. on}* - list to application 72: 73: + `System::tuple_to_list` *(o0, .., on)* - tuple to list 74: 75: + `System::list_to_tuple` *{o0, .., on}* - list to tuple 76: 77: + `System::print` *o0 .. on* - print terms 78: 79: + `System::get_line` - read a line from standard input 80: 81: + `System::format` *fmt x0 ...* - create a formatted strin 82: 83: + `System::ref` *x* - create a reference object 84: 85: + `System::set_ref` *ref x* - set reference objec 86: 87: + `System::get_ref` *ref* - dereference 88: 89: ## async 90: 91: The 'async' module defines concurrency combinators. 92: 93: + `System::async` *f* - create a task 94: 95: + `System::await` *f* - wait for async task 96: 97: + `System::wait_for` *f n* - check whether future reduced during milliseconds 98: 99: + `System::is_valid` *f* - check whether future is reduced 100: 101: + `System::sleep` *n* - sleep for a number of milliseconds 102: 103: ## math 104: 105: The 'math' module defines trigonometic and some other often used combinators. 106: 107: + `Math::e` - Euler's constant and the base of natural logarithms, 108: 109: + `Math::ln2` - Natural logarithm of 2, approximately 0.693 110: 111: + `Math::ln10` - natural logarithm of 10, approximately 2.303 112: 113: + `Math::log2e` - base 2 logarithm of E, approximately 1.443 114: 115: + `Math::log10e` - base 10 logarithm of E, approximately 0.434 116: 117: + `Math::pi` - ratio of the circumference of a circle to its diameter, 118: 119: + `Math::sqrt1_2` - square root of 1/2; equivalently, 1 over the square root 120: 121: + `Math::sqrt2` - square root of 2, approximately 1.414 122: 123: + `Math::abs` *x* - the absolute value of a (complex) number 124: 125: + `Math::acos` *x* - the arccosine of a (complex) number 126: 127: + `Math::acosh` *x* - the hyperbolic arccosine of a (complex) number 128: 129: + `Math::asin` *x* - the arcsine of a (complex) number 130: 131: + `Math::asinh` *x* - the hyperbolic arcsine of a (complex) number 132: 133: + `Math::atan` *x* - the arctangent of a (complex) number 134: 135: + `Math::atanh` *x* - the hyperbolic arctangent of a (complex) number 136: 137: + `Math::atan2` *y x* - the arctangent of the quotient of its arguments 138: 139: + `Math::cbrt` *x* - the cube root of a number 140: 141: + `Math::ceil` *x* - the ceiling of a number 142: 143: + `Math::cos` *x* - the cosine of a (complex) number 144: 145: + `Math::cosh` *x* - the hyperbolic cosine of a (complex) number 146: 147: + `Math::exp` *x* - the exp of a (complex) number 148: 149: + `Math::expm1` *x* - subtracting 1 from exp 150: 151: + `Math::floor` *x* - the largest integer less than or equal to a number 152: 153: + `Math::log` *x* - the natural logarithm (loge, also ln) of a (complex) number 154: 155: + `Math::log1p` *x* - the natural logarithm of the next number 156: 157: + `Math::log10` *x* - the base 10 logarithm of a (complex) number 158: 159: + `Math::log2` *x* - the base 2 logarithm of a number 160: 161: + `Math::max` *x y* - the largest of two numbers 162: 163: + `Math::min` *x y* - the smallest of two numbers 164: 165: + `Math::pow` *x y* - base to the exponent power, that is, baseexponent of a (complex) number 166: 167: + `Math::random` - a pseudo-random number between 0 and 1 168: 169: + `Math::round` *x* - the value of a number rounded to the nearest 170: 171: + `Math::sign` *x* - the sign of the a number 172: 173: + `Math::sin` *x* - the sine of a (complex) number 174: 175: + `Math::sinh` *x* - the hyperbolic sine of a (complex) number 176: 177: + `Math::sqrt` *x* - the positive square root of a (complex) number 178: 179: + `Math::tan` *x* - the tangent of a (complex) number 180: 181: + `Math::tanh` *x* - the hyperbolic tangent of a (complex) number 182: 183: + `Math::trunc` *x* - the integral part of a number 184: 185: + `Math::conj` *z* - complex conjugate 186: 187: + `Math::proj` *z* - projection on Riemann sphere 188: 189: ## string 190: 191: The 'string' module defines string manipulation combinators. 192: 193: + `String::eq` *s0 s1* - string equality operator 194: 195: + `String::neq` *s0 s1* - inequality operator 196: 197: + `String::gt` *s0 s1* - greater than operator 198: 199: + `String::ls` *s0 s1* - less than operator 200: 201: + `String::ge` *s0 s1* - greater than or equal operator 202: 203: + `String::le` *s0 s1* - stringLess than or equal operator 204: 205: + `String::compare` *s0 s1* - compare the characters bitwise 206: 207: + `String::compare_order` *s0 s1* - compare in code point order 208: 209: + `String::case_compare` *s0 s1* - compare two strings case-insensitivel 210: 211: + `String::extract` *n0 n1 s* - extract range of chars from text 212: 213: + `String::starts_with` *s0 s1* - starts with initial segment 214: 215: + `String::ends_with` *s0 s1* - ends with segment 216: 217: + `String::index_of` *s0 s1* - the first occurrence of a text 218: 219: + `String::last_index_of` *s0 s1* - the last occurrence of a text 220: 221: + `String::char_at` *n s* - the char at offset 222: 223: + `String::move_index` *index delta s* - move index by delta chars 224: 225: + `String::count` *s* - number of chars 226: 227: + `String::is_empty` *s* - test whether the text is empty 228: 229: + `String::hash_code` *s* - generate a hash code for this text 230: 231: + `String::is_bogus` *s* - determine if this object contains a valid string 232: 233: + `String::append` *s0 s1* - append two texts 234: 235: + `String::insert_at` *s0 n s1* - insert at given position 236: 237: + `String::replace` *s0 s1 s2* - replace all occurrences 238: 239: + `String::remove` *n0 n1 s* - remove characters in range 240: 241: + `String::retain` *n0 n1 s* - retain the characters in the range 242: 243: + `String::trim` *s* - trims leading and trailing whitespac 244: 245: + `String::reverse` *s* - reverse 246: 247: + `String::to_upper` *s* - convert to upper case 248: 249: + `String::to_lower` *s* - convert to lower case 250: 251: + `String::fold_case` *s* - case-folds the character 252: 253: + `String::ord` *c* - integer value of unicode point/character 254: 255: + `String::chr` *n* - unicode point of integer value 256: 257: + `String::unescape` *s* - unescape characters 258: 259: ## dict 260: 261: The 'dict' module defines mutable dictionaries. 262: 263: + `Dict::dict` - create a dict object 264: 265: + `Dict::has` *d k* - check for key 266: 267: + `Dict::get` *d k* - get a value by key 268: 269: + `Dict::set` *d k v* - set a value by key 270: 271: + `Dict::erase` *d k* - erase a value by key 272: 273: + `Dict::keys` *d* - dictionary keys as list 274: 275: + `Dict::size` *d* - size of the dictionary 276: 277: ## regex 278: 279: The 'regex' module defines operations on regular expressions. 280: 281: + `Regex::compile` *s0* - compile text to a pattern 282: 283: + `Regex::match` *pat s0* - true if the pattern matches the entire string 284: 285: + `Regex::look_at` *pat s0* - true if the pattern matches the start of string 286: 287: + `Regex::look_match` *pat s0* - the initial matched part of the string 288: 289: + `Regex::split` *pat s0* - split a text according to a pattern 290: 291: + `Regex::matches` *pat s0* - a list of pattern matches in a string 292: 293: + `Regex::replace` *pat s0 s1* - replace the first occurence of a pattern 294: 295: + `Regex::replace_all` *pat s0 s1* - replace all occurences of a pattern 296: 297: + `Regex::group` *pat s0* - the matched groups in a string 298: 299: ## os 300: 301: The 'os' module defines basic input/output combinators. 302: 303: + `OS::cin` - standard input channel 304: 305: + `OS::stdout` - standard output channel 306: 307: + `OS::stderr` - standard error channel 308: 309: + `OS::open_in` *fn* - create a channel from filename 310: 311: + `OS::open_out` *fn* - create a channel from filename 312: 313: + `OS::close` *c* - close a channel 314: 315: + `OS::read` *c* - read a string from a channel 316: 317: + `OS::read_byte` *c* - read a byte from a channel 318: 319: + `OS::read_line` *c* - read a line from a channel 320: 321: + `OS::read_all` *c* - read entire channel content 322: 323: + `OS::write` *c s* - write a string to a channel 324: 325: + `OS::write_byte` *c b* - write a byte to a channel 326: 327: + `OS::write_line` *c s* - write a string s to a channel 328: 329: + `OS::flush` *c* - flush a channel 330: 331: + `OS::eof` *c* - tests if there is no more input 332: 333: + `OS::flock` *f n* - create a filesystem lock file (not process safe) 334: 335: + `OS::exit` *n* - flush all channels and terminate process with exit code n 336: 337: + `OS::exec` *c* - system exec command 338: 339: + `OS::get_key` - key press from console 340: 341: ## fs 342: 343: The 'fs' module defines file system inspection and modification combinators. 344: 345: + `OS::concat` *p0 p1* - concatenates two paths 346: 347: + `OS::concat_with` *p0 p1* - concatenates two paths with a directory separator 348: 349: + `OS::empty` *p* - checks whether the path is empty 350: 351: + `OS::has_root_path` *p* - checks whether the path has a root path 352: 353: + `OS::has_root_name` *p* - checks whether path has a root name 354: 355: + `OS::has_root_directory` *p* - checks whether the path has a root directory 356: 357: + `OS::has_relative_path` *p* - checks whether the path has a relative path 358: 359: + `OS::has_parent_path` *p* - checks whether the path has a parent path 360: 361: + `OS::has_filename` *p* - checks whether the path has a filename 362: 363: + `OS::has_stem` *p* - checks whether the path has a stem 364: 365: + `OS::has_extension` *p* - checks whether the path has an extension 366: 367: + `OS::is_absolute` *p* - checks whether the path is absolute 368: 369: + `OS::is_relative` *p* - checks whether the path is relative 370: 371: + `OS::root_name` *p* - returns the root-name of the path, if present 372: 373: + `OS::root_directory` *p* - returns the root directory of the path, if present 374: 375: + `OS::root_path` *p* - returns the root path of the path, if present 376: 377: + `OS::relative_path` *p* - returns path relative to the root path 378: 379: + `OS::parent_path` *p* - returns the path of the parent path 380: 381: + `OS::filename` *p* - returns the filename path component 382: 383: + `OS::stem` *p* - returns the stem path component 384: 385: + `OS::extension` *p* - returns the file extension path component 386: 387: + `OS::absolute` *p* - composes an absolute path 388: 389: + `OS::copy` *src dst* - copies files or directories 390: 391: + `OS::copy_file` *src dst* - copies file contents 392: 393: + `OS::copy_symlink` *src trg* - copies a symbolic link 394: 395: + `OS::create_directory` *p* - creates new directory 396: 397: + `OS::create_directories` *p* - creates new directories 398: 399: + `OS::create_hard_link` *p0 p1* - creates a hard link 400: 401: + `OS::create_symlink` *p0 p1* - creates a symbolic link 402: 403: + `OS::create_directory_symlink` *p0 p1* - creates a symbolic link 404: 405: + `OS::current_path` - returns the current working directory 406: 407: + `OS::set_current_path` *p* - sets the current working directory 408: 409: + `OS::exists` *p* - checks whether path refers to existing file system object 410: 411: + `OS::equivalent` *p0 p1* - checks whether two paths refer to the same file 412: 413: + `OS::file_size` *p* - returns the size of a file 414: 415: + `OS::hard_link_count` *p* - returns the number of hard links 416: 417: + `OS::permissions` *p* - get file access permissions 418: 419: + `OS::replace_permissions` *p n* - set file access permissions 420: 421: + `OS::read_symlink` *p* - obtains the target of a symbolic link 422: 423: + `OS::remove_file` *p* - removes a file or empty directory 424: 425: + `OS::remove_all` *p* - removes a file or directory and all its contents 426: 427: + `OS::rename` *p0 p1* - moves or renames a file or directory 428: 429: + `OS::resize_file` *p n* - changes the size of a regular file 430: 431: + `OS::space_free` *p* - determines free space on the file system 432: 433: + `OS::space_capacity` *p* - determines capacity space on the file system 434: 435: + `OS::space_available` *p* - determines available space on the file system 436: 437: + `OS::temp_directory_path` - returns a directory suitable for temporary files 438: 439: + `OS::is_block_file` *p* - checks whether the given path refers to block device 440: 441: + `OS::is_character_file` *p* - the given path refers to a character device 442: 443: + `OS::is_directory` *p* - checks whether the given path refers to a directory 444: 445: + `OS::is_empty_file` *p* - checks whether the given path refers to an empty file 446: 447: + `OS::is_fifo` *p* - checks whether the given path refers to a named pipe 448: 449: + `OS::is_other` *p* - checks whether the argument refers to an other file 450: 451: + `OS::is_regular_file` *p* - the argument refers to a regular file 452: 453: + `OS::is_socket` *p* - checks whether the argument refers to a named IPC socket 454: 455: + `OS::is_symlink` *p* - checks whether the argument refers to a symbolic link 456: 457: + `OS::directory` *p* - lists the content of a directory 458: 459: ## eval 460: 461: The 'eval' module defines the eval combinator. 462: 463: + `System::eval` *text* - evaluatate the expression in `text` 464: 465: ## runtime 466: 467: The 'runtime' module provides binding to the runtime. 468: 469: + `System::dis` *o* - disassemble a combinator object 470: 471: + `System::asm` *s* - assemble bytecode into a combinator 472: 473: + `System::serialize` *t* - serialize a term to a text 474: 475: + `System::deserialize` *t* - serialize a text to a term 476: 477: + `System::tokenize` *uri s* - use builtin tokenize 478: 479: + `System::docstring` *o* - docstring of a module or combinator 480: 481: + `System::query_modules` - list all modules in the runtime 482: 483: + `System::is_module` *m* - check we have a module 484: 485: + `System::query_module_name` *m* - get the name of the module 486: 487: + `System::query_module_path` *m* - get the path of the module 488: 489: + `System::query_module_imports` *m* - get the imports of the module 490: 491: + `System::query_module_exports` *m* - get the exports of the module 492: 493: + `System::query_module_values` *m* - get the values of the module 494: 495: + `System::is_integer` *o* - test for integer 496: 497: + `System::is_float` *o* - test for float 498: 499: + `System::is_character` *o* - test for character 500: 501: + `System::is_text` *o* - test for text 502: 503: + `System::is_combinator` *o* - test for combinator 504: 505: + `System::is_opaque` *o* - test for opaque value 506: 507: + `System::is_array` *o* - test for array value 508: 509: + `System::is_bytecode` *o* - test for bytecode value 510: 511: + `System::get_array` *o* - array to list 512: 513: + `System::get_bytecode` *o* - get_bytecode 514: 515: + `System::get_bytedata` *o* - get_bytedata 516: 517: + `System::dependencies` *o* - dependencies of term 518: 519: + `System::debug_ptr` *o* - raw pointer to object 520: 521: ## time 522: 523: The 'time' module defines time and date combinators. 524: 525: + `Time::clock` *s* - create a clock object 526: 527: + `Time::now` *c* - current time according to a clock 528: 529: + `Time::is_steady` *c* - is a steady clock 530: 531: + `Time::milliseconds` *n* - a number of milliseconds 532: 533: + `Time::seconds` *n* - a number of seconds 534: 535: + `Time::minutes` *n* - a number of minutes 536: 537: + `Time::hours` *n* - a number of hours 538: 539: + `Time::days` *n* - a number of days 540: 541: + `Time::weeks` *n* - a number of weeks 542: 543: + `Time::months` *n* - a number of months 544: 545: + `Time::years` *n* - a number of years 546: 547: + `Time::local_time` *n* - time point to local date 548: 549: + `Time::gm_time` *n* - time point to gm date 550: 551: + `Time::date_to_time` *n* - date to time point 552: 553: + `Time::date_to_tuple` *n* - date to tuple 554: 555: + `Time::date_from_tuple` *n* - date from tuple 556: 557: ## ffi 558: 559: The 'ffi' module defines c foreign interface combinators. 560: 561: + `FFI::load_library` *s* - load a library 562: 563: + `FFI::function` *l s* - find a function 564: 565: + `FFI::call` *f r x* - call a function 566: 567: + `FFI::malloc` *n* - allocate a number of bytes 568: 569: + `FFI::free` *p* - free memory 570: 571: + `FFI::peek` *p n t* - peek a number of bytes beyond for value of type 572: 573: + `FFI::poke` *p n v* - poke a value a number of bytes beyond pointer 574: 575: + `FFI::to_utf8` *s* - get pointer from text 576: 577: + `FFI::from_utf8` *s* - get text from pointer 578: 579: ## random 580: 581: The 'random' module defines randomization combinators. (Work in progress) 582: 583: + `Math::between` *min max* - a random number between min and max 584: 585: ## prelude.eg 586: 587: The 'prelude' defines often used combinators. 588: 589: 590: + `System::or` *p q* - boolean or 591: 592: + `System::and` *p q* - boolean and 593: 594: + `System::not` *p q* - boolean not 595: 596: + `System::||` *p q* - 'lazy' or 597: 598: + `System::&&` *p q* - 'lazy' and 599: 600: + `System::fix` *f* - fixed point of f 601: 602: + `System::.` *f g* - function composition 603: 604: + `System::|>` *x f* - reverse application 605: 606: + `System::||>` *x f* - reverse application ignoring none 607: 608: + `System::@` *f x* - low binding application 609: 610: + `System::flip` *f x y* - flip two arguments 611: 612: + `System::const` *x* - function that returns a constant 613: 614: + `System::ap` *f g x* - f x (g x) 615: 616: + `System::join` *f x* - f x x 617: 618: + `System::uncurry` *f (x, y)* - uncurry arguments 619: 620: + `System::iter` *n f x* - iterate a function 621: 622: + `System::trace` *n f x* - trace iteration of a function 623: 624: + `System::trace_until` *f g x* - trace until a guard holds 625: 626: + `System::trace_while` *p f x* - trace while a guard holds 627: 628: + `System::while` *f x* - apply f as long as it reduces 629: 630: + `System::iter_fix` *f x* - apply f until a fixed point is reached 631: 632: + `System::iter_while` *p f x* - apply f while a guard holds 633: 634: + `System::swap` *(x,y)* - swap a tuple 635: 636: + `System::proj` *n (x, .., y)* - projection on tuple 637: 638: + `System::proj_update` *n f (x, .., y)* - update on tuple 639: 640: + `System::fst` *(x, y)* - proj1 on tuple 641: 642: + `System::snd` *(x, y)* - proj2 on tuple 643: 644: + `System::dup` *x* - duplicate 645: 646: + `System::abs0` *x* - generic absolute 647: 648: + `System::min0` *x y* - generic minimum 649: 650: + `System::max0` *x y* - generic maximum 651: 652: + `System::**` *x y* - power (temporary) 653: 654: + `System::printf` *s x0 .. xn* - print formatted 655: 656: + `List::singleton` *x* - list with one value 657: 658: + `List::length` *l* - length of a list 659: 660: + `List::foldl` *f z l* - left fold on a list 661: 662: + `List::foldr` *f z l* - right fold on a list 663: 664: + `List::scanl` *f z l* - left scan on a list 665: 666: + `List::reduce` *f l* - reduce on non-empty list 667: 668: + `List::foldl_state` *f s z l* - left fold on a list with a state 669: 670: + `List::foldr_state` *f s z l* - right fold on a list with a state 671: 672: + `List::head` *l* - head of a list 673: 674: + `List::tail` *l* - tail of a list 675: 676: + `List::last` *l* - last of a list 677: 678: + `List::init` *l* - init of a list 679: 680: + `List::inits` *l* - inits of a list 681: 682: + `List::tails` *l* - tails of a list 683: 684: + `List::++` *l0 l1* - concatenation of two lists 685: 686: + `List::postpend` *l e* - postpend an element 687: 688: + `List::map` *f l* - map a function over a list 689: 690: + `List::flatmap` *f l* - map a function producing lists over a list 691: 692: + `List::reverse` *l* - reverse a list 693: 694: + `List::block` *n* - list of number from 0 to n exclusive 695: 696: + `List::repeat` *n x* - list of n x elements 697: 698: + `List::power` *l* - powerset of a list 699: 700: + `List::pairs` *ll0 ll1* - product of two lists 701: 702: + `List::combine` *ll* - all lists that are the product of the members of a list of lists 703: 704: + `List::nth` *n l* - nth element of a list 705: 706: + `List::nth_update` *n f l* - update nth element of a list 707: 708: + `List::index` *x xx* - index of a member in list 709: 710: + `List::insert` *n x l* - insert an element at given position 711: 712: + `List::take` *n l* - take the first elements of a list 713: 714: + `List::drop` *n l* - drop the first elements of a list 715: 716: + `List::split_at` *n l* - take and drop the first elements of a list 717: 718: + `List::chunks` *n l* - list to list of chunks of given size 719: 720: + `List::from_to` *l u* - list of numbers for lower to upper (inclusive) 721: 722: + `List::filter` *p l* - filter all members from a list which satisfy a predicate 723: 724: + `List::split` *p l* - split a list into members and non-members of a predicate 725: 726: + `List::span` *p l* - split a list where the first segment satisfies a predicate 727: 728: + `List::break` *p l* - split a list in two parts 729: 730: + `List::split_on` *x ll* - split a list on a member 731: 732: + `List::flatten` *ll* - flatten a list of lists to a list 733: 734: + `List::zip` *l0 l1* - zip two lists to a list of pairs 735: 736: + `List::zip_with` *f l0 l1* - apply a function pairwise to members of two lists 737: 738: + `List::transpose` *ll* - transpose a list of lists 739: 740: + `List::any` *p l* - checks whether any element of a list satisfies a predicate 741: 742: + `List::all` *p l* - checks whether all elements of a list satisfies a predicate 743: 744: + `List::elem` *x l* - membership test 745: 746: + `List::not_elem` *x l* - inverse membership test 747: 748: + `List::union` *l0 l1* - union of two lists (nˆ2 complexity) 749: 750: + `List::intersection` *l0 l1* - intersection of two lists (nˆ2 complexity) 751: 752: + `List::difference` *l0 l1* - intersection of two lists (nˆ2 complexity) 753: 754: + `List::insert_everywhere` *x l* - insert a member in every position of a list 755: 756: + `List::permutations` *l* - all permutations of a list 757: 758: + `List::sort` *l* - merge sort 759: 760: + `List::sort_by` *f l* - merge sort with an order operator 761: 762: + `List::nub` *l* - remove consecutive duplicates 763: 764: + `List::group` - group duplicates 765: 766: + `List::unique` *l* - make all members unique 767: 768: + `List::sum` *l* - summation of list 769: 770: + `List::product` *l* - product of list 771: 772: + `List::maximum` *l* - maximum of list 773: 774: + `List::minimum` *l* - minimum of list 775: 776: + `List::range` *l f* - iterate over elements (reverse map 777: 778: + `List::range2` *l0 l1 f* - iterate over elements of two lists 779: 780: + `List::range3` *l0 l1 l2 f* - iterate over elements of three lists 781: 782: + `System::args` - arguments of the application 783: 784: + `String::split` *n s* - split a string 785: 786: + `String::split_pattern` *p s* - split a string 787: 788: + `System::succ` *xx* - generic multidimensional succ 789: 790: + `System::add` *xx yy* - generic multidimensional add 791: 792: + `System::mul` *xx yy* - generic multidimensional mul 793: 794: + `System::sub` *xx yy* - generic multidimensional sub 795: 796: + `Math::lift_unary` *f* - lift a unary function on floats to ints 797: 798: + `Math::lift_binary` *f* - lift a binary function on floats to ints 799: 800: + `Math::pow_int` *n0 n1* - power of two integer values 801: 802: + `String::memo` *d f x* - memoize with a dictionary 803: 804: + `Dict::from_list` *l* - create a dictionary from key/value pairs 805: 806: + `Dict::to_list` *d* - create a list of key/value pairs from a dictionary 807: 808: + `Dict::values` *d* - create a list of values a dictionary 809: 810: + `Dict::set_with` *d f k v* - set a value with a function 811: 812: + `Dict::get_with_default` *v d k* - get a value from a dictionary with a default element 813: 814: + `Dict::copy` *d* - create a copy of a dictionary 815: 816: + `Dict::copy` *d k v* - change an entry when key is present 817: 818: + `Dict::adjust` *d k f* - apply a function to a value in the dictionary 819: 820: + `Dict::dmap` *f d* - map a function to all values of a dictionary 821: 822: + `Dict::merge_dicts` *d0 d1* - produce the merger of two dictionaries 823: 824: + `Dict::count` *ll* - count the values in a list 825: 826: + `Dict::invert` *d0 d1* - produce the merger of two dictionaries 827: 828: + `Dict::inverse` *d* - produce the inverse of a dictionary, values map to multiple keys 829: 830: + `Dict::inner_join` *d0 d1* - inner join on keys 831: 832: + `Dict::from_lists` *lll* - create dictionary from arbitrarily nested lists 833: 834: + `OS::read_lines` *c* - read all lines from a channel 835: 836: + `System::help_exact_matches` *s* - return a list of exact docstring matches 837: 838: + `System::help_inexact_matches` *s* - return a list of inexact docstring matches 839: 840: + `System::help` - search for information 841: 842: ## calculate.eg 843: 844: Calculations are small abstractions where some computation is done 845: modulo some state. 846: 847: All calculations are chained actions. An action is a function which 848: gets as an arguments a state and returns a tuple of a result and a 849: state. 850: 851: 852: + `Calculate::return` *a* - calculate further with value 853: 854: + `Calculate::chain` *f g* - chain two calculations 855: 856: + `Calculate::run` *f s* - run calculation on state 857: 858: + `Calculate::<*` *f g* - chain 859: 860: + `Calculate::skip` - return a none 861: 862: + `Calculate::apply` *f g* - apply a function to a calculation 863: 864: + `Calculate::modify` *f g* - modify state 865: 866: + `Calculate::<@` *f g* - apply 867: 868: + `Calculate::<+` *f g* - modify 869: 870: ## search.eg 871: 872: Searching is calculation over a state, minimalist theory. 873: 874: + `Search::success` *a* - succeed with value a 875: 876: + `Search::fail` - fail an alternative 877: 878: + `Search::raise` - fail all alternatives 879: 880: + `Search::message` *m* - fail or raise with message 881: 882: + `Search::parallel` *p q* - try both alternatives 883: 884: + `Search::sequential` - try alternatives sequentially 885: 886: + `Search::serial` *p q* - try alternative, then force the next 887: 888: + `Search::apply` *p f* - apply to the argument being calculated 889: 890: + `Search::opt` *p v* - optionally succeed with a value 891: 892: + `Search::serial_opt` *p q* - optionally succeed with value 893: 894: + `Search::<+>` *p q* - try both alternatives 895: 896: + `Search::<->` *p q* - try composition of alternatives 897: 898: + `Search::<**>` *p q* - try alternative then force 899: 900: + `Search::</>` *p q* - try alternative then optionally 901: 902: + `Search::<@>` *p f* - apply function to the result 903: 904: + `Search::<!>` *p m* - set the failure message 905: 906: + `Search::one` *p* - one time and return a singleton result 907: 908: + `Search::plus` *p* - one or more and return a list result 909: 910: + `Search::star` *p* - zero or more and return a list result 911: 912: + `Search::plus_sep` *p s* - one or more with separator 913: 914: + `Search::star_sep` *p s* - zero or more with separator 915: 916: + `Search::search` *p f t e s* - search on state with three handlers 917: 918: ## generator.eg 919: 920: Generators model infinite list structures. 921: 922: + `Gen::to_list` *g* - generator to list 923: 924: + `Gen::from_list` *l* - list to generator 925: 926: + `Gen::length` *l* - length of a list 927: 928: + `Gen::foldl` *f z l* - left fold on a list 929: 930: + `Gen::foldr` *f z l* - right fold on a list 931: 932: + `Gen::head` *l* - head of a list 933: 934: + `Gen::tail` *l* - tail of a list 935: 936: + `Gen::++` *l0 l1* - concatenation of two lists 937: 938: + `Gen::map` *f l* - map a function over a list 939: 940: + `Gen::reverse` *l* - reverse a list 941: 942: + `Gen::block` *n* - list of number from lower to upper exclusive 943: 944: + `Gen::nth` *n l* - nth element of a list 945: 946: + `Gen::insert` *n x l* - insert an element at given position 947: 948: + `Gen::take` *n l* - take the first elements of a list 949: 950: + `Gen::drop` *n l* - drop the first elements of a list 951: 952: + `Gen::repeat` *n* - infinite list of elements 953: 954: + `Gen::cycle` *l* - infinite list of cycling list 955: 956: + `Gen::from` *min* - list of numbers from min 957: 958: + `Gen::from_to` *min max* - list of numbers for min to max (exclusive) 959: 960: + `Gen::filter` *p l* - filter all members from a list which satisfy a predicate 961: 962: + `Gen::flatten` *ll* - flatten a list of lists to a list 963: 964: + `Gen::zip` *l0 l1* - zip to lists to a list of pairs 965: 966: + `Gen::zip_with` *f l0 l1* - apply a function pairwise to members of two lists 967: 968: + `Gen::any` *p l* - checks whether any element of a list satisfies a predicate 969: 970: + `Gen::all` *p l* - checks whether all elements of a list satisfies a predicate 971: 972: + `Gen::elem` *x l* - membership test 973: 974: + `Gen::not_elem` *x l* - inverse membership test 975: 976: + `Gen::from_lists` *l* - convert a list of lists to generator of generators 977: 978: + `Gen::to_lists` *c* - convert generator of generators to list of lists 979: 980: + `Gen::space` - space, the final frontier 981: 982: + `Gen::map_2d` - map on a space 983: 984: + `Gen::take_2d` - take a block 985: 986: + `Gen::range` *l f* - iterate over elements (reverse map 987: 988: + `Gen::range2` *l0 l1 f* - iterate over elements of two lists 989: 990: + `Gen::range3` *l0 l1 l2 f* - iterate over elements of three lists 991: 992: