Delegates and values captured inside loops

atzensepp webwicht at web.de
Sun Jan 21 23:05:37 UTC 2024


In Ocaml this would look as:
```d
let names =["foo";"bar";"baz"] in
let funmap = List.map (  fun name -> ( fun () -> print_endline 
name)) names in
List.iter ( fun f -> f () ) funmap
;;
~
```
I think in the D-example it is basically one function and not 3.




More information about the Digitalmars-d-learn mailing list