macros

SPSS Macro to Automate Sequential Variable References

霸气de小男生 提交于 2020-01-15 04:34:26
问题 I've had a tough time getting a simple loop to work in SPSS that isn't based on variables. In a nutshell, I want to write !sequentialVars varStr=/Var/ i=/20/. or similar and get: Var1 Var2 Var3 Var4 Var5 ... Var19 Var20 to put into a cTable or anywhere else that takes a string of variable names. In pseudo VB it would be: varString = "AnyVarName" for i=1 to 20 newVarList = concatenate(newVarList," ",varString, i) next i I can't even echo back the i in an SPSS loop, let alone concatenate it.

SPSS Macro to Automate Sequential Variable References

孤人 提交于 2020-01-15 04:33:48
问题 I've had a tough time getting a simple loop to work in SPSS that isn't based on variables. In a nutshell, I want to write !sequentialVars varStr=/Var/ i=/20/. or similar and get: Var1 Var2 Var3 Var4 Var5 ... Var19 Var20 to put into a cTable or anywhere else that takes a string of variable names. In pseudo VB it would be: varString = "AnyVarName" for i=1 to 20 newVarList = concatenate(newVarList," ",varString, i) next i I can't even echo back the i in an SPSS loop, let alone concatenate it.

Is it possible to use __LINE__ in the auto-generated variable name in C?

蓝咒 提交于 2020-01-15 03:21:28
问题 To avoid duplication, I want to use __LINE__ in the auto-generated variable name. #define ROUTE(path, impl) \ char * k##impl##__LINE__##_route = "{"#path":\""#impl"\"}"; But it always be treated as a normal string __LINE__ . Even if I define it as the following, I can not get what I want: #define ROUTE(path, impl) ROUTE_(path, impl, __LINE__) #define ROUTE_(path, impl, line) \ char * k##impl##line##_route = "{"#path":\""#impl"\"}"; 回答1: You need one more level of nesting: #define ROUTE(path,

How ought I run the annotate function in gui-debugger/annotator on a datum?

China☆狼群 提交于 2020-01-15 03:08:19
问题 I am trying to learn how to use the DrRacket debugger's annotate function. My ultimate aim is to build a REPL that you can execute from within a closure and have access to everything that's in scope. (see my previous question on that topic and Greg Hendershott's well-researched answer) For the time being, I'm just trying to explore how the annotate function works. You can see my first exploratory attempt at using it, and the results, here. The error, which is happing inside of the annotator,

Possible bug? xlwings cannot run an Excel macro? [duplicate]

南楼画角 提交于 2020-01-15 01:51:10
问题 This question already has answers here : How do I call an Excel macro from Python using xlwings? (3 answers) Closed 3 years ago . I am having a problem getting xlwings to run a macro from Python. Despite following the code from xlwings documentation, I cannot get xlwings to execute an Excel macro. For instance, in Excel workbook named "Book.xlsm": ' in Excel workbook Book.xlsm Sub Test() Set ws = Worksheets("ABC") ws.Range("A1").Value = 10 End Sub This macro runs OK within Excel. But when I

Solaris and Preprocessor Macros

倖福魔咒の 提交于 2020-01-14 18:49:34
问题 Would someone post the results of cpp -dM < /dev/null from a Solaris 10 or above system? I'm having trouble locating what preprocessor macros are typically defined. Solaris documentation does not discuss it in detail [1], [2], and Google is not being very helpful. Thanks in advance. 回答1: Solaris 11.1 #define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define __CHAR_BIT__ 8 #define __WCHAR_MAX__ 2147483647 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __FLT_EVAL

Solaris and Preprocessor Macros

六月ゝ 毕业季﹏ 提交于 2020-01-14 18:48:30
问题 Would someone post the results of cpp -dM < /dev/null from a Solaris 10 or above system? I'm having trouble locating what preprocessor macros are typically defined. Solaris documentation does not discuss it in detail [1], [2], and Google is not being very helpful. Thanks in advance. 回答1: Solaris 11.1 #define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define __CHAR_BIT__ 8 #define __WCHAR_MAX__ 2147483647 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __FLT_EVAL

Different format of __DATE__ macro

≡放荡痞女 提交于 2020-01-14 10:26:26
问题 C has a predefined macro __DATE__ , that shows the date of the compiled source file . The date is displayed in the format "Mmm dd yyyy" . Is there any way to be formatted this date, using macros ? In this format "yyyy Mmm dd" . Instead of being : Jul 19 2013 Should be : 2013 Jul 19 回答1: In C you could have a macro that generates a compound literal on the fly that has the order that you like, something like #define FDATE (char const[]){ __DATE__[7], __DATE__[8], ..., ' ', ... , '\0' } in all

scala macros: defer type inference

廉价感情. 提交于 2020-01-14 10:16:11
问题 Preamble: this is based on @Travis Brown's macro based solution to copying case class properties. Given: trait Entity[E <: Entity[E]]{self:E=> def id: Int def withId(id: Int) = MacroCopy.withId(self,id) } case class User(id: Int, name: String) extends Entity[User] and the Macro implementation: object MacroCopy { import scala.language.experimental.macros import scala.reflect.macros.blackbox.Context def withId[T](entity: T, id: Int): T = macro withIdImpl[T] def withIdImpl[T: c.WeakTypeTag] (c:

scala macros: defer type inference

徘徊边缘 提交于 2020-01-14 10:15:28
问题 Preamble: this is based on @Travis Brown's macro based solution to copying case class properties. Given: trait Entity[E <: Entity[E]]{self:E=> def id: Int def withId(id: Int) = MacroCopy.withId(self,id) } case class User(id: Int, name: String) extends Entity[User] and the Macro implementation: object MacroCopy { import scala.language.experimental.macros import scala.reflect.macros.blackbox.Context def withId[T](entity: T, id: Int): T = macro withIdImpl[T] def withIdImpl[T: c.WeakTypeTag] (c: