var y = pv.Scale.linear(0, 100).range(0, 640);
y(100); // 640
y(0); // 0
y(50); // 320
Neat!! Well, how about Ruby?Well, I've been reading Metaprogramming Ruby (which is a really fun book so far) and we have lambdas. However, with a lambda, you usually have assign the lambda and then call() the lambda.
It looks like this:
f = lambda {|x| x}
f.call(10) # 10
But I wanted this to be more like javascript's syntax, so I did some tinkering. Here's what I came up with: