Skip to content

Commit

Permalink
ProgressReportTransform now handles Map[f,list,lvl]
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Lang committed Mar 30, 2018
1 parent a63e6b1 commit 0e55ad9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ForScience/PacletInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name -> "ForScience",
Description -> "Contains various utility functions and styling to make it easier to use MMA for scientific plots",
Creator -> "Lukas Lang & Marc Lehner",
Version -> "0.38.2",
Version -> "0.38.3",
MathematicaVersion -> "11.1+",
Extensions -> {
{ "Documentation", Language -> "English"},
Expand Down
8 changes: 4 additions & 4 deletions ForScience/Util.wl
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@ Attributes[iProgressReport]={HoldFirst};
Options[iProgressReport]=Options[ProgressReport];

Attributes[ProgressReportTransform]={HoldFirst};
ProgressReportTransform[(m:Map|ParallelMap|AssociationMap|MapIndexed)[func_,list_],o:OptionsPattern[ProgressReport]]:=
With[{elist=list},ProgressReportTransform[m[func,elist],Evaluated,o]]
ProgressReportTransform[(m:Map|ParallelMap|AssociationMap|MapIndexed)[func_,list_],Evaluated,o:OptionsPattern[ProgressReport]]:=
ProgressReport[m[Step@*func@*SetCurrentBy[],list],Length@list,o,"Parallel"->m===ParallelMap]
ProgressReportTransform[(m:Map|ParallelMap|AssociationMap|MapIndexed)[func_,list_,level_:{1}],o:OptionsPattern[ProgressReport]]:=
With[{elist=list},ProgressReportTransform[m[func,elist,level],Evaluated,o]]
ProgressReportTransform[(m:Map|ParallelMap|AssociationMap|MapIndexed)[func_,list_,level_],Evaluated,o:OptionsPattern[ProgressReport]]:=
ProgressReport[m[Step@*func@*SetCurrentBy[],list,level],Length@Level[list,level],o,"Parallel"->m===ParallelMap]
ProgressReportTransform[(m:Map|ParallelMap|MapIndexed)[func_,ass_Association],Evaluated,o:OptionsPattern[ProgressReport]]:=With[
{argProc=If[m===MapIndexed,##&,#&]},
ProgressReport[If[m===ParallelMap,Parallelize,#]&@@Hold@MapIndexed[Step@*func@*argProc@*SetCurrentBy[#&@@First@#2&],ass],Length@ass,o,"Parallel"->m===ParallelMap]
Expand Down

0 comments on commit 0e55ad9

Please sign in to comment.