The Falcon Programming Language in a Nutshell
A Falcon script can define classes and instantiate objects from them, create singleton objects (with or without base classes) and apply transversal attributes to the instances. The provides keyword checks for properties being exposed by the instances:
// A class
class Something( initval1, initval2 )
// Simple initialization can be done directly
prop1 = initval1
prop2 = nil
// init takes the parameters of the class
// and performs more complex initialization
init
self.prop2 = initval
> "Initializer of class Something"
end
function showMe()
> "Something says: ", self.prop1, "; ", self.prop2
end
end
// A singleton instance.
object Alone
function whoAmI()
> "I am alone"
end
end
// an instance
instance = Something( "one", "two" )
instance.showMe()
//"Alone" is already an instance
if Alone provides whoAmI
Alone.whoAmI()
end
Falcon has a Basic Object Model (BOM), which is available in all the items. Objects and classes can override some methods. For example, passing an item to the > print operator causes its toString BOM method to be called, and that can be overridden as follows:
object different
function toString()
return "is different..."
end
end
> "the object... ", different
Falcon supports multiple inheritance, but it disambiguates it by forcing inheritance initialization and priority, depending on the order of the inheritance declarations.
Classes also support static members that can be shared between objects of the same class and methods with static blocks that can work as class-wide initializers. Methods can be retrieved and also called directly from classes when they don't need to access the self object, providing the semantic of C++/Java/C# static methods.
It is possible to merge normal procedures with methods by assigning procedures to properties:
function call_me()
if self and self provides my_name
> self.my_name
else
> "Sorry, you didn't call me right."
end
end
object test
prop1 = nil
my_name = "I am a test!"
function hello()
> "Hello world from ", self.my_name
end
end
// normal calls
call_me()
// using the procedure as a method
test.prop1 = call_me
test.prop1()
// or a method as a procedure
proc = test.hello
test.my_name = "a renamed thing"
// see: proc will dynamically use the right "self"
proc()
Attributes are binary properties that can be either present or not present for a specific instance or object, regardless of its class.
Attributes have a great expressive power, and in Falcon, they indicate what an object is, what it has and what it belongs to, depending on the context. For example, we can define a ready attribute that indicates the objects ready for elaboration:
// declaring an attribute "ready"
attributes: ready
class Data( name )
name = name
function process()
> "Processing ", self.name, "..."
end
end
// create 10 processors
processors = []
for i in [0:10]
processors += Data(i)
if i > 5: give ready to processors[i]
end
// work with the ready ones
for d in ready
d.process()
end
RTL provides several functions to manipulate attributes.
The has and hasnt operators check for the presence of an attribute. For example:
attributes: ready class SomeClass //... other class data ... // born ready! has ready end item = SomeClass() if item has ready > "Item was born ready!" end
The base construct of Falcon functional programming is the callable sequence, also known as Sigma. At the moment, the only sequence supported is the array, but other types of sequences (such as lists) should be supported soon.
Basically, a Sigma is a delayed call that can work like this:
function test( a, b, c ) > "Parameters:" > a > b > c end // direct test( "one", "two", "three" ) // indirect cached = [ test, "four", "five", "six" ] cached()
The call respects the procedural paradigm (variable parameters), and the array is still a normal vector that can be accessed and modified through the standard language operators and RTL functions.
This delayed call is still not a full “functional context evaluation”. The proper functional evaluation process is called Sigma reduction. It recursively resolves Sigmas from inner to outer and left to right when they are at the same level, substituting them with their return value.
Special functions known by the VM as Etas start and control functional evaluation; the simplest Eta function is eval(), which initializes and performs a basic Sigma reduction.
For example, the expression “(a+b) * (c+d)” can be written in a Lisp-like sequence:
function add( a, b ): return a+b function mul( a, b ): return a*b > "(2+3)*(4+5)= ", eval(.[mul .[add 2 3] .[add 4 5]])
The .[] notation is shorthand for array declarations whose elements are separated by white space instead of an explicit “,”.
Falcon RTL comes with a rich set of Etas, such as iff (functional if), cascade (which joins more standard calls in a single sequence), floop and times (different styles of functional loops), map, filter, reduce and many others.
Functional sequences can be parameterized through closure and references. For example, the above example can be made parametric in this way:
// add and mul as before... function evaluator( a, b, c, d ) return .[eval .[mul .[add a b] .[add c d]]] end tor = evaluator( 2,3,4,5 ) > "(2+3)*(4+5)= ", tor()
Traditional functional operators, such as map, filter and reduce, are supported, but the out-of-band item system expands their functionality.
Out-of-band items are items marked with a special flag through the oob() function. Although they are normal items in every other aspect, this special mark indicates that they hold unexpected, special or somehow extraordinary value traveling through functional sequences. Although this is not a direct support for monadic calculus, monads can be implemented at the script (or binary module) level through this mechanism.
Falcon also supports Lambda expressions and nested functions.
We currently are working on some extensions to make Sigmas even more configurable—for example, parameter naming (similar to Lisp field naming) and access from the outside to the unbound variables used in the sequence.
Falcon functional programming merges with OOP, as Sigmas can be set as object properties, and object methods can be used as Kappas (Sigma-callable header symbols):
object SomeObj
a_property = 10
function myProp( value )
return self.a_property * value
end
end
> "5*10=", eval( .[SomeObj.myProp 5] )
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- RSS Feeds
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Tech Tip: Really Simple HTTP Server with Python
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




5 min 25 sec ago
4 hours 32 min ago
8 hours 8 min ago
8 hours 40 min ago
11 hours 4 min ago
11 hours 7 min ago
11 hours 8 min ago
15 hours 33 min ago
17 hours 24 min ago
22 hours 37 min ago