« Return to Thread: Library defined literals

Re: Library defined literals

by Arrgh :: Rate this Message:

Reply to Author | View in Thread

Paul Phillips wrote:

> On Tue, Jun 09, 2009 at 02:59:02PM -0700, Alex Cruise wrote:
>  
>> Yes, that would be interesting indeed. :)
>>
>> def f(n: ⇒ Int) = for (x ← 1 to n) yield Map(x → ("*" * x))
>>    
> Stranger yet would be if the language included some out of the box:
>
> scala> for (x \u2190 1 to 10) yield x
> res0: scala.collection.generic.VectorView[Int,Vector[_]] = RangeM(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
>
> scala> (x: Int) \u21D2 x + 1
> res1: (Int) => Int = <function>
>  
I even debated posting the output but then decided it'd be fun for
people to try it out themselves. :/

-0xe1a


 « Return to Thread: Library defined literals