57 lines
No EOL
5.9 KiB
HTML
57 lines
No EOL
5.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>CLiki: ugly-tiny-infix-macro</title>
|
|
<link rel="alternate" type="application/atom+xml" title="ATOM feed of edits to current article"
|
|
href="https://www.cliki.net/site/feed/article.atom?title=ugly-tiny-infix-macro">
|
|
<link rel="stylesheet" href="static/css/style.css">
|
|
<link rel="stylesheet" href="static/css/colorize.css">
|
|
</head>
|
|
|
|
<body>
|
|
<span class="hidden">CLiki - ugly-tiny-infix-macro</span>
|
|
<div id="content"><div id="content-area"><div id="article-title">ugly-tiny-infix-macro</div><div id="article">This is a powerful lisp macro for the purpose of writing your expressions in <a href="infix.html" class="category">infix</a> notation while not losing out on lisp's power.<p><h2>Examples</h2><p>At its simplest, <p><div class="code"><span class="nonparen"> <span class="paren1">(<span class="nonparen">$ 1 <a href="https://www.cliki.net/site/HyperSpec/Body/any_pl.html" class="symbol">+</a> 2</span>)</span> <span class="comment">; gets converted to (+ 1 2), where name of the macro is $
|
|
</span> <span class="paren1">(<span class="nonparen">$ <a href="https://www.cliki.net/site/HyperSpec/Body/any_t.html" class="symbol">t</a> <a href="https://www.cliki.net/site/HyperSpec/Body/any_and.html" class="symbol">and</a> <a href="https://www.cliki.net/site/HyperSpec/Body/any_nil.html" class="symbol">nil</a></span>)</span> <span class="comment">; gets converted to (and t nil)
|
|
</span> <span class="paren1">(<span class="nonparen">$ 3 > 5</span>)</span> <span class="comment">; gets converted to (> 3 5)
|
|
</span> <span class="paren1">(<span class="nonparen">$ 1 <a href="https://www.cliki.net/site/HyperSpec/Body/any_pl.html" class="symbol">+</a> 2 <a href="https://www.cliki.net/site/HyperSpec/Body/any_pl.html" class="symbol">+</a> 3</span>)</span> <span class="comment">; gets converted to (+ (+ 1 2) 3)
|
|
</span> <span class="paren1">(<span class="nonparen">$ 1 <a href="https://www.cliki.net/site/HyperSpec/Body/any_pl.html" class="symbol">+</a> 2 <a href="https://www.cliki.net/site/HyperSpec/Body/any_st.html" class="symbol">*</a> 3</span>)</span> <span class="comment">; gets converted to (+ 1 (* 2 3))
|
|
</span> <span class="paren1">(<span class="nonparen">$ 1 < 2 <a href="https://www.cliki.net/site/HyperSpec/Body/any_and.html" class="symbol">and</a> 2 < 3</span>)</span> <span class="comment">; gets converted to (AND (< 1 2) (< 2 3))</span></span></div><p>Anything within parentheses at position of an operand is treated like a lisp form.<p><div class="code"><span class="nonparen"> <span class="paren1">(<span class="nonparen">$ 2 <a href="https://www.cliki.net/site/HyperSpec/Body/any_pl.html" class="symbol">+</a> <span class="paren2">(<span class="nonparen"><a href="https://www.cliki.net/site/HyperSpec/Body/fun_maxcm_min.html" class="symbol">max</a> 9 10 11</span>)</span></span>)</span> <span class="comment">; gets converted to (+ 2 (max 9 10 11)). It could have been any function / lisp form.
|
|
</span> <span class="paren1">(<span class="nonparen">$ 6 / <span class="paren2">(<span class="nonparen">$ 1 <a href="https://www.cliki.net/site/HyperSpec/Body/any_pl.html" class="symbol">+</a> 2</span>)</span></span>)</span> <span class="comment">; gets converted to (/ 6 ($ 1 + 2)), and then subsequently to (/6 (+ 1 2))</span></span></div><p>You can find more information on the <a href="https://github.com/peey/ugly-tiny-infix-macro/blob/master/README.md">README</a> on github. It's also available on quicklisp.<p><b>Project Homepage</b>: <a href="https://github.com/peey/ugly-tiny-infix-macro">https://github.com/peey/ugly-tiny-infix-macro</a><p><b>License</b>: <a href="Apache 2.html" class="category">Apache 2</a></div></div>
|
|
<div id="footer" class="buttonbar"><ul><li><a href="ugly-tiny-infix-macro.html">Current version</a></li>
|
|
<li><a href="https://www.cliki.net/site/history?article=ugly-tiny-infix-macro">History</a></li>
|
|
<li><a href="https://www.cliki.net/site/backlinks?article=ugly-tiny-infix-macro">Backlinks</a></li><li><a href="https://www.cliki.net/site/edit-article?title=ugly-tiny-infix-macro&from-revision=3825254789">Edit</a></li><li><a href="https://www.cliki.net/site/edit-article?create=t">Create</a></li></ul></div>
|
|
</div>
|
|
<div id="header-buttons" class="buttonbar">
|
|
<ul>
|
|
<li><a href="https://www.cliki.net/">Home</a></li>
|
|
<li><a href="https://www.cliki.net/site/recent-changes">Recent Changes</a></li>
|
|
<li><a href="CLiki.html">About</a></li>
|
|
<li><a href="Text Formatting.html">Text Formatting</a></li>
|
|
<li><a href="https://www.cliki.net/site/tools">Tools</a></li>
|
|
</ul>
|
|
<div id="search">
|
|
<form action="https://www.cliki.net/site/search">
|
|
<label for="search_query" class="hidden">Search CLiki</label>
|
|
<input type="text" name="query" id="search_query" value="" />
|
|
<input type="submit" value="search" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div id="pageheader">
|
|
<div id="header">
|
|
<span id="logo">CLiki</span>
|
|
<span id="slogan">the common lisp wiki</span>
|
|
<div id="login"><form method="post" action="https://www.cliki.net/site/login">
|
|
<label for="login_name" class="hidden">Account name</label>
|
|
<input type="text" name="name" id="login_name" class="login_input" />
|
|
<label for= "login_password" class="hidden">Password</label>
|
|
<input type="password" name="password" id="login_password" class="login_input" />
|
|
<input type="submit" name="login" value="login" id="login_submit" /><br />
|
|
<div id="register"><a href="https://www.cliki.net/site/register">register</a></div>
|
|
<input type="submit" name="reset-pw" value="reset password" id="reset_pw" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body></html> |