This feature would be most useful.

Maybe this is too much context or too tangential, but I typically train
people to use IEx helpers like h and info to find the functions they need.
I also often have them import IEx helpers into Livebook so they can see
protocol information, which also provides clues about how to find modules.
For example:

iex(10)> [1, 2, 3]

[1, 2, 3]

iex(11)> i

Term

  [1, 2, 3]

Data type

  List

Reference modules

  List

Implemented protocols

  Collectable, Enumerable, IEx.Info, Inspect, List.Chars, String.Chars

iex(12)> h Enumerable

...

iex(13)> h Enum

...


This approach works well since Elixir is mostly organized around types.

Having this extra layer to understand operators would make this approach
that much more useful.

Is it interesting to also show where functions come from? e.g.


                       defmacro sigil_w(term, modifiers)



Handles the sigil ~w for list of words.


It returns a list of "words" split by whitespace. Character unescaping and

interpolation happens for each word.


## Modifiers


  • s: words in the list are strings (default)

  • a: words in the list are atoms

  • c: words in the list are charlists


## Examples


    iex> ~w(foo #{:bar} baz)

    ["foo", "bar", "baz"]



    iex> ~w(foo #{" bar baz "})

    ["foo", "bar", "baz"]



    iex> ~w(--source test/enum_test.exs)

    ["--source", "test/enum_test.exs"]



    iex> ~w(foo bar baz)a

    [:foo, :bar, :baz]



    iex> ~w(foo bar baz)c

    [~c"foo", ~c"bar", ~c"baz"]




    *iex> Kernel.sigil_w(<<"foo bar baz">>, 'c')*

*    [~c"foo", ~c"bar", ~c"baz"]*


should provide a hint that it's imported from Kernel. (the last line)


Note that normally this isn't a problem. After importing is_odd from
integer:

h is_odd


                            defmacro is_odd(integer)



guard: true


Determines if integer is odd.


Returns true if the given integer is an odd number, otherwise it returns
false.


Allowed in guard clauses.


## Examples


    iex> *Integer.*is_odd(5)

    true



    iex> *Integer.*is_odd(6)

    false



    iex> *Integer.*is_odd(-5)

    true



    iex> *Integer.*is_odd(0)

    false



-bt

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-7x-oYjLgb6N_PCk526Tmk76Rb1GtYAW_vqj3X_4s8tOw%40mail.gmail.com.

Reply via email to