syntax-rules

Sources for learning about Scheme Macros: define-syntax and syntax-rules

I've read JRM's Syntax-rules Primer for the Merely Eccentric and it has helped me understand syntax-rules and how it's different from common-lisp's define-macro. syntax-rules is only one way of implementing a syntax transformer within define-syntax. I'm looking for two things, the first is more examples and explanations of syntax-rules...

How can I closely achieve ?: from C++/C# in Python?

In C# I could easily write the following: string stringValue = string.IsNullOrEmpty( otherString ) ? defaultString : otherString; Is there a quick way of doing the same thing in Python or am I stuck with an 'if' statement? ...

What does the “|” sign mean in Python?

This question originally asked (wrongly) what does "|" mean in Python, when the actual question was about Django. That question had a wonderful answer by Triptych I want to preserve. ...

Emacs Lisp syntax highlighting

I want to write a syntax highlighting extension for Emacs, but I Googling of variations on "emacs syntax highlight tutorial" have all failed. How do I go about learning how to write an Emacs highlighter? What good resources are there for learning how to do such things? ...

Please refactor my macro in Scheme

I am learning hygiene and I tried to make a simple for loop in Scheme. I want to support three kinds of constructs as shown in example below (for i = 1 : (< i 4) : (++ i) (printf "Multiplication Table for ~s\n" i) (for j = 1 to 5 (printf "~s * ~s = ~s\n" i j (* i j)))) I want to also support for loops with filters like this:...

How are vector patterns used in syntax-rules?

Hi, I have been writing Common Lisp macros, so Scheme's R5Rs macros are a bit unnatural to me. I think I got the idea, except that I don't understand how one would use vector patterns in syntax-rules: (define-syntax mac (syntax-rules () ((mac #(a b c d)) (let () (display a) (newline) (display d) (...

Implicit currying in Scheme with syntax-rules?

Jeffrey Meunier has an implicit Curry macro here, which uses defmacro. I was wondering if someone has ever written this with syntax-rules? ...