MacRuby integrates with Xcode and allows calling Objective-C libraries directly through Ruby.

MacRuby 0.5 will use some derivative of the LLVM over YARV, which means Ruby will finally have a compiler. Or at least a compiler in the same sense as Java.

Now I just need to 1) find the time to figure out how it all works exactly and 2) come up with an app idea that I'd want to make.

What about Windows you ask? Well uh... <_<

I don't think Ruby.NET is going to happen like ever. Maybe they'll shove all its features into C# just like everything else and call it a day.

Anyone remember Visual Java? Lolol.

## Tuesday, June 16, 2009

## Sunday, June 14, 2009

### Rude awakenings

You know those things that you knew once but forgot later in order to make room for other things? Like that time you deleted common tropical fish illnesses in order to learn about humanist typefaces?

Okay that was probably just me.

There was also that other time I learned calculus and promptly discarded all my knowledge on completing the square ('haha' I said to myself, I'll find my quadratic vertexes through derivatives now!).

Then shit like ∫1/sqrt(3x² - 2x + 1) dx started showing up and suddenly I wished I hadn't started just throwing past mathematical knowledge out willy-nilly.

I can still tell my Fluvals from my Filstars though. Ask me about canister filters sometime.

Okay that was probably just me.

There was also that other time I learned calculus and promptly discarded all my knowledge on completing the square ('haha' I said to myself, I'll find my quadratic vertexes through derivatives now!).

Then shit like ∫1/sqrt(3x² - 2x + 1) dx started showing up and suddenly I wished I hadn't started just throwing past mathematical knowledge out willy-nilly.

I can still tell my Fluvals from my Filstars though. Ask me about canister filters sometime.

## Thursday, June 11, 2009

### And my CS adventure of the day

Today I suddenly realized that I could curry in Ruby (I was using the 1.8.6 framework at the time, so I'd have to write my own method).

Currying is basically the concept that you can decompose a function...

e.g. f(x,y,z) = x + 2y + 3z

...into...

g(x) = x + h(y)

where h(y) = 2y + i(z)

where i(z) = 3z

Now obviously I feel a need to show off my new found skills, so I thought to myself, when would this ever be useful? I asked around and nobody seemed to have a good answer. At that point, Google was my only recourse and to my delight it actually returned a thread on Ruby Forum.

Apparently Ruby 1.9.1 has a curry method built-in (also some new syntax, which is nice) and people there were trying to figure out what it's good for.

"It's not difficult at all,

returns the proc object equivalent to

"Uh, how do we call that?

...

What problem does that solve?"

"this one:

I gave a good chortle at this point, because the

Which is pretty much what people have been doing since forever in imperative languages. It's also more flexible because

So where does this leave me? Well, I still have no idea what use currying is for. I hope someone can give me a practical example outside of Lisp, because being able to do this:

...is actually pretty cool.

Currying is basically the concept that you can decompose a function...

e.g. f(x,y,z) = x + 2y + 3z

...into...

g(x) = x + h(y)

where h(y) = 2y + i(z)

where i(z) = 3z

Now obviously I feel a need to show off my new found skills, so I thought to myself, when would this ever be useful? I asked around and nobody seemed to have a good answer. At that point, Google was my only recourse and to my delight it actually returned a thread on Ruby Forum.

Apparently Ruby 1.9.1 has a curry method built-in (also some new syntax, which is nice) and people there were trying to figure out what it's good for.

"It's not difficult at all,

`proc {|x, y, z| x + y + z }.curry`

returns the proc object equivalent to

`proc {|x| proc {|y| proc {|z| x + y + z } } }`

""Uh, how do we call that?

...

`proc{...}.call(x).call(y).call(z)`

What problem does that solve?"

"this one:

`plus_five = proc {|x,y,z| x + y + z }.curry.call(2).call(3)`

`plus_five[10] #=> 15`

"I gave a good chortle at this point, because the

*not retarded*way of doing the same thing would just be:`sum = proc{|x,y,z| x + y + x}`

plus_five = proc{|x| sum[x,2,3]}

plus_five[10] #=> 15

Which is pretty much what people have been doing since forever in imperative languages. It's also more flexible because

`plus_five`

doesn't have to be `{|x| sum[x,2,3]}`

, it could just as easily be `{|y| sum[2,y,3]}`

.So where does this leave me? Well, I still have no idea what use currying is for. I hope someone can give me a practical example outside of Lisp, because being able to do this:

`f = proc{|a,b,c| a + b + c}.curry`

g = f[1][2]

puts g[3] #=> Outputs 6

...is actually pretty cool.

Subscribe to:
Posts (Atom)