Skip to content

Instantly share code, notes, and snippets.

@bruce
bruce / color.ex
Created February 8, 2017 17:35
Extending an Absinthe schema using custom, app-specific macros
defmodule MyApp.Color do
@moduledoc """
Just an example source of the values
"""
def list do
~w(red green blue)a
end
toArray = (d) -> [].slice.call(d)
currify = (fn, args, remaining)->
if remaining < 1
return fn.apply(null, args)
->
currify(fn, args.slice(0, fn.length - 1).concat(toArray(arguments)), remaining - arguments.length)