Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idioms

These are examples taken from programming-idioms.org and ported to Fuzion:

Programming Idioms

Idiom # 1: Print Hello World Idiom # 2: Print Hello 10 times Idiom # 3: Create a procedure Idiom # 4: Create a function which returns the square of an integer Idiom # 5: Create a 2D Point data structure Idiom # 6: Iterate over list values Idiom # 7: Iterate over list indexes and values Idiom # 8: Initialize a new map (associative array) Idiom # 9: Create a Binary Tree data structure Idiom # 10: Shuffle a list Idiom # 11: Pick a random element from a list Idiom # 12: Check if list contains a value Idiom # 13: Iterate over map keys and values Idiom # 14: Pick uniformly a random floating point number in [a..b) Idiom # 15: Pick uniformly a random integer in [a..b] Idiom # 16: Depth-first traversing of a binary tree Idiom # 17: Create a Tree data structure Idiom # 18: Depth-first traversing of a tree Idiom # 19: Reverse a list Idiom # 20: Return two values Idiom # 21: Swap values Idiom # 22: Convert string to integer Idiom # 23: Convert real number to string with 2 decimal places Idiom # 24: Assign to string the japanese word ネコ NYI: Idiom # 25: Send a value to another thread Idiom # 26: Create a 2-dimensional array Idiom # 27: Create a 3-dimensional array Idiom # 28: Sort by a property Idiom # 29: Remove item from list, by its index Idiom # 30: Parallelize execution of 1000 independent tasks Idiom # 31: Recursive factorial (simple) Idiom # 32: Integer exponentiation by squaring Idiom # 33: Atomically read and update variable Idiom # 34: Create a Set of objects Idiom # 35: First-class function : compose Idiom # 36: First-class function : generic composition Idiom # 37: Currying Idiom # 38: Extract a substring Idiom # 39: Check if string contains a word Idiom # 40: Graph with adjacency lists Idiom # 41: Reverse a string Idiom # 42: Continue outer loop Idiom # 43: Break outer loop Idiom # 44: Insert element in list Idiom # 45: Pause execution for 5 seconds Idiom # 46: Extract beginning of string (prefix) Idiom # 47: Extract string suffix Idiom # 48: Multi-line string literal Idiom # 49: Split a space-separated string Idiom # 50: Make an infinite loop Idiom # 51: Check if map contains key Idiom # 52: Check if map contains value Idiom # 53: Join a list of strings Idiom # 54: Compute sum of integers Idiom # 55: Convert integer to string Idiom # 56: Launch 1000 parallel tasks and wait for completion Idiom # 57: Filter list Idiom # 58: Extract file content to a string Idiom # 59: Write to standard error stream Idiom # 60: Read command line argument Idiom # 61: Get current date Idiom # 62: Find substring position Idiom # 63: Replace fragment of a string Idiom # 64: Big integer : value 3 power 247 Idiom # 65: Format decimal number Idiom # 66: Big integer exponentiation Idiom # 67: Binomial coefficient n choose k Idiom # 68: Create a bitset Idiom # 69: Seed random generator Idiom # 70: Use clock as random generator seed Idiom # 71: Echo program implementation Idiom # 73: Create a factory Idiom # 74: Compute GCD Idiom # 75: Compute LCM Idiom # 76: Binary digits from an integer Idiom # 77: Complex number Idiom # 78: do while loop Idiom # 79: Convert integer to floating point number Idiom # 80: Truncate floating point number to integer Idiom # 81: Round floating point number to integer Idiom # 82: Count substring occurrences NYI: Idiom # 83: Regex with character repetition Idiom # 84: Count bits set in integer binary representation Idiom # 85: Check if integer addition will overflow Idiom # 86: Check if integer multiplication will overflow Idiom # 87: Stop program Idiom # 88: Allocate 1M bytes Idiom # 89: Handle invalid argument Idiom # 90: Read-only outside NYI: Idiom # 91: Load JSON file into struct NYI: Idiom # 92: Save object into JSON file Idiom # 93: Pass a runnable procedure as parameter Idiom # 94: Print type of variable Idiom # 95: Get file size Idiom # 96: Check string prefix Idiom # 97: Check string suffix Idiom # 98: Epoch seconds to date object Idiom # 99: Format date YYYY-MM-DD Idiom # 100: Sort by a comparator NYI: Idiom # 101: Load from HTTP GET request into a string NYI: Idiom # 102: Load from HTTP GET request into a file NYI: Idiom # 103: Load XML file into struct NYI: Idiom # 104: Save object into XML file Idiom # 105: Current executable name Idiom # 106: Get program working directory Idiom # 107: Get folder containing current program Idiom # 108: Determine if variable name is defined NYI: Idiom # 109: Number of bytes of a type Idiom # 110: Check if string is blank NYI: Idiom # 111: Launch other program Idiom # 112: Iterate over map entries, ordered by keys Idiom # 113: Iterate over map entries, ordered by values Idiom # 114: Test deep equality Idiom # 115: Compare dates Idiom # 116: Remove occurrences of word from string Idiom # 117: Get list size Idiom # 118: List to set Idiom # 119: Deduplicate list Idiom # 120: Read integer from stdin NYI: Idiom # 121: UDP listen and read Idiom # 122: Declare enumeration Idiom # 123: Assert condition Idiom # 124: Binary search for a value in sorted array Idiom # 125: Measure function call duration Idiom # 126: Multiple return values Idiom # 127: Source code inclusion Idiom # 128: Breadth-first traversing of a tree Idiom # 129: Breadth-first traversing in a graph Idiom # 130: Depth-first traversing in a graph Idiom # 131: Successive conditions Idiom # 132: Measure duration of procedure execution Idiom # 133: Case-insensitive string contains Idiom # 134: Create a new list Idiom # 135: Remove item from list, by its value Idiom # 136: Remove all occurrences of a value from a list Idiom # 137: Check if string contains only digits NYI: Idiom # 138: Create temp file NYI: Idiom # 139: Create temp directory NYI: Idiom # 140: Delete map entry Idiom # 141: Iterate in sequence over two lists Idiom # 142: Hexadecimal digits of an integer Idiom # 143: Iterate alternatively over two lists Idiom # 144: Check if file exists NYI: Idiom # 145: Print log line with datetime NYI: Idiom # 146: Convert string to floating point number Idiom # 147: Remove all non-ASCII characters Idiom # 148: Read list of integer numbers from stdin NYI: Idiom # 149: Rescue the princess Idiom # 150: Remove trailing slash NYI: Idiom # 151: Remove string trailing path separator Idiom # 152: Turn a character into a string Idiom # 153: Concatenate string with integer Idiom # 154: Halfway between two hex color codes Idiom # 155: Delete file Idiom # 156: Format integer with zero-padding Idiom # 157: Declare constant string NYI: Idiom # 158: Random sublist Idiom # 159: Trie NYI: Idiom # 160: Detect if 32-bit or 64-bit architecture Idiom # 161: Multiply all the elements of a list Idiom # 162: Execute procedures depending on options Idiom # 163: Print list elements by group of 2 NYI: Idiom # 164: Open URL in default browser Idiom # 165: Last element of list Idiom # 166: Concatenate two lists Idiom # 167: Trim prefix Idiom # 168: Trim suffix Idiom # 169: String length Idiom # 170: Get map size Idiom # 171: Add an element at the end of a list Idiom # 172: Insert entry in map Idiom # 173: Format a number with grouped thousands NYI: Idiom # 174: Make HTTP POST request Idiom # 175: Bytes to hex string Idiom # 176: Hex string to byte array NYI: Idiom # 177: Find files with a given list of filename extensions Idiom # 178: Check if point is inside rectangle Idiom # 179: Get center of a rectangle NYI: Idiom # 180: List files in directory Idiom # 182: Quine program NYI: Idiom # 183: Make HTTP PUT request NYI: Idiom # 184: Tomorrow Idiom # 185: Execute function in 30 seconds Idiom # 186: Exit program cleanly Idiom # 187: Disjoint Set Idiom # 188: Matrix multiplication Idiom # 189: Filter and transform list NYI: Idiom # 190: Call an external C function Idiom # 191: Check if any value in a list is larger than a limit NYI: Idiom # 192: Declare a real variable with at least 20 digits Idiom # 193: Transpose a two-dimensional matrix Idiom # 194: Circular shift of a two-dimensional array Idiom # 195: Pass a two-dimensional array Idiom # 196: Pass a sub-array Idiom # 197: Get a list of lines from a file Idiom # 198: Abort program execution with error condition NYI: Idiom # 199: Truncate a file at the current file position Idiom # 200: Return hypotenuse Idiom # 201: Euclidean norm Idiom # 202: Sum of squares Idiom # 203: Calculate mean and standard deviation Idiom # 204: Return fraction and exponent of a real number Idiom # 205: Get an environment variable Idiom # 206: Switch statement with strings Idiom # 207: allocate a list that is automatically deallocated Idiom # 208: Formula with arrays Idiom # 209: Type with automatic deep deallocation NYI: Idiom # 210: Compiler version and options Idiom # 211: Create folder Idiom # 212: Check if folder exists Idiom # 213: Case-insensitive string compare Idiom # 214: Pad string on the right Idiom # 215: Pad string on the left Idiom # 216: Pad a string in the center NYI: Idiom # 217: Create a Zip archive Idiom # 218: List intersection Idiom # 219: Replace multiple spaces with single space Idiom # 220: Create a tuple value Idiom # 221: Remove all non-digits characters Idiom # 222: Find first index of an element in list Idiom # 223: for else loop Idiom # 224: Add element to the beginning of the list Idiom # 225: Declare and use an optional argument Idiom # 226: Delete last element from list Idiom # 227: Copy list NYI: Idiom # 228: Copy a file NYI: Idiom # 229: Cancel an operation NYI: Idiom # 230: Timeout Idiom # 231: Test if bytes are a valid UTF-8 string Idiom # 232: Read a command line boolean flag Idiom # 233: Read a command line string flag Idiom # 234: Encode bytes to base64 Idiom # 235: Decode base64 Idiom # 236: Large quotient Idiom # 237: Xor integers Idiom # 238: Xor byte arrays NYI: Idiom # 239: Find first regular expression match Idiom # 240: Sort 2 lists together NYI: Idiom # 241: Yield priority to other threads Idiom # 242: Iterate over a set Idiom # 243: Print list Idiom # 244: Print map Idiom # 245: Print value of custom type Idiom # 246: Count distinct elements Idiom # 247: Filter list in-place Idiom # 248: Construct a 64-bit floating-point value Idiom # 249: Declare and assign multiple variables Idiom # 250: Pick a random value from a map Idiom # 251: Parse binary digits Idiom # 252: Conditional assignment NYI: Idiom # 253: Print stack trace Idiom # 254: Replace value in list Idiom # 255: Print set Idiom # 256: Count backwards Idiom # 257: Traverse list backwards Idiom # 258: Convert list of strings to list of integers Idiom # 259: Split on several separators Idiom # 260: Create an empty list of strings Idiom # 261: Format time hours-minutes-seconds Idiom # 262: Count trailing zero bits Idiom # 263: Integer logarithm in base 2 Idiom # 264: Automated passing of array bounds Idiom # 265: Calculate parity of an integer Idiom # 266: Repeating string Idiom # 267: Pass string to argument that can be of any type Idiom # 268: User-defined operator NYI: Idiom # 269: Enum to String Idiom # 270: Test for quiet or signalling NaN NYI: Idiom # 271: Test for type extension Idiom # 272: Play FizzBuzz NYI: Idiom # 273: Check if folder is empty Idiom # 274: Remove all white space characters Idiom # 275: Binary digits to byte array Idiom # 276: Insert an element in a set NYI: Idiom # 277: Remove an element from a set Idiom # 278: Read one line from the standard input Idiom # 279: Read list of strings from the standard input NYI: Idiom # 280: Filter map NYI: Idiom # 281: Use a Point as a map key NYI: Idiom # 282: Use a custom type as map key Idiom # 283: Split with a custom string separator Idiom # 284: Create a zeroed list of integers Idiom # 285: Set variable to NaN Idiom # 286: Iterate over characters of a string Idiom # 287: Number of bytes of a string Idiom # 288: Check if set contains a value Idiom # 289: Concatenate two strings NYI: Idiom # 290: Sort sublist NYI: Idiom # 291: Remove sublist Idiom # 292: Write "Ni Hao" in Chinese to standard output in UTF-8 NYI: Idiom # 293: Create a stack Idiom # 294: Print a comma-separated list of integers NYI: Idiom # 295: String to Enum Idiom # 296: Replace last occurrence of substring Idiom # 297: Sort a list of strings, case-insensitively NYI: Idiom # 298: Copy a map Idiom # 299: Comment out a single line Idiom # 300: Hy-Brasil Idiom # 301: Recursive Fibonacci sequence Idiom # 302: String interpolation NYI: Idiom # 303: Array with non-default lower bound Idiom # 304: Encode string into UTF-8 bytes Idiom # 305: Calculate exponentiation of real numbers NYI: Idiom # 306: Ensure list capacity NYI: Idiom # 307: XOR encrypt/decrypt string Idiom # 308: Integer to string in base b Idiom # 309: Clone a 2D array Idiom # 310: Fill array with random bytes NYI: Idiom # 311: Deep copy an object Idiom # 312: List equality NYI: Idiom # 313: Map equality Idiom # 314: Fill array with value Idiom # 315: Memoization Idiom # 316: Count occurrences in a list Idiom # 317: Random string NYI: Idiom # 318: Cryptographically secure random number Idiom # 319: Generator function Idiom # 320: Test if string is empty Idiom # 321: Access character in string, by index NYI: Idiom # 322: replace value of variable with new one and return old value NYI: Idiom # 323: Set HTTP request header NYI: Idiom # 324: Read HTTP response header NYI: Idiom # 325: Create a queue NYI: Idiom # 326 Milliseconds since Unix epoch Idiom # 327 Convert string to lower case Idiom # 328 Convert string to upper case Idiom # 329: Read value in a map Idiom # 330 Map to list NYI: Idiom # 331 Clear map Idiom # 332 List of the keys of a map NYI: Idiom # 333 Pretty-print object in JSON NYI: Idiom # 334 Combine 2 maps NYI: Idiom # 335 List to map Idiom # 336: Exponent Idiom # 337 Convert string to integer, explicit base NYI: Idiom # 338 Create a bidirectional map NYI: Idiom # 339 Clear a byte array NYI: Idiom # 340: Last character of string NYI: Idiom # 341 Find substring last position Idiom # 342 Leap year? Idiom # 343 Rename file Idiom # 344 Extract filename extension Idiom # 345 Convert string to big integer Idiom # 346 Repeated list NYI: Idiom # 347 Copy folder NYI: Idiom # 348 Convert a decimal value into a fraction NYI: Idiom # 349 Convert a fraction into a decimal value NYI: Idiom # 350 Create an enumerated collection Idiom # 351 Create a zipped collection NYI: Idiom # 352 Parallelize 3 computations Idiom # 353: Test if list is sorted NYI: Idiom # 354 Increment map entry Idiom # 355 Absolute value Idiom # 356 Parse list of integers NYI: Idiom # 357 Swap elements of list Idiom # 358 Format a value in unit notation Idiom # 359 Euclidean division Idiom # 360 Create a formatted list NYI: Idiom # 361 Test for perfect squarity Idiom # 362: Create delimited list Idiom # 363 Set to list NYI: Idiom # 364 Calculate the magnitude symbol for a value NYI: Idiom # 365 Convert an angle to a direction Idiom # 366 Test for set equality NYI: Idiom # 367 Find the next significant digit NYI: Idiom # 368 Parse a millisecond value NYI: Idiom # 369 Parse matching brackets Idiom # 370 Ordinal form NYI: Idiom # 371 Load YAML file into object

Source: github.com/tokiwa-software/fuzion-idioms

last changed: 2026-07-03