I still am surprised that a modern programming language can have an obscure syntax.
almost everything in Ruby is object based. For example, in Perl, you write for loop like this
in Ruby,
or
There is no using loops here. "Looping" is taken care of by the programming language itself (of course, there are also for loops in Ruby ). If you are accustomed to procedural programming where you use for loops often, this might seem "obscure" at first.
Do you mean functional programming ? ( Its a more familiar term to me. ). If you do indeed mean functional programming, then yes, Ruby supports that. In fact, in the wiki page you provided, its stated it support multi paradigms.
Ruby can be used as "procedural" as well.... with that i mean, in the script, there isn't a single user defined class.
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
No, I actually meant "declarative" .... See this reference:
Quote:
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than describing how to go about accomplishing it. This is in contrast with imperative programming, which requires an explicitly provided algorithm.
Declarative programming often considers programs as theories of a formal logic, and computations as deductions in that logic space. Declarative programming has become of particular interest recently, as it may greatly simplify writing parallel programs.
Common declarative languages include those of regular expressions, logic programming, and functional programming.
---------- Post updated at 12:48 ---------- Previous update was at 12:45 ----------
I see. Well, I am not sure about the distinctions between them...but i want to assume that if Ruby support functional prog , regular expression, then i would expect it to be a bit "declarative" as well.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
I'm glad that methyl brought this up.
I've been leisurely following ruby for a few years. I have one production code, glark, written in ruby. It is a grep-like utility, with lots of bells and whistles -- very slow, but very convenient in some situations. You might find it in one of your repositories, or at: incava.org
However, whenever I have tried to execute kurumi's one-liners, say:
I get:
This is from:
but I also got it on new install of ruby-full on:
Something simple, perhaps, that I am over-looking? ... cheers, drl
Hello everybody,
May you help with this, I don't know what is wrong.
I want trying to print the first 4 characters as decimal and remove the "k's" from the next 7 characters.
I'm trying with gsub and backrefence as shown below trying to remove the "k's" and then trying to assign to "x" the... (0 Replies)
Hi,
I am working on RHEL 5.6 server, this is in private DMZ. No access to internet. I have downloaded the files I need to install the Puppet & Ruby. My goal is to install Puppet. I have downloaded....
mcollective-2.2.3-1.el5.noarch- SERVER.rpm ... (2 Replies)
Hi,
I am a php developer and I decided to learn ruby on rails.
I have a few question.
I have an ubuntu virtual machine with lamp.
It mean that it has alrweady php and when I access the ip of the machine from my browser it does load the index.php.
if I install ruby on rails will theere... (0 Replies)
Hai any one pls guide me...
We can extract the line number of the sub routine/function/method in a Ruby file using the ctags command.
But I want to know the line number in which the sub routine is ending.
Example:
Say the function get_days_in_hash starts in the line number 20.
It... (2 Replies)
Hello guys,
This is suse SLES 9.2.
I want to get ri working for all users on this system. I used
gem rdoc --all --ri to generate documentation and it went on doing it successfully.
Then I tried
ri Array
It shows following message :
Nothing known about Array
Therefore I ran... (0 Replies)