hst337
Hi there,
I’ve been working on a Pathex library for quite a while now, and I’ve finally managed to create a release which is able to cover all requirements in nested structures access. Think of Pathex as Elixir’s Access but on steroids, or like Clojure’s Spectre but easier to learn and more efficient.
Features
-
Efficient in time. It’s 2-5 times faster than
Access.HTMLmanipulations withPathexare 5 times faster thanFloki. To achieve this efficiency,Pathexgenerates pattern-matching cases at compile-time. -
Easy to use.
Pathexis like aMaporEnummodule, but for any structures. At it’s tiny core, it has everything you might need in your development needs. Errors are very descriptive. And I’ve put some effort into the documentation to be easy to navigate -
Functional.
Pathexis built around functional lens idea, but it differs in some ways from it. -
Rich toolkit.
Pathexworks fine with lists, tuples, maps, structures, nested structures like AST or HTML.Pathexis reusable, because composition of two paths creates another path and so on.
Feedback
Feedback is really appreciated. I’d like to know what you’re thinking about library design because this library tries to extend the language!
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 10 of 22 Posts
josevalim
Great project and documentation!
Will-W
This looks great and I already have some use cases for it.
I like the design too - like the separation of the definition of the paths. I can see it would allow for cleaner code: separation of the definition of the structure of your data from the code that manipulates it.
emoragaf
This looks awesome, great work!
I was looking at the Lenses docs and it wasn’t really clear to me the difference between
matchingandfiltering(both the description and the examples are exactly the same)Doc content in general is really good, but maybe some reordering could be helpful to clarify some things, e.g: cover the combinator syntax before the examples in the cheat sheet.
hst337
Thanks, I’ll a basic syntax in the Cheatsheet
hst337
The difference between
matchingandfilteringis thatmatchingaccepts pattern as a predicate. For examplewill work only with values, which match the pattern
%{role: :admin}.And
filteringlens supports any predicate as a function passed into it. For example,This lens does essentially the same as a
matchinglens above.As you can see, every lens created with
matchingcan be expressed withfiltering, butmatchingis easier to write, read and a is little bit faster thanfilteringalex_r
Loving this. I work with deep (up to 10 levels) sports stats data and this could be my ticket to code reduction. Thanks!
l3nz
Spectre is/was a great idea, though it did not get the adoption it deserved. Not very easy to get started with.
Pathex seems to be an improvement - I was looking for something like that myself, because working with immutable nested structures is a pain.
krstfk
This project is really great, and it’s gonna be a dependency for all of my future projects. I’m only worried that I might end up over using it. I kind of wish there was something like this in the standard library since nested data structures are so pervasive. And I really like the fact that you can throw maps, keyword list, and tuples, nested any which way without worrying about it.
In other words, thank you!
thisiscetin
Just tweeted about it from theelixirbook account.
Great job, kudos.
hst337
Released 2.1 just now, check out new features and fixes in changelog