Posted to tcl by oldlaptop at Mon Aug 10 13:39:13 GMT 2026view raw

  1. eltclsh > proc ( {args} { expr [lrange $args 0 end-1] }
  2. eltclsh > puts [( 1 + 1 )]
  3. 2
  4. eltclsh >

Comments

Posted by Florentis at Mon Aug 10 17:32:49 GMT 2026 [text] [code]

Hey, It's working like this too... But you have to include space between arguments. For the proc '(' incompatibility : It's really a minor drawback compared to the Tcl simplification this shorthand can offer.. The name of proc is free. I can't see any good reason to name a proc '(', because this char has always get its existence as a symbol, a symbol which work in pair with ')'. Whatever, if you really absolutely want to use a proc named '(', whereas it exists billion of other free names, just write : [\( 1 + 1 )] Or use a proc proc ! args { uplevel [list ( {*}$args] } Or use eval eval [list ( ...] Note also that all these proc named : (1+1) (2*2) (2/3.0+4**(8/7)) (1,2,3,4) (sin(3.14/2)) .... etc Will suffer the same problem if called without argument in a nested command.

Posted by FM at Mon Aug 10 18:07:41 GMT 2026 [text] [code]

Another way is to include space between the bracket an the parenthese. (System32) 2 % proc (1+1) \ return\ 3 (System32) 3 % puts [ (1+1) ] 3 (System32) 4 % puts [(1+1)] 2

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week