Prev: Insecure operation - chdir
Next: Reports & Graphs
From: Robert Klemme on 28 May 2010 09:59 2010/5/28 Caleb Clausen <vikkous(a)gmail.com>: > On 5/27/10, Paul A. <cyril.staff(a)gmail.com> wrote: >> Hi, >> >> Just a thin post in order to purpose this: >> >> I think it could be cool to call lambda function just like: ë >> >> Such as: >> >> a = 0 >> my_while ë { a < 5 } do >> puts a >> a += 1 >> end > > Honestly, why is this better than: > > a=0 > while a<5 do > puts a > a+=1 > end or even 5.times do |a| puts a end or even puts (0...5).to_a > This way is so much less noisy and more succinct. You could even leave > off the do. > > lambdas should not be used to replace arbitrary expressions. Only > where you need them. Yep, fully agree. > Putting Robert's doubts about encoding issues aside, you can already > do this in both 1.8 and 1.9: > > #encoding: utf-8 > alias ë lambda > x=ë{ p :foo } > x.call #=> :foo > > In 1.8, you do have to pass -Ku on the command line, tho. This is cool! Thanks for that. > I am with Piyush on the question of how you type these things, tho. My > keyboard only has ascii on it. I'm putting off adopting unicode until > a unicode keyboard is available. You'll need a new desk then, too - and probably a set of arm extensions. :-) Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
From: andrew mcelroy on 28 May 2010 10:04 [Note: parts of this message were removed to make it a legal post.] 2010/5/28 Robert Klemme <shortcutter(a)googlemail.com> > > > > You'll need a new desk then, too - and probably a set of arm extensions. > :-) > > Not if you use a lisp machine keyboard http://www.sts.tu-harburg.de/~r.f.moeller/symbolics-info/symbolics-images/keyboard.JPG You would end up with key combos like hyper + meta + square + shift + v > Cheers > > > robert > > Andrew McElroy
From: Caleb Clausen on 28 May 2010 10:25 On 5/28/10, Robert Klemme <shortcutter(a)googlemail.com> wrote: > 2010/5/28 Caleb Clausen <vikkous(a)gmail.com>: >> I am with Piyush on the question of how you type these things, tho. My >> keyboard only has ascii on it. I'm putting off adopting unicode until >> a unicode keyboard is available. > > You'll need a new desk then, too - and probably a set of arm extensions. :-) I meant it as mostly a joke, but I really do want a unicode keyboard if one could possibly exist. I'd be satisfied if my unicode keyboard left off chinese, japanese, korean, and vietnamese glyphs, since I'm very unlikely to use those. That should reduce the size of the keyboard by about 3/4. I'd still need several new desks, tho. :-/
From: Ken Bloom on 28 May 2010 12:08 On Fri, 28 May 2010 23:25:17 +0900, Caleb Clausen wrote: > On 5/28/10, Robert Klemme <shortcutter(a)googlemail.com> wrote: >> 2010/5/28 Caleb Clausen <vikkous(a)gmail.com>: >>> I am with Piyush on the question of how you type these things, tho. My >>> keyboard only has ascii on it. I'm putting off adopting unicode until >>> a unicode keyboard is available. >> >> You'll need a new desk then, too - and probably a set of arm >> extensions. :-) > > I meant it as mostly a joke, but I really do want a unicode keyboard if > one could possibly exist. > > I'd be satisfied if my unicode keyboard left off chinese, japanese, > korean, and vietnamese glyphs, since I'm very unlikely to use those. > That should reduce the size of the keyboard by about 3/4. I'd still need > several new desks, tho. :-/ I think an optimus maximus keyboard would be what you want. Set the 10 keys on the left as modifiers to switch between different langauges. --Ken -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/
From: Joel VanderWerf on 28 May 2010 14:29
Robert Klemme wrote: > puts (0...5).to_a Pointless golf of the day: puts(*0...5) But this is even farther from the original point, which is why not have a more compact notation for when you need to pass more than one block to a method. |