All Projects → trizen → sidef

trizen / sidef

Licence: Artistic-2.0 license
A modern object-oriented programming language implemented in Perl.

Programming Languages

perl
6916 projects
ruby
36898 projects - #4 most used programming language
shell
77523 projects
julia
2034 projects
Raku
181 projects
lua
6591 projects

Projects that are alternatives of or similar to sidef

BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (-63.3%)
Mutual labels:  transpiler, object-oriented
foolang
A toy programming language.
Stars: ✭ 33 (-69.72%)
Mutual labels:  transpiler, object-oriented
Ensembler
Ensembler is a python package that provides fast and easy access to 1D and 2D model system simulations. It can be used for method development or to deepen understanding of a broad spectrum of modeling methods, from basic sampling techniques to enhanced sampling and free energy calculations. It is easy to install, fast, increases shareability, co…
Stars: ✭ 42 (-61.47%)
Mutual labels:  object-oriented
kithon
Python to any languages transpiler
Stars: ✭ 33 (-69.72%)
Mutual labels:  transpiler
CFortranTranslator
A translator from Fortran to C++. We provide statement-wise translation to improve readability.
Stars: ✭ 81 (-25.69%)
Mutual labels:  transpiler
vix
VMware VIX API binding for Python
Stars: ✭ 31 (-71.56%)
Mutual labels:  object-oriented
transpiler
ABAP to JS transpiler
Stars: ✭ 57 (-47.71%)
Mutual labels:  transpiler
clava
C/C++ Source-to-Source Tool based on Clang
Stars: ✭ 55 (-49.54%)
Mutual labels:  transpiler
Craxe
Haxe to nim transpiler
Stars: ✭ 39 (-64.22%)
Mutual labels:  transpiler
bfpile
Optimizing Brainfuck compiler, transpiler and interpreter
Stars: ✭ 19 (-82.57%)
Mutual labels:  transpiler
Py2Jl.jl
Python to Julia transpiler.
Stars: ✭ 67 (-38.53%)
Mutual labels:  transpiler
phptojs
PHP-to-JavaScript transpiler
Stars: ✭ 29 (-73.39%)
Mutual labels:  transpiler
yahdl
A programming language for FPGAs.
Stars: ✭ 20 (-81.65%)
Mutual labels:  transpiler
cotowali
A statically typed scripting language that transpile into POSIX sh
Stars: ✭ 551 (+405.5%)
Mutual labels:  transpiler
ABAP-Library
Useful ABAP code snippets
Stars: ✭ 118 (+8.26%)
Mutual labels:  object-oriented
jazzle
An Innovative, Fast Transpiler for ECMAScript 2015 and later
Stars: ✭ 65 (-40.37%)
Mutual labels:  transpiler
MTools
Object Oriented Programming in Mathematica 10+
Stars: ✭ 25 (-77.06%)
Mutual labels:  object-oriented
Gloa
Glóa - a statically typed language that compiles to Lua. *UNDER DEVELOPMENT*
Stars: ✭ 19 (-82.57%)
Mutual labels:  transpiler
ekzo
💫 Functional Sass framework for rapid and painless development
Stars: ✭ 32 (-70.64%)
Mutual labels:  object-oriented
core.horse64.org
THIS IS A MIRROR, CHECK https://codeberg.org/Horse64/core.horse64.org
Stars: ✭ 3 (-97.25%)
Mutual labels:  object-oriented

The Sidef Programming Language

Sidef is a modern, high-level, general-purpose programming language, inspired by Ruby, Raku and Julia.

            **   **         ****   *           *********   *********
          * * ** * *        ****   **          ** ** **    ** ** **
           **   **          ****   ***         *********   *  *  *
  **        **        **    ****   *  *        ******      ******
* * *     * * *     * * *   ****   ** **       ** **       ** **
 **        **        **     ****   ******      ******      *  *
       **   **              ****   *  *  *     *********   ***
     * * ** * *             ****   ** ** **    ** ** **    **
      **   **               ****   *********   *********   *
  • The main features of Sidef include:

    • object-oriented programming
    • functional programming
    • functional pattern matching
    • optional lazy evaluation
    • multiple dispatch
    • lexical scoping
    • lexical closures
    • keyword arguments
    • regular expressions
    • support for using Perl modules
    • optional dynamic type checking
    • big integers, rationals, floats and complex numbers

WWW

Q&A

Need help with Sidef? Feel free to ask questions here: https://github.com/trizen/sidef/discussions/categories/q-a

EXAMPLES

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]

Approximation of the gamma function:

define  = Num.e
define τ = Num.tau

func Γ(x, r=50) {
    x < r ? (__FUNC__(x+1, r) / x)
          : (sqrt(τ*x) * pow(x/ + 1/(12**x), x) / x)
}

for i in (1..10) {
    say ("%.14f" % Γ(i/3))
}

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)

Output:

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

ASCII generation 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"
}

Output:


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

More examples

INTERACTIVE MODE

sidef

TRY IT ONLINE

AVAILABILITY

LICENSE AND COPYRIGHT

  • Copyright (C) 2013-2022 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). You may obtain a copy of the full license at:

https://www.perlfoundation.org/artistic-license-20.html

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].