Tag Info

New answers tagged

4

If we wish to handle an arbitrary list of rules in the second parameter of ReplaceRepeated we can by using a single wrapping rule with a counter and handing off the actual processing to ReplaceAll. This avoids the memory overhead of keeping all intermediate results for FixedPointList. countReplace[expr_, rules_] := Module[{i = -1}, {expr //. all_ ...


4

Here is another solution, that works with a list of rules and with held expressions cRepRep2[expr_, snd_] := {Last@#, Length@# - 2} &@ FixedPointList[# /. snd &, expr] Here is a similar solution, that saves on memory by using FixedPoint rather than FixedPointList. It also works with held expressions cRepRep3[expr_, snd_] := Module[ {c = -1, ...


6

i = 0; number = 11113132434242342342342342535646657758768872132131111119; sumrule = value_ :> (i++; Total[IntegerDigits[value]]); number //. sumrule i This is a quick and dirty way to do this.


4

Option hierarchy Quoting John Fultz: Options work on an inheritance model. ... It all starts someplace. That would be the hard-coded option values in the front end C code. The root of the inheritance of options. Then one typically thinks of $FrontEnd as being the next level down, but there's another level in between. That is ...



Top 50 recent answers are included