P-lang is a project mainly written in Ruby, based on the MIT license.
P Programming Language
= P-Lang
P is a small ('pequena' in portuguese) functional programming language.
fib = [1| 1]; [2| 1]; [n| fib(n-1) + fib(n-2)]
fib(10)
= Features
Functions:
fib = [1| 1]; [2| 1]; [n| fib(n-1) + fib(n-2)]
fib(10) # => 55
fib = [1|1] fib = [2|1] fib = [n|fib(n-1)+fib(n-2)]
fib(10) # => 55
And more functions:
f = [x| x*pi] : (pi = 3.14)
f(1) # => 3.14
Wildcards
f = [1, _, x| x*2]
f(1,'aaaaa', 10) # => 20
Lists:
x = '(1,2,3,4) x->head() # => 1 x->tail() # => '(2,3,4)
Objects:
{rectangle: 10, 30}
Pattern:
{rectangle: x, y} = {rectangle: 10, 30}
Messages:
{integer: x} -> plus2 = [x+2]
3->plus2() # => 5
IO:
x = read() # <= 123 print(x) # => 123
== Requirements
== Install
$ sudo gem install p-lang
== Running
$ p-lang your-program.p
== Interactive P Shell
$ p-lang
== Note on Patches/Pull Requests
== Copyright
Copyright (c) 2010 Ígor Bonadio. See LICENSE for details.