Thanks to visit codestin.com
Credit goes to github.com

Skip to content

trizen/sidef

Repository files navigation

The Sidef Programming Language

            **   **         ****   *           *********   *********
          * * ** * *        ****   **          ** ** **    ** ** **
           **   **          ****   ***         *********   *  *  *
  **        **        **    ****   *  *        ******      ******
* * *     * * *     * * *   ****   ** **       ** **       ** **
 **        **        **     ****   ******      ******      *  *
       **   **              ****   *  *  *     *********   ***
     * * ** * *             ****   ** ** **    ** ** **    **
      **   **               ****   *********   *********   *

A modern, high-level programming language for versatile general-purpose applications

WebsiteTutorialDocumentationTry OnlineDiscussions

CPAN License


🌟 Overview

Sidef is a modern, expressive programming language that combines the elegance of Ruby, the versatility of Raku, and the mathematical capabilities of Julia. Designed for both beginners and advanced programmers, Sidef offers a rich feature set for diverse programming paradigms.

✨ Key Features

Programming Paradigms

  • Object-oriented programming
  • Functional programming
  • Functional pattern matching
  • Multiple dispatch

Language Features

  • Optional lazy evaluation
  • Lexical scoping & closures
  • Keyword arguments
  • Regular expressions

Integration & Performance

  • Seamless Perl module integration
  • Optional dynamic type checking
  • Efficient execution model

Numeric Computing

  • Big integers
  • Rational numbers
  • Arbitrary precision floats
  • Complex numbers

🚀 Quick Start

Installation

Via CPAN:

cpan Sidef

Platform-specific:

Hello World

say "Hello, World!"

Try It Online

Experiment with Sidef instantly at Try It Online without any installation.

📚 Documentation & Learning Resources

Tutorials

Reference Materials

💬 Community & Support

Have questions or need help? Join the conversation:

🎯 Code Examples

The Y Combinator

Demonstrating functional programming with the Y combinator:

var y = ->(f) {->(g) {g(g)}(->(g) { f(->(*args) {g(g)(args...)})})}

var fac = ->(f) { ->(n) { n < 2 ? 1 : (n * f(n-1)) } }
say 10.of { |i| y(fac)(i) }     #=> [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880]

var fib = ->(f) { ->(n) { n < 2 ? n : (f(n-2) + f(n-1)) } }
say 10.of { |i| y(fib)(i) }     #=> [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

Sierpinski Triangle

ASCII generation of the Sierpinski triangle:

func sierpinski_triangle(n) {
    var triangle = ['*']
    { |i|
        var sp = (' ' * 2**i)
        triangle = (triangle.map {|x| sp + x + sp} +
                    triangle.map {|x| x + ' ' + x})
    } * n
    triangle.join("\n")
}

say sierpinski_triangle(4)
Show Output
               *
              * *
             *   *
            * * * *
           *       *
          * *     * *
         *   *   *   *
        * * * * * * * *
       *               *
      * *             * *
     *   *           *   *
    * * * *         * * * *
   *       *       *       *
  * *     * *     * *     * *
 *   *   *   *   *   *   *   *
* * * * * * * * * * * * * * * *

Mandelbrot Set

ASCII visualization of the Mandelbrot set:

func mandelbrot(z, r=20) {
    var c = z
    r.times {
        z = (z*z + c)
        return true if (z.abs > 2)
    }
    return false
}

for y in (1 `downto` -1 `by` 0.05) {
    for x in (-2 `upto` 0.5 `by` 0.0315) {
        print(mandelbrot(Complex(x, y)) ? ' ' : '#')
    }
    print "\n"
}
Show Output

                                                            #
                                                        #  ###  #
                                                        ########
                                                       #########
                                                         ######
                                             ##    ## ############  #
                                              ### ###################      #
                                              #############################
                                              ############################
                                          ################################
                                           ################################
                                         #################################### #
                          #     #        ###################################
                          ###########    ###################################
                           ###########   #####################################
                         ############## ####################################
                        ####################################################
                     ######################################################
#########################################################################
                     ######################################################
                        ####################################################
                         ############## ####################################
                           ###########   #####################################
                          ###########    ###################################
                          #     #        ###################################
                                         #################################### #
                                           ################################
                                          ################################
                                              ############################
                                              #############################
                                              ### ###################      #
                                             ##    ## ############  #
                                                         ######
                                                       #########
                                                        ########
                                                        #  ###  #
                                                            #

More Examples

Explore an extensive collection of Sidef programs at github.com/trizen/sidef-scripts

🖥️ Interactive Mode

Sidef includes a REPL (Read-Eval-Print Loop) for interactive programming:

Sidef Interactive Mode

📦 Distribution Availability

Platform Package Link
CPAN Sidef metacpan.org
Package Search Multiple distributions pkgs.org
Arch Linux sidef (AUR) AUR Package
Slackware perl-Sidef SlackBuilds.org

🤝 Contributing

Contributions are welcome! Whether it's:

  • Reporting bugs
  • Suggesting new features
  • Improving documentation
  • Submitting pull requests

Please visit the GitHub repository to get involved.

📄 License and Copyright

Copyright © 2013-2025 Daniel Șuteu, Ioana Fălcușan

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License (2.0).

Full license: perlfoundation.org/artistic-license-20.html

Key License Points

  • Use, modification, and distribution governed by the Artistic License
  • Modified versions must comply with license requirements
  • No trademark or logo usage rights granted
  • Includes patent license for necessary claims
  • Patent litigation terminates license

Warranty Disclaimer: THE PACKAGE IS PROVIDED "AS IS" WITHOUT WARRANTIES OF ANY KIND. See full license for details.


Made with ❤️ by the Sidef community

⭐ Star us on GitHub📖 Read the docs💬 Join discussions

About

A modern object-oriented programming language implemented in Perl.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors 5