Questions tagged [define-syntax]
42 questions
0
votes
1 answer
Token in macro definition was not declared in this scope
I am trying to make a logic system using defines macros for implementation of my logger that will expand into nothing when certain toggles are defined. The problem is that when I stack multiple of these switches one nested inside the other (like…
0
votes
1 answer
Why there is only one method in the define-syntax my-class?
(define-syntax my-class
(syntax-rules ()
[(my-class ( ...)
(method (bigger-x other) (> x (other 'x))))
(define ( ...)
(lambda (msg)
(cond [(equal? msg…

user8314628
- 1,952
- 2
- 22
- 46
0
votes
2 answers
Hygienic macro r7rs : Return second expression value
I'm currently learning some r7rs and I am trying to implement a macro 'begin' as following :
(begin0 expr0 expr1 ... expr2)
With expr being a regular expression (Like (set! x (+ x 1)))
And begin0 as a macro that evaluates all the expression but…

Lucas M
- 13
- 4
0
votes
1 answer
How to tranpose pattern sequence in Scheme macro?
I wrote the following Scheme macro.
(define-syntax join
(syntax-rules ()
((join (var ...) (val ...) ...)
'(((var val) ...)
...))))
When I try it
(join (a b c)
(1 2 3)
(2 4 6)
(3 6 9))
it returns the following…

ceving
- 21,900
- 13
- 104
- 178
0
votes
1 answer
Make my own while loop using "define-syntax-rule"
I am trying to create my own while-loop in racket using the "define-syntax-rule".
I want it to be procedural based, so no helper functions (i.e. just using lambda, let, letrec, etc.).
I have this, but it gives me some sort of lambda identifier…

kmgauthier
- 85
- 1
- 2
- 5
0
votes
1 answer
Define-Syntax Arguments and Usage
I don't really understand the arguments and usage of define-syntax within Scheme. For what it's worth, I'm using Petite Chez Cheme. I've looked at a few sources:
define-syntax issue in scheme
Scheme Macro for nesting…

shane
- 246
- 2
- 17
0
votes
1 answer
How to use #define variable as method parameter in objective C
I'm pretty new to Objective-C and what I want to do is have define variables in the EntityNameConstants.h file where I store all the Entity Names.
And the I will use all the defines in repository for all the methods related to the…

Nikita255
- 15
- 5
0
votes
2 answers
Error during expansion of macro in Chicken Scheme
I'm learning how the macro system in Scheme works and I'm trying to make my code look more JavaScript-y. So I thought I would start with the function macro. This is how I want a function definition to look:
(function id (x) x)
It should expand to…

Aadit M Shah
- 72,912
- 30
- 168
- 299
-1
votes
1 answer
Simulating C/C++ empty defines in Java
I know Java does not have pre-processor, but I struggle to find a way to do this.
I am looking to create macros to improve code readibility, to specify which of the functions or parameters are for input or output specifically. In C, this would be…

IlluSion
- 11
- 5
-1
votes
1 answer
Why #define variable in library is overridden from #define in calling application?
I am trying to a make plugin system which will have a header file for all plugins to include. In that header the version of the plugin system is defined in a #define like so:
PluginHeader.hpp:
#define PLUGIN_SYSTEM_VERSION "00.001"
class…

Yann
- 180
- 3
- 14
-1
votes
1 answer
Custom pattern-matching facility for Chez Scheme
I am trying to make my own pattern-matching system in Scheme. To begin I am making a parser for s-expressions that divides them into tokens like this:
'(1 2 b (3 4)) => '(number number symbol (number number))
It should be noted that I have not used…

Caspian Ahlberg
- 934
- 10
- 19
-1
votes
1 answer
How to pass a variable to the define macro used for accessing the path in system verilog
I am using a define macro to set the path for a module,
ie,
`define DUT_PATH(CH) dut_top.u_channel_```CH``_mode
and using this define macro in a module where we are passing the channel number ,
module channel_oper # (int channel_num = 0)
(
input…

Anu
- 1
- 1
- 2