You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a side note: the example you provided (creating directories) typically might be better to do in parallel rather than sequenced. But I get the underlying motivation of course!
for :dir in $dirs { fs:create-dir $dir }
This form would need to be dedicated syntax as things currently exist, though there were potential plans to allow arbitrary setters. Though the semantics of the scope to which dir pertains isn't easy to handle, the original intention was for the setters to correspond to the outer scope.
Otherwise there's a few ways I can think of that would handle this:
std:Iter:do - Iter:do <| Iter:map fs:create-dir $dirs, but probably far more practical as Iter:do fs:create-dir $dirs
Obviously these all end up with fairly similar implementations. It might be appropriate to add more than one, too (for instance, Iter:do has argument ordering that is compatible with typical iterator piping).
Without mutability, a
for
loop probably has limited use, but it can be confusing when it does come up:would probably be easier to understand as something like
The scoping of
:dir
is a little bit unusual compared to the rest of the language, which might be a complication. Something likeis a little more in line with the rest of the language, but slightly more verbose and doesn't flow "grammatically".
The text was updated successfully, but these errors were encountered: