9 Likes
– you have earned Featured Contributor Badge ![]()
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!
Hi Bowen,
Nice! Thanks for sharing. One minor suggestion, rather than
Apply[Sequence, # -> OptionValue[#] & /@ Options[Line][[All, 1]]]
consider using FilterRules. The more common way of handling options is like this
ClearAll@walker;
Options[walker] = Join[Options@Line, Options@Graphics];
walker[afunc_, range_List, opts : OptionsPattern[]] :=
Graphics[
Line[AnglePath[afunc /@ Range @@ range],
Sequence @@ FilterRules[{opts}, Options[Line]]],
Sequence @@ FilterRules[{opts}, Options[Graphics]]];
3 Likes
Hi Rohit,
Thanks for your suggestion! I didn’t know the function FilterRules. That seems better. I will improve my code with it.
Best regards,
Bowen Ping
1 Like
