Developing cross-platform web/GUI applications

J

Jon Harrop

Hi!

I'd like to write cross-platform applications that either run in the browser
or run as standalone GUI applications in a functional programming language.

I understand that Ruby is a functional programming language and I was
wondering:

1. How widely is Ruby used on Linux, Mac OS X and Windows?

2. Are there compilers/interpreters targetting the JVM/.NET that make it
easy to develop GUI applications?

3. Has anyone done any significant work in this area using Ruby?

4. Are scientists and engineers using Ruby?

Many thanks,
 
M

M. Edward (Ed) Borasky

Jon said:
Hi!

I'd like to write cross-platform applications that either run in the browser
or run as standalone GUI applications in a functional programming language.

I understand that Ruby is a functional programming language and I was
wondering:
Well, I wouldn't call Ruby a "functional" programming language in the
same sense as Lisp/Scheme, Haskell and Erlang define themselves as
functional programming languages. Ruby is more an "object-oriented
programming language" in the same sense as Smalltalk and Java define
themselves as object-oriented programming languages.
1. How widely is Ruby used on Linux, Mac OS X and Windows?
It depends on what you mean by "widely used." It's installed by default
on Macs, but you have to download and install it on from an external
repository on Windows, and while it's freely distributed in all the
major Linux distro repositories, it isn't usually installed by default.
2. Are there compilers/interpreters targetting the JVM/.NET that make it
easy to develop GUI applications?
Yes indeed! The JVM is supported by Sun's jRuby, Microsoft just
announced a "Dynamic Language Run-time" that supports Ruby on .NET, and
there are miscellaneous other implementations. I don't have any
experience with the .NET versions, but I highly recommend jRuby.
3. Has anyone done any significant work in this area using Ruby?
If by "this area" you mean web applications, you pretty much have to
have been living under a rock if you haven't heard about Ruby on Rails.
;). But general GUI applications are a bit more obscure in Ruby. Most of
the major GUI toolkits have Ruby bindings, but there's no clear "first
choice" among them.
4. Are scientists and engineers using Ruby?
Yes, but it isn't as popular among them as Python is. I'm a
scientist/engineer, and I use Ruby, along with Perl and R. But I've
never taken the time to learn Python.
 
J

Jon Harrop

M. Edward (Ed) Borasky said:
Well, I wouldn't call Ruby a "functional" programming language in the
same sense as Lisp/Scheme, Haskell and Erlang define themselves as
functional programming languages.

Ok. I'm from an OCaml/F# background. May I just ask if anyone can translate
the following OCaml one-liner into Ruby:

let rec nest ?(n=2) f x = if n=0 then x else nest ~n:(n-1) f (f x)

it nests "n" applications of "f" to "x" with "n" defaulting to 2 if it isn't
specified, e.g. "nest ~n:3 f x" gives f(f(f(x))).

This trivial example encapsulates much of what I love about OCaml and it
doesn't translate well into any other language that I know.
Ruby is more an "object-oriented
programming language" in the same sense as Smalltalk and Java define
themselves as object-oriented programming languages.

Hmm. I'm not an OO fan but I was under the impression that Ruby has much
better support for functions than Python.
It depends on what you mean by "widely used." It's installed by default
on Macs,

Really? It is bundled by Apple? That's incredible! =:cool:
Yes indeed! The JVM is supported by Sun's jRuby, Microsoft just
announced a "Dynamic Language Run-time" that supports Ruby on .NET, and
there are miscellaneous other implementations. I don't have any
experience with the .NET versions, but I highly recommend jRuby.

Awesome!!! This is exactly the kind of thing I'm looking for.
If by "this area" you mean web applications, you pretty much have to
have been living under a rock if you haven't heard about Ruby on Rails.
;).

Oh yeah, I forgot. :)

I had a look at Ruby on Rails a while ago and, although I can do scientific
computing with my eyes closed, web programming is like double Dutch to me.
Couldn't make head nor tail of it. I think I'm improving now though. :)
But general GUI applications are a bit more obscure in Ruby. Most of
the major GUI toolkits have Ruby bindings, but there's no clear "first
choice" among them.

Ok, thanks.
Yes, but it isn't as popular among them as Python is. I'm a
scientist/engineer, and I use Ruby, along with Perl and R. But I've
never taken the time to learn Python.

Are there many tools for scientists and engineers written in Ruby? What sort
of stuff do you write in Ruby?

Thanks very much!
 
B

Bil Kleb

Jon said:
I had a look at Ruby on Rails a while ago and, although I can do scientific
computing with my eyes closed, web programming is like double Dutch to me.
Couldn't make head nor tail of it. I think I'm improving now though. :)

I'd recommend you start with Camping,

http://camping.rubyforge.org

instead then migrate to Rails if need more amenities.

Regards,
 
J

Jon Harrop

Logan said:
The closest to the OCaml would look like:

def nest(x, n = 2, &f)
if n == 0 then x else nest(f[x], n - 1, &f) end
end

Ok, that's easily the best I've seen in any other language.
nest(-3) { |a| a + 1 } #=> -1

So nest(-3) defaults to nest(-3, 2) and returns a closure that accepts the
anonymous function { |a| a + 1 } and applies it to -3 twice, is that right?

Back in OCaml, that is:

nest ((+) 1) (-3)
However, I'd probably write it like:
def nest(x, n = 2)
(1..n).inject(x) { |acc, _| yield(acc) }
end

I don't understand this one. I think "inject" is a fold and "yield" returns
a value and a continuation. Looks like the continuation is ignored the next
time it is accumulated, but won't the result have a continuation in it?
nest("a", 3) { |a| a + a } #=> "aaaaaaaa"

I think this is:

nest ~n:3 (fun a -> a^a) "a"

Thanks!
 
L

Logan Capaldo

Logan said:
The closest to the OCaml would look like:

def nest(x, n = 2, &f)
if n == 0 then x else nest(f[x], n - 1, &f) end
end

Ok, that's easily the best I've seen in any other language.
nest(-3) { |a| a + 1 } #=> -1

So nest(-3) defaults to nest(-3, 2) and returns a closure that accepts the
anonymous function { |a| a + 1 } and applies it to -3 twice, is that right?

Back in OCaml, that is:

nest ((+) 1) (-3)
However, I'd probably write it like:
def nest(x, n = 2)
(1..n).inject(x) { |acc, _| yield(acc) }
end

I don't understand this one. I think "inject" is a fold and "yield" returns
a value and a continuation. Looks like the continuation is ignored the next
time it is accumulated, but won't the result have a continuation in it?
inject is a fold. yield is not a continuation, but rather a way of
accessing the passed in function (block) anonymously.

def f
yield
end

def f1(&b)
b.call
end

f { puts "Does the same thing" }
f1 { puts "Does the same thing" }
 
A

ara.t.howard

Hi!

I'd like to write cross-platform applications that either run in
the browser
or run as standalone GUI applications in a functional programming
language.

I understand that Ruby is a functional programming language and I was
wondering:

1. How widely is Ruby used on Linux, Mac OS X and Windows?

2. Are there compilers/interpreters targetting the JVM/.NET that
make it
easy to develop GUI applications?

3. Has anyone done any significant work in this area using Ruby?

4. Are scientists and engineers using Ruby?

http://sciruby.codeforpeople.com

we use it heavily here

http://www.ngdc.noaa.gov/dmsp/index.html

these were made with ruby

http://www.ngdc.noaa.gov/dmsp/interest/katrina.html

as were these

http://www.ngdc.noaa.gov/dmsp/interest/india.html

regards.

-a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top