2,602 reputation
935
bio website
location
age
visits member for 2 years, 9 months
seen Oct 26 at 1:19

Oct
23
awarded  Good Question
Oct
19
comment How to write complex function definitions at run time?
@MrW interesting that ToHeldExpression, deprecated since v3.0 in 1996, cannot be replaced by ToExpression or Symbol/@ lest the symbols leak. A lot going on in listWith.
Oct
19
comment How to write complex function definitions at run time?
Ok, it was a stray ClearAll on defWithOpts2. I have a habit of writing ClearAll and SetAttributes right above every definition, and I had one too many :(
Oct
19
comment How to write complex function definitions at run time?
@MrW yeah, I am still investigating; I am definitely getting messages ConstantArray::ilsmn: "Single or list of non-negative machine-sized integers expected at position 2 of ConstantArray[Null,size]. " and Join::normal: "Nonatomic expression expected at position 1 in Join[size]. " in MMA 10.0.1.0. I do get the correct result.
Oct
19
comment Metaprogramming in Mathematica
Totally agree that metaprogramming is the future of Wolfram / Mathematica. I am really feeling the lack of a comprehensive, composable methodology for it as I attempt a translation of a large body of common lisp code to MMA. For now, I am backing off metaprogramming per se because the effort is turning into bikeshedding on my real task (translating the lisp code). I have just read "Let Over Lambda," "Land of Lisp," "On Lisp," and "Practical Common Lisp" and now opine that creating in Wolfram the level of MP available in CL and Clojure will be a multi-year job.
Oct
19
comment How to write complex function definitions at run time?
The following works cleanly: ClearAll[sampleFunction2]; defWithOpts2[ sampleFunction2, <|"size" -> 10|>, size]; sampleFunction2[] but the following works, but with ugly warnings :( ClearAll[sampleFunction3]; defWithOpts2[ sampleFunction3, <|"size" -> 10|>, Module[{xs = ConstantArray[Null, size]}, xs]]; sampleFunction3[]
Oct
18
awarded  Excavator
Oct
18
revised Constructing symbol definitions for With
punctuation
Oct
18
revised Best practice of passing a large number of parameters to functions
insert clarifying "to"
Oct
18
revised How to set Block local variables by code?
punctuation
Oct
17
revised Best practice of passing a large number of parameters to functions
grammar and punctuation tweaks
Oct
16
accepted How to write complex function definitions at run time?
Oct
16
comment How to write complex function definitions at run time?
@Mr. Wizard, yep, you're right; I should have seen this and I deserve the -1.
Oct
16
awarded  Quorum
Oct
16
answered How to write complex function definitions at run time?
Oct
16
asked How to write complex function definitions at run time?
Oct
15
comment Automating constructor definitions (OptionValue eval time)?
ok, concur. I changed the title & vote to close.
Oct
15
revised Automating constructor definitions (OptionValue eval time)?
edited title
Oct
15
comment Automating constructor definitions (OptionValue eval time)?
Yup, changed Evaluate@Association[MapThread[Rule, {keys, OptionValue /@ keys}]] to Association[MapThread[Rule, {keys, OptionValue[#]&/@ keys}]] and it works :) Promote to an answer and I'll accept it. Thanks much!
Oct
15
asked Automating constructor definitions (OptionValue eval time)?