Fractal++
Key Features
- Elegant and expressive syntax
- Powerful built-in functions
- Support for functional programming paradigms
- Efficient memory management
- Seamless integration with existing libraries
Code Examples
Basic Structure
# Import module
<^> ::= import io
# Define constant
<#> ::= "Fractal++ is the best language!"
# Define print function
<$> ::= (msg) => {
io.console(msg)
}
# Main program
<&> ::= {
let message = <#>
<$>(message)
}
# Call main
<%> ::= () => <&>
<^>
<%>()
This code demonstrates the basic structure of a Fractal++ program, including module imports, constant definitions, function definitions, and the main program structure.
Function Reference
- <^> : Import a module Used to import external modules into your Fractal++ program
- <#> : Define a constant value Declares an immutable value that cannot be changed during program execution
- <$> : Define a function for printing Creates a function specifically for outputting data to the console
- <&> : Define the main program Specifies the entry point and main logic of your Fractal++ program
- <%> : Call the main program Executes the main program defined by <&>
- <!> : Define a factorial function Shorthand for creating a function to calculate factorials
- <@> : Define a recursive function Creates a function that calls itself, useful for solving problems that can be broken down into smaller, similar sub-problems
- <~> : Define a higher-order function Creates a function that can accept other functions as arguments or return them
- <*> : Define a generator function Creates a function that can be paused and resumed, yielding multiple values over time
- <+> : Define an asynchronous function Creates a function that operates asynchronously, allowing other code to run while waiting for an operation to complete
- <_> : Define a function with default parameters Creates a function where some parameters have predefined values if not provided
- <%!> : Define a memoized function Creates a function that caches its results, improving performance for expensive operations
- <$@> : Define a curried function Creates a function that can be partially applied, allowing you to create new functions with some arguments pre-set
- <!$> : Define a function with rest parameters Creates a function that can accept an indefinite number of arguments as an array
- <@!> : Define a function with pattern matching Creates a function that can have different behaviors based on the pattern of its input
- <%*> : Define a function with spread operator Creates a function that can expand an array into individual elements
- <+@> : Define a function with async/await Creates an asynchronous function that can pause execution until a Promise is resolved
- <_!> : Define a function with optional chaining Creates a function that can safely access nested object properties, even if an intermediate property doesn't exist