August 04, 2012
  auto a = map!((a)=>2*a)(iota(10));

Appears to do exactly what is says on the can. However, whilst:

  auto threads = new Thread [ numberOfThreads ] ;
  foreach ( i ; 0 .. numberOfThreads ) {
    auto closedPartialSum ( ) {
      immutable ii = i ;
      return delegate ( ) { partialSum ( ii , sliceSize , delta ) ; } ;
    }
    threads[i] = new Thread ( closedPartialSum ) ;
  }
  foreach ( thread ; threads ) { thread.start ( ) ; }

works fine:

  auto threads = map ! ( ( int i ) {
      auto closedPartialSum ( ) {
        immutable ii = i ;
        return delegate ( ) { partialSum ( ii , sliceSize , delta
) ; } ;
      }
      return new Thread ( closedPartialSum ) ;
      } ) ( iota ( numberOfThreads ) ) ;
  foreach ( thread ; threads ) { thread.start ( ) ; }

causes a SIGSEGV:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff73af700 (LWP 8840)]
0x000000000044f8a5 in
pi_d_threadsGlobalState_array_declarative.execute()
(this=0x7ffff7ed1fe0) at pi_d_threadsGlobalState_array_declarative.d:39
39	        return delegate ( ) { partialSum ( ii , sliceSize , delta
) ; } ;


This is with dmd 2.059 and so not a 2.060 thing.

Nudges in the right direction most welcome.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder