Rebol Talk Forum  |  REBOL Discussions  |  REBOL Core  |  Topic: usefulness of 'also'
Pages: [1] Print
Author Topic: usefulness of 'also'  (Read 493 times)
fhein
Newbie
*
Offline Offline

Posts: 47


View Profile
usefulness of 'also'
« on: March 20, 2008, 05:18:44 AM »

I was thinking, is the new function 'also' really useful? Can it do anything that a simple parenthesis can't?

Ie

a: also 1 print "a"

appears to do the same as

a: (print "a" 1)

Do you find the also-syntax more readable? Maybe if the additional stuff is really long, and you want the assigned value close to the set-word?
Logged
btiffin
Jr. Member
**
Offline Offline

Posts: 54


View Profile
Re: usefulness of 'also'
« Reply #1 on: March 20, 2008, 10:24:06 AM »

Absolutely useful.  It can save having to use temporary variables when traversing series (for one of many uses).
d: first s  s: next s  d
  can now be 
also first s s: next s
But 2.7.6 also includes first+  so that example is already 'out of date'.  Smiley
first+ s
And looking at the source for also opens up all kinds of potential for selective evaluation.   Need the first result of three?
three: func [arg1 [any-type!] arg2 [any-type!] arg3 [any-type!]] [get/any 'arg1]
Want the second of four  just add an arg4 and get/any 'arg2.

Cheers,
Brian
Logged
Gabriele
Full Member
***
Offline Offline

Posts: 181


View Profile WWW
Re: usefulness of 'also'
« Reply #2 on: March 20, 2008, 01:56:54 PM »

The classic example is:

Code:
also copy port close port
Logged
Pages: [1] Print 
Rebol Talk Forum  |  REBOL Discussions  |  REBOL Core  |  Topic: usefulness of 'also'
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 19, 2008, 07:35:17 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2187 Posts in 576 Topics by 1615 Members
Latest Member: Uncellhoolf

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc