could you share an example of a ioke program with a 5x ratio to ruby code?
I can think of many things that could be way less verbose in ruby, but I wonder where from does a a fivefold improvement come.
I fear I am going to do a bad job of explaining this, but here goes:
You'll get the typical Lisp-like terseness and folding that'll make your complex code much smaller. This includes things like currying and passing multiple functions as parameters (I know both of these are possible in Ruby, but it really isn't idiomatic). This one, I think, is easier to understand especially if you've done some work in those types of languages.
The other benefit is more difficult to see at face value. What Ioke does is encourages you to write expressions and to build up your own language. This is a DSL and can be built in Ruby and Lisp and Javascript and many other languages. However, Ioke makes the DSL writing the "Pit of Success" that a developer encounters. It isn't a conscious choice, it is how you write your code. Simplistic example:
square = lambda { |x| x * x }
puts (1..10).inject(0) { |sum, x| sum + square.(x) }
In Ioke:
square = method(x, x * x)
(1..10) map(x, square(x)) sum println
This is obviously a trivial example that doesn't save any lines. They look very similar except that ruby has a bit more "noise". First, we're using the inject function. I love the inject function but it is a significant amount of noise in the ultimate goal of a readable line of code. Ioke has 4 words that are all significant: map square sum println. They are used once and only once. Ioke's space a function applicator cannot be overlooked, though. It is syntax, yes, but it really encourages "sentence writing" a la Smalltalk. And, finally, Ioke reads left-to-right unlike the C-inspired languages which read inside-out. In fact, if you were to describe this problem in English, you would probably write something similar to:
For the range 1 to 10, square each number and then sum the results.
Ioke maps very well to this.
(1..10) map(x, square(x)) sum println
The problem with this trivial example is that this expressiveness is just slightly off for Ruby. But when we grow the program to scale, in Ruby we lean on the classical inheritance-based Object Oriented model that is available in Ruby. In Ioke, we continue to build a DSL.
I hope that makes a little sense?
Edit: Let me also say that I'm madly in love with Ruby and think its a great language :) By no means does "Less Expressive than Ioke" mean "Not Expressive Enough" or "Bad Language"!
&_ is an explicit $_ You use $* or &* when you need to check $_[0] first.
So &_ is more correct with general map but $* (and &*) will work also in
this autobox example (in fact i had used it in my first edit but preferred
aesthetics of &_ especially with previous usage of $* only being deprecated
in 5.10).
square = method(x, x * x)
(1..10) map(x, square(x)) sum println
> Ioke has 4 words that are all significant: map square sum println. They are used once and only once.
Sorry to be that guy, but `square` is clearly used twice above. Why not `(1..10) map(x, x*x) sum println`? (I don't have Ioke on this computer, so I can't easily check if this works.) Or are you assuming that `square` would probably have been defined somewhere already?