ProductPromotion
Logo

Clojure

made by https://0x3d.site

GitHub - ztellman/riddley: code-walking without caveats
code-walking without caveats. Contribute to ztellman/riddley development by creating an account on GitHub.
Visit Site

GitHub - ztellman/riddley: code-walking without caveats

GitHub - ztellman/riddley: code-walking without caveats

Walker is my name
and I am the same.
Riddley Walker.
Walking my riddels
where ever theyve took me
and walking them now
on this paper the same.

from Riddley Walker by Russell Hoban


Code may be data, but only some of that data is executable. If we want to perform a pervasive code transformation, using something like clojure.walk presents a few problems:

  • binding forms are treated the same as actual expressions
  • clojure.walk/macroexpand-all will pass in a nil &env to all macros
  • macroexpansion doesn't expand inlined functions

This means that transforms that we intend to apply to expressions may have unintended consequences on a fn, let, or case form. It also means that any macro which relies on &env will not compose with our transformation. Finally, if inlined functions aren't expanded, certain transformations will break.

usage

Build Status

[riddley "0.2.0"]

Riddley provides a correct riddley.walk/macroexpand-all, which preserves the binding information in &env and expands inlined functions, and riddley.walk/walk-exprs, which is a general mechanism for code walking and transformation.

walk-exprs takes two arguments, a predicate for whether it should transform the sub-form, and a handler for doing the transformation.

riddley.walk> (walk-exprs number? inc '(let [n 1] (+ n 1)))
(let* [n 2] (. clojure.lang.Numbers (add n 2)))

Notice that walk-exprs implicitly macroexpands the form, including the inline form for +. Unlike clojure.walk, if handler is called, sub-forms will not be walked. The handler function is responsible for recursively calling walk-exprs on the form it's handed.

Access to &env is available via (riddley.compiler/locals) if you need it as part of your transformation.

Full documentation can be found here.

license

Copyright © 2013 Zachary Tellman

Distributed under the MIT License.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory