Tag Info

Hot answers tagged


Unless both lists given to Equal are packed arrays Equal will first unpack. Unfortunately for this case {} is not a packable expression, therefore list == {} will always unpack list, assuming it starts packed. That unpacking takes time: test = RandomInteger[100000000, 10000000]; Developer`FromPackedArray[test]; // AbsoluteTiming {0.207012, Null} ...


You need to construct your desired expression without unwanted evaluation of its constituent parts. Here is one approach to do that: makeTest[{tests__}] := Replace[And[tests] &, fn_ :> fn[#], {2}] This works because the surrounding Function prevents evaluation before and after the Replace operation. Example: f1[x_] := (Print["First"]; x > ...

Only top voted, non community-wiki answers of a minimum length are eligible