Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7282

Re: Variables within With statement

From Simon <simonjtyler@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Variables within With statement
Date 2011-12-16 11:07 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jcf8pe$71p$1@smc.vnet.net> (permalink)
References <jccg39$mb4$1@smc.vnet.net>

Show all headers | View raw


This has come up a few time recently on this mathgroup and stackoverflow:

https://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/6fa6b0ad9d5d111c
http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/3a5ae92bda1c7511
http://stackoverflow.com/a/5692010/421225
http://stackoverflow.com/a/4191096/421225

For what it's worth, here's the various versions I keep floating around

SetAttributes[Let, HoldAll];
SyntaxInformation[Let] = {"ArgumentsPattern" -> {{__}, _}};
Let[{}, expr_] := expr
Let[{a_, b___}, expr_] := With[{a}, Let[{b}, expr]]
SetAttributes[WithRules, HoldRest]
WithRules[rules_, expr_] := With@@Append[Apply[Set, Hold@rules, {2}], Unevaluated[expr]]
SetAttributes[LetRules, HoldRest]
LetRules[rules_, expr_] := Let@@Append[Apply[Set, Hold@rules, {2}], Unevaluated[expr]]

Simon

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Variables within With statement "Harvey P. Dale" <hpd1@nyu.edu> - 2011-12-15 09:53 +0000
  Re: Variables within With statement Simon <simonjtyler@gmail.com> - 2011-12-16 11:07 +0000
  Re: Variables within With statement markholtuk <markholtuk@googlemail.com> - 2011-12-17 07:39 +0000
    Re: Variables within With statement Szabolcs <szhorvat@gmail.com> - 2011-12-20 08:09 +0000
      Re: Variables within With statement markholtuk <markholtuk@googlemail.com> - 2011-12-22 09:26 +0000
  Re: Variables within With statement "Alexander Elkins" <alexander_elkins@hotmail.com> - 2011-12-17 07:49 +0000

csiph-web