Getting the Multi-Paradigm Language Falcon
Author |
Message |
DarkRider
![](http://compsci.ca/v3/uploads/user_avatars/1556700689495edad4bb7a3.jpg)
|
Posted: Sun Feb 08, 2009 10:48 pm Post subject: Getting the Multi-Paradigm Language Falcon |
|
|
What is Falcon?
"Falcon is ...
...an Open Source, simple, fast and powerful programming language, easy to learn and to feel comfortable with, and a scripting engine ready to empower mission-critical multithreaded applications.
Falcon provides six integrated programming paradigms: procedural, object oriented, prototype oriented, functional, tabular and message oriented. And you don't have to master all of them; you just need to pick the ingredients you prefer, and let the code to follow your inspiration. -Falconpl.org
Falcon is a dynamically typed language that rivals the power of other languages of its type including Python, Ruby, PHP, Lua, and Perl. When using Falcon you are not limited to a single programming style, you blend them together or pick one and build your program using the style you chose.
A simple hello world program in Falcon:
Falcon: | //Example one
printl( "Hello world from the print command!" )
//Example two
> "Hello world from the quick print command!"
//Example three
function Hello ()
> "Hello world from a function!"
end
Hello()
//Example four
[printl, "Hello world from an array!"]()
//Example five
[printl, "Hello to ", "Bob, ", "Joe, ", "Fred, ", "and Billy", " from an array!"]()
//Example six
function Greet (greeting)
for i in [1 : paramCount()]
forfirst: >> greeting
>> parameter (i)
formiddle: >> ", "
forlast: > " from multiple parameters!"
end
end
Greet ("Hello to ", "Bob", "Joe", "Fred", "Billy") |
I think Falcon has a lot of potential and would encourage anyone who has a lot of programming needs to give Falcon a try. You can get Falcon from the download link below and I have listed some manuals to get you started.
You can run Falcon code by either passing an external script to the interperter or you can launch Falcon in interactive mode. To run an external script, create a new batch file called "Run.bat" (or something similar) and type the following code within it:
code: | falcon script.fal
pause |
The "puase" command is optional, but it useful to see the output of your program before it exits. Next, put all your Falcon code in "script.fal" and double click your Run.bat file.
To run Falcon in interactive mode create a new batch file called "Interactive Falcon.bat" (or something similar) and type the following code within it:
From there you can enter any Falcon code you like and it will imediately process it. Alternatively you can input these commands into a command console.
Note: The above instructions are meant for the Windows operating system. You can use Falcon with Windows, MacOSX and Linux, but I am not familiar with either the MacOSX or Linux operating systems.
Download: http://falconpl.org/index.ftd?page_id=official_download
Manuals:
Falcon Forums: http://old.falconpl.org/forum/ |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
btiffin
![](http://compsci.ca/v3/uploads/user_avatars/189169540547b535e50e4a7.jpg)
|
Posted: Sun Feb 08, 2009 11:31 pm Post subject: RE:Getting the Multi-Paradigm Language Falcon |
|
|
Giancarlo is a smart and productive coder. Falcon is more than worthy of following, and perhaps volunteering some time towards. Hint hint, to the good followers of compsci.ca.
Someday soon it'll be added to the list of embedded engines in OpenCOBOL.
Well pointed out DarkRider. I should update my .8.08 install.
And for those with Ubuntu, look for the falconpl package. I've never tried the binary package, as the source tar built and installed fine when I tried it.
Cheers |
|
|
|
|
![](images/spacer.gif) |
DarkRider
![](http://compsci.ca/v3/uploads/user_avatars/1556700689495edad4bb7a3.jpg)
|
Posted: Mon Feb 09, 2009 12:12 am Post subject: RE:Getting the Multi-Paradigm Language Falcon |
|
|
Giancarlo said that version 0.9 was due for mid-January, but I haven't been alble to find a binary for it. The source for version 0.9 might be in the svn but I haven't checked (svn://falconpl.org/falcon/docs/trunk). |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Mon Feb 09, 2009 3:05 am Post subject: RE:Getting the Multi-Paradigm Language Falcon |
|
|
What does Falcon do better than other existing tools? |
|
|
|
|
![](images/spacer.gif) |
Zeroth
|
Posted: Mon Feb 09, 2009 12:44 pm Post subject: Re: Getting the Multi-Paradigm Language Falcon |
|
|
Thats my question as well. I don't care jackshit about paradigms, or neat syntactic sugar. I care about whatever makes things faster and better. (Hence why I stick with Python, since the language design is focused on readability, learning, and remembering the syntax easily. Its also why I avoid ruby... too much focus on neat syntactic sugar and little to none on good design.) Can I do a dynamic ORM in a much better conceptual model in Falcon than is possible in Python? Does Falcon let me do what I want, instead of smacking my hand and saying, "No! Bad programmer! Doing that could result in bad stuff, so I'll unilaterally stop you!"?
Having such a wide variety of programming paradigms seems like an issue to me, because then you'll get people creating a horrible and convoluted mess of paradigm-disparate code. Kind of like bad Ruby code, which has hardcore java style OOP, mixed liberally with arcane syntactic sugar meant for a procedural model... *shudders* |
|
|
|
|
![](images/spacer.gif) |
btiffin
![](http://compsci.ca/v3/uploads/user_avatars/189169540547b535e50e4a7.jpg)
|
Posted: Mon Feb 09, 2009 2:26 pm Post subject: Re: Getting the Multi-Paradigm Language Falcon |
|
|
Old guy ramble to the "do better" question
One thing I noticed soon after opening the docs that fits with my off by one, fence tripping brain farts. (As DarkRider already mentioned)
code: | for item in sequence
forfirst: >> "["
>> item
formiddle: >> ", "
forlast: > "]"
end |
Sure there are other ways to code that pre-body-post logic, but Giancarlo saw a common idiom and built it in. So Falcon, at the very least, is a step wise refinement and incremental advance in scripting. Check it out, I bet you find many of these refinements and flavourings, and some of them may suit your own tastes.
Plus, as a bonus, Falcon is no slug by any means.
Will it supplant my list of top 7 "go to" tools? (REBOL, awk, Forth, C, Icon, COBOL, and the shell glue)? Maybe not, but it is already working its way up the list of my toolbelt attachments, and it's not even at 1.0 yet.
Cheers
Edit; typos. |
|
|
|
|
![](images/spacer.gif) |
DarkRider
![](http://compsci.ca/v3/uploads/user_avatars/1556700689495edad4bb7a3.jpg)
|
Posted: Mon Feb 09, 2009 9:04 pm Post subject: Re: Getting the Multi-Paradigm Language Falcon |
|
|
What makes Falcon different then other dynamically typed scripting languages is its support for multi-paradigms. This gives Falcon some additional functionality that other scripting languages of the same type may not have or may not fully support.
I don't feel qaulified to say what Falcon does better then other languages of the same type as I don't know all the pros and cons, but Falcon's Fact Sheet lists some stuff that differentiate Falcon from Python, Ruby, PHP, LUA and Perl.
Some things I find interesting about Falcon include:
The ability to create dynamic nameless functions:
Falcon: | function Evaluate (Value, Operation)
return Operation(Value)
end
//Multiply the given value by two using a dynamic function
> Evaluate (10, function (Num);return Num*2;end)
//Add two to the given value using a new dynamic function
> Evaluate (10, function (Num);return Num+2;end) |
Being able to use a variable based on what a string contains,
Falcon: | //Create some strings
hello="Hello!"
bye="Bye!"
//Print "Hello!"
action="hello"
printl( #action)
//Print "Bye!"
action="bye"
printl( #action ) |
or function based what a string contains,
Falcon: | //Create some functions
function square (Value)
return Value**2
end
function add2 (Value)
return Value+2
end
//Square 10
action = "square"
printl( (#action)(10) )
//Add 2 to 10
action = "add2"
printl( (#action)(10) ) |
Being able to assign a range to a variable and use it latter:
Falcon: | range=[1:10]
for i in range
printl( i )
end |
Ability to pass values to any combination of parameters you want in a function:
Falcon: | function example (a, b, c, d)
if a : printl( a )
if b : printl( b )
if c : printl( c )
if d : printl( d )
end
//Give a and c some values, but not b and d
example(a | "Bob", c | "Joe" )
//Give b and d some values, but not a and c
example(b|"Dog", d|"Cat") |
Falcon may not do stuff better then other languages but I think it offers some interesting features and functionality. |
|
|
|
|
![](images/spacer.gif) |
btiffin
![](http://compsci.ca/v3/uploads/user_avatars/189169540547b535e50e4a7.jpg)
|
Posted: Sat Feb 21, 2009 12:57 am Post subject: RE:Getting the Multi-Paradigm Language Falcon |
|
|
For anyone that cares:
I've just created a work in progress page for Falcon at http://en.wikipedia.org/wiki/Falcon_(programming_language)
Giancarlo sent me the Falcon logo but I still have to verify that everyone on the Falcon team is ok with the implications of publishing through Wiki Commons, so the page isn't quite as pretty as it will be in a few days.
By the way, in my old guy opinion, you should care about Falcon. It's cool.
0.8.14 adds the interactive mode and from chatting with Giancarlo, 0.9 could be out within the next few days.
Great time to be involved people; it's mover shaker time for this development environment. For instance, if you have any opinions on how a inference engine should be implemented, speak up, as one may well work its way into 0.9.1. Get your thoughts and likings built into a production programming language. Why not be in on the invention of an object oriented reflective logic inferred messaging coroutine.
Cheers |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
wtd
|
Posted: Sat Feb 21, 2009 2:06 am Post subject: RE:Getting the Multi-Paradigm Language Falcon |
|
|
On closer examination, Falcon aims to be Common Lisp with an infix syntax that isn't quite familiar to programmers versed in any other language? ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
btiffin
![](http://compsci.ca/v3/uploads/user_avatars/189169540547b535e50e4a7.jpg)
|
Posted: Sat Feb 21, 2009 12:22 pm Post subject: Re: Getting the Multi-Paradigm Language Falcon |
|
|
I think Giancarlo's motivation is to create a scripting language that a professional can use to get on with it. Like all good designs, there is little worry of how that fits with others, but how well it fits within itself. And I'll opine once again, the Falcon team has done a terrific job.
Everything I've tried came out of common sense trials that worked as expected first (ok I'm new, sometimes second) try. With a few pleasant surprises. Normally with scripting, I find myself in a PitS mind space, just because. Falcon, refreshingly, offers a sense of very real Programming in the Large and Programming in the Many potential.
0.9 will allow Ruby coders some more comfort with support for expressions along the lines of 5.times()
PHP coders can play in the Template Programming arena with the <? ?> escape mechanism understood by the falcon compiler/interpreter.
Lua coders should feel right at home.
Erlang folk may be surprised at the level of concurrency support.
Eiffel people will be able to make good use of contract programming with some of the new "as" features being built.
Spreadsheet types could have a lot of fun playing with the Tabular programming model.
code: | function normal_salary( work_hours )
return work_hours * self.hourly_pay
end
function extra_salary( work_hours )
if work_hours <= self.daily_hours
return work_hours * self.hourly_pay
else
return self.daily_hours * self.hourly_pay + \
(work_hours - self.daily_hours) * \
self.extra_pay
end
end
Employees = Table(
.[ 'name' 'hourly_pay' 'extra_pay' 'daily_hours' 'payment' ],
.[ 'ed' 20 24 8 normal_salary ],
.[ 'frank' 18 24 6 extra_salary ] )
for hours in [6, 9, 12]
for name in ["Ed", "Frank"]
> @ "$(name:r5)'s pay for $(hours:r2) hours: " + \
Employees.find( 'name', strLower(name) ).payment(hours)
end
end
|
Outputs:
code: | Ed's pay for 6 hours: 120
Frank's pay for 6 hours: 108
Ed's pay for 9 hours: 180
Frank's pay for 9 hours: 180
Ed's pay for 12 hours: 240
Frank's pay for 12 hours: 252
|
C++ coders can read through the sources and learn things.
Us rebols are still left panting for a few features, but hey, REBOL has those.
But ... one of the main points of my last post (aside from the cheerleading) was ... getting involved and exerting influence to get a programming environment that matches your own hopes and dreams. That means writing a language from first principles, or getting in on a system like Falcon (with a friendly lead designer and wide coverage of the computer sciences), before 1.0 solidifies and decisions close. REBOL 3 now approaches the "decisions have been made" stage, but there is still time to offer opinions. Falcon even more so. Involvement is fun and rewarding. Even OpenCOBOL, a language whose major decisions were made 50 years ago offers room for influence. I'm only naming three; the membership of compsci.ca have options in front of them, but these opportunities are not a dime a dozen. The point being, involvement, and not simply eating what others feed.
Cheers
Edit; added tabular code |
|
|
|
|
![](images/spacer.gif) |
|
|