Latest #macros Threads 
I want to model the following relationship:
A location has zero or one of multiple (currently 7) specifications (each specification is a...
New
Hey folks,
I made a tiny macro that lets you assign a piped value to a variable without breaking the flow. For example:
data
|> tran...
New
iex(25)> quote do
...(25)> 1 |> rem(2) |> div(4)
...(25)> end |>
...(25)> Macro.expand(__ENV__) |>
...(25)> Ma...
New
Hi!
I have a piece of code that parses some json and creates validations from them. In one place, I need to create a regular expression ...
New
I have a macro that is used for parsing:
defmacro left <~> right do
quote do
case unquote(left) do
:error ->...
New
I have some AST rewriting code (using Sourceror) that has started failing in Elixir 1.18 – I believe because unquote has become stricter ...
New
Hi,
I’m experimenting with macros to create a framework for defining a sort of tests.
I’m trying to figure out how to create a graph of...
New
Hex: bin_struct | Hex
Git: GitHub - 4ait/bin_struct
Docs: bin_struct v0.2.34 — Documentation
BinStruct is a library which main functio...
New
I would like to write a macro that replaces one identifier with another, but it needs to respect lexical scope.
Here is an example illus...
New
I am trying to write a macro to define a custom operator
defmacro infix_function(op, function) do
quote do
def (a unquote(op...
New
This Week's Trending
This Month's Trending
This Year's Trending
I want to model the following relationship:
A location has zero or one of multiple (currently 7) specifications (each specification is a...
New
Last Three Year's Trending
I've forked an abondoned hex-package and continue to maintain it under a new name.
The old code-base does provide a macro that we call ...
New
It is rare to use direct calls to send in elixir. The call is normally wrapped in a function which is responsible for sending the correct...
New
I can dynamically define functions in a “loop” like this:
defmodule Foo do
for {f, i} <- [{:foo, "foo"}, {:bar, "bar"}] do
def ...
New
I’m working on a cool library (news about that in a few weeks :smiley:), and there’s no sugar coating this: I really want to use inherita...
New
Can Elixir code detect whether it is executing at compile time? I would like to write something like the following macro:
defmacro foo()...
New
I am trying to define a macro that defines a render(assigns) function but the compiler keeps rejecting the sigil, claiming that no assign...
New
Hey y’all so i’m working on a project that takes in Ecto schema and generates JSONSchemas for them. Part of the project requires that the...
New
I’m currently writing a specie of DSL and I’m trying to understand how can I escape an anonymous function in a module attribute. I’m not ...
New
I wanted to create a way to “safely” evaluate a string containing Elixir code. The code in the string should not be allowed to use any fu...
New
Hi,
I’m trying to create some syntactic sugar through a macro. The basic function should look like the following:
f :name do
data.som...
New
Hello all,
I need to convert AST with possible long binary to string.
Macro.to_string() uses Inspect and Inspect has the printable_limi...
New
Summary
I am currently trying to get a better understanding of elixir macros and in doing so encountered the section about dynamic querie...
New
I’m trying to identify function calls. My current solution seems to be working, but I’m not sure what are the edge cases I should test fo...
New
Hey folks,
I made a tiny macro that lets you assign a piped value to a variable without breaking the flow. For example:
data
|> tran...
New
I have a question regarding a code snippet from part 6 of a really great Macros guide by @sasajuric.
This question specifically ranges f...
New
Trending Over Three Years
Currently I am writing a small macro which adds authorization functionality to a function. Rewrite ‘def’ to ‘defprot’ and add the rules t...
New
Hi,
I am writing the Elixir integration for AppSignal, an application metrics solution. As of such, I am looking for a way to decorate ...
New
In a macro, can you access a module attribute outside quote?. I know about Module.get_attributes/2 but I can only get it to work inside ...
New
Do you think theres a way to write a function that matches a list of patterns with a list of values ignoring order? We use UXID and inser...
New
Hi,
When writing the following code, elixir correctly and thankfully warns that there is a conflict:
function/macro 1:
defmacro static...
New
I have been updating a library that allows you to pipe between functions that use the erlang result tuple convention.
Assuming you have...
New
Hi community!
What is the correct way to implement the __using__ macro with an option that changes the way generated functions behave? O...
New
Hi everyone, I was toying around with macros today and I reached a stagnation point. After trying multiple approaches I started to think ...
New
Certain kinds of algorithms can be sped up (or even: are only possible) by using cyclic data structures. Functional languages make it har...
New
I'm trying to do something similar to wath ecto does when defining schemas. Basically the idea is:
defmodule Test do
use TableBuilder...
New
Hi.
I am making a library for user submitted templates (so users can customize email content). I have a parser which parses the template...
New
I'm trying to implement a conceptual test with the following macro. I want to be able to pass an action argument which will call a funct...
New
In iex, this I can do this:
quote do
unquote(%{})
end
And get the expected:
%{}
But for some reason, in the macro I’m working on...
New
I’m using the __using__ macro to define some boilerplate code. One of the functions defined in the macro is a different arity of a functi...
New
I’m struggling with overriding hygiene during manual manipulation of AST with Macro.postwalk. In short, I want to provide a syntax for in...
New
Latest on Elixir Forum
Get money off!
The Pragmatic Bookshelf
35% off any eBook
Manning Publications
45% off any item
ElixirCasts
10% off for life
The Pragmatic Studio
20% off any course
AppSignal
10% off for 12 months
Honeybadger
10% off for 12 months
Simply use coupon code "devtalk.com" or "elixirforum" at checkout!
Filter by Type:
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #ash-questions
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #exunit
- #discussion
- #javascript
- #elixirconf
- #library
- #oban-questions
- #dialyzer
- #docker
- #onsite
- #authentication
- #podcasts
- #full-time-contract
- #umbrella
- #code-sync
- #ecto-query
- #phoenix_html
- #iex
- #graphql
- #genstage
- #elixir-ls
- #nerves-questions
- #podcasts-by-brainlid
- #supervisor
- #websockets
- #distillery
- #advent-of-code
- #blog-post
- #livebook-questions
- #processes
- #forms
- #api
- #metaprogramming







