Language recommendations from ruby persons

I've been watching 'Factor' for sometime, but I havent used it yet ...

http://factor.sourceforge.net/

Factor is the baby of Slava Pestov, the author of jEdit.
Slava blogs about Factor quite often here

http://www.jroller.com/page/slava/

···

-----Original Message-----
From: Greg Lorriman [mailto:bogus@bogus.com]
Sent: Monday, 19 September 2005 7:52 AM
To: ruby-talk ML
Subject: Language recommendations from ruby persons....

Dear sirs and madames,

I've thrown myself into ruby and I'm having a pleasant time.

Now I am looking to find another language to learn with three features,
two of which Ruby has, and I am looking for your words of advice and
guidance.

The features I am looking for are

1)enjoyableness
2)practicalness
3)alternativeness

with a decent nod to

4)not so long a learning curve (hey, I'm from the TV generation; I need
instant kicks).

Ruby does the first two, but now I want to cruise into other dimensions,
and ruby isn't really weird and alternative enough.

I really would like something that makes me think in a very different
manner, and is excellent at solving a range of problems that imperative
languages are not too good at. I would like to be using it a lot for
real-world stuff, like I am Ruby and Delphi.

Now because you guys are tuned to enjoyableness, and probably have a
measure of appreciation of the need for practicality I am hoping that
you might give me some commentary on what you think might be worth
looking at.

I've vaguely looked at Ocaml, Heskel, Scheme, Mercury. (Lisp would seem
to wander too far away from simplicity which I reckon probably impacts
enjoyableness, but then someone has said that OCaml isn't so simple but
is very enjoyable; so you can see why I haven't listed simplicity as a
requirement.). I doubt I can go too far off the mainstream since
requirement
2 would be impacted. So if anyone wishes to comment on the usual
'alternative' languages, as well as exotic stuff from other galaxies,
then I am very interested.

Of course I have no experience in any of these. I also see little in the
way of languages being compared for enjoyableness. I don't care for
performance tables since performance only solves one problem which Intel
and AMD can solve for me, and I'm more interested in the infinite number
of other problems.

Grateful for any of your wonderful and marvellous thoughts,

Greg

Neville Burnell wrote:

I've been watching 'Factor' for sometime, but I havent used it yet ...

Let me second this. I'm keeping an eye on concatenative languages like Factor and Joy as well and those languages are simple at their cores, yet very powerful. They feel good and there's quite some exploration to be done with their concepts.

Neville Burnell wrote:

> I've been watching 'Factor' for sometime, but I havent used it yet ...

Let me second this.

Let me third this :slight_smile: Concatenative programming languages like Joy[1]
(very academic) and Factor[2] (a more practical language from the man
who brought us JEdit) are very interesting - giving Forth a
theoretical makeover and applying Lisp's program=data=program concept
to produce a very elegant and powerful paradigm.

In some ways, Factor and Joy feel like Ruby in RPN. Compare Ruby's

  [1, 2, 3, 4].map{|x| x * x}

=> [1, 4, 9, 16]

with Joy/Factor's

  [ 1 2 3 4 ] [ dup * ] map

=> [ 1 4 9 16 ]

This applies the quoted program [dup *] to the list [1 2 3 4] using
the map operator.

Where Ruby has blocks, and Lisp has lambdas, concatenative languages
have quoted programs.

A more impressive example is Joy's:

  5 [1] [*] primrec

which computes the factorial of 5 by using the primrec 'primitive
recursion' operator.

This is the explanation from the tutorial:

It first pushes the number 5 and then it pushes the two short quoted programs. At this point the stack contains three elements. Then the primrec combinator is executed. It pops the two quotations off the stack and saves them elsewhere. Then primrec tests whether the top element on the stack (initially the 5) is equal to zero. If it is, it pops it off and executes one of the quotations, the [1] which leaves 1 on the stack as the result. Otherwise it pushes a decremented copy of the top element and recurses. On the way back from the recursion it uses the other quotation, [*], to multiply what is now a factorial on top of the stack by the second element on the stack. When all is done, the stack contains 120, the factorial of 5.

That's pretty funky.

The most interesting aspect of concatenative languages is - surprise,
surprise - concatenation, which makes it easy to do all the stuff
functional programming languages do but in a much easier to understand
fashion. For example, if you take a sequence like this:

  2 3 * 5 + .

=> 11

you can take any combination of symbols and cut them out and hey
presto you've got a function. E.g. (in Factor syntax);

  : times_three 3 * ;
  : plus_five 5 + ;

to get

  2 times_three plus_five .

=> 11

or you can do this:

  : three_times_and_five 3 * 5 ;

  2 three_times_and_five +

=> 11

the point being you can abstract ~any~ sequence of operations and data
- strong stuff!

(But if you want to get any real work done, try GForth[3], which is a
blazingly fast Forth that approaches C speed).

Have fun!

Sean

[1] Joy - http://www.latrobe.edu.au/philosophy/phimvt/joy.html

[2] Factor - http://factor.sourceforge.net

[3] GForth - http://www.complang.tuwien.ac.at/forth/gforth/

···

On 9/23/05, Florian Groß <florgro@gmail.com> wrote:

Factor looks very cool. But I think the postfix maths is a potential
problem. People really like infix. I think this is the major reason lisp
hasn't been excepted more widely.

···

On 9/23/05, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

On 9/23/05, Florian Groß <florgro@gmail.com> wrote:
> Neville Burnell wrote:
>
> > I've been watching 'Factor' for sometime, but I havent used it yet ...
>
> Let me second this.

Let me third this :slight_smile: Concatenative programming languages like Joy[1]
(very academic) and Factor[2] (a more practical language from the man
who brought us JEdit) are very interesting - giving Forth a
theoretical makeover and applying Lisp's program=data=program concept
to produce a very elegant and powerful paradigm.

In some ways, Factor and Joy feel like Ruby in RPN. Compare Ruby's

[1, 2, 3, 4].map{|x| x * x}

=> [1, 4, 9, 16]

with Joy/Factor's

[ 1 2 3 4 ] [ dup * ] map

=> [ 1 4 9 16 ]

This applies the quoted program [dup *] to the list [1 2 3 4] using
the map operator.

Where Ruby has blocks, and Lisp has lambdas, concatenative languages
have quoted programs.

A more impressive example is Joy's:

5 [1] [*] primrec

which computes the factorial of 5 by using the primrec 'primitive
recursion' operator.

This is the explanation from the tutorial:

> It first pushes the number 5 and then it pushes the two short quoted
programs. At this point the stack contains three elements. Then the primrec
combinator is executed. It pops the two quotations off the stack and saves
them elsewhere. Then primrec tests whether the top element on the stack
(initially the 5) is equal to zero. If it is, it pops it off and executes
one of the quotations, the [1] which leaves 1 on the stack as the result.
Otherwise it pushes a decremented copy of the top element and recurses. On
the way back from the recursion it uses the other quotation, [*], to
multiply what is now a factorial on top of the stack by the second element
on the stack. When all is done, the stack contains 120, the factorial of 5.

That's pretty funky.

The most interesting aspect of concatenative languages is - surprise,
surprise - concatenation, which makes it easy to do all the stuff
functional programming languages do but in a much easier to understand
fashion. For example, if you take a sequence like this:

2 3 * 5 + .

=> 11

you can take any combination of symbols and cut them out and hey
presto you've got a function. E.g. (in Factor syntax);

: times_three 3 * ;
: plus_five 5 + ;

to get

2 times_three plus_five .

=> 11

or you can do this:

: three_times_and_five 3 * 5 ;

2 three_times_and_five +

=> 11

the point being you can abstract ~any~ sequence of operations and data
- strong stuff!

(But if you want to get any real work done, try GForth[3], which is a
blazingly fast Forth that approaches C speed).

Have fun!

Sean

[1] Joy - http://www.latrobe.edu.au/philosophy/phimvt/joy.html

[2] Factor - http://factor.sourceforge.net

[3] GForth - Index of /forth/gforth

Factor looks very cool. But I think the postfix maths is a potential
problem. People really like infix. I think this is the major reason lisp
hasn't been excepted more widely.

Yes, but the OP was looking for something 'weird and alternative'.
As he said:

I really would like something that makes me think in a very different
manner, and is excellent at solving a range of problems that imperative
languages are not too good at.

And RPN is certainly a different way of thinking.

Regards,

Sean

···

On 9/23/05, Robbie Carlton <robbie.carlton@gmail.com> wrote:

Hi ..

Factor looks very cool. But I think the postfix maths is a potential
problem. People really like infix. I think this is the major reason lisp
hasn't been excepted more widely.

The nice (bizarre?) thing about Forth-ish languages is that they
are complete chameleons. You want infix? Not a problem, just
add a library to redefine the operators. The language doesn't care:

4 5 + .

9 ok

: infix 32 word number drop ;
: plus infix + ;
4 plus 5 .

9 ok

: .+ plus ;
: .= . ;
4 .+ 5 .=

9 ok

So, are we infix or postfix? Does it really matter?

-mark.

···

On Fri, 2005-09-23 at 17:47 +0900, Robbie Carlton wrote:

Mark Probert wrote:

: infix 32 word number drop ;
: plus infix + ;
4 plus 5 .

9 ok

Cute, but that only works when the second argument (5 in this case) is a literal. Getting true infix in forth would be as hard as doing it in any programming language implementation.

···

--
        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Hi ..

Mark Probert wrote:
>>: infix 32 word number drop ;
>>: plus infix + ;
>>4 plus 5 .
>
> 9 ok

Cute, but that only works when the second argument (5 in this case) is a
literal. Getting true infix in forth would be as hard as doing it in any
programming language implementation.

Sure. The point being that the languages are by their nature
extensible at this level. Nothing is sacred. That can be
both a good thing and a bad thing, of course ... However,
there are type extensions, object extensions, functional
extensions, ways of making it look like LISP, et al.

Though not to make it look like J ..

-mark.

···

On Fri, 2005-10-07 at 11:34 +0900, Joel VanderWerf wrote: