Questions tagged [elixir-iex]

Elixir’s interactive shell.

iex is Elixir’s interactive shell, which can be used to interactively run Elixir code from the command line.

150 questions
1
vote
1 answer

Unexpected tail value after destructuring List of integers in Elixir

iex(1)> [foo|bar] = [2,3,4,5,6,7] [2, 3, 4, 5, 6, 7] iex(2)> foo 2 iex(3)> bar [3, 4, 5, 6, 7] iex(4)> [foo|bar] = [6,7,8] [6, 7, 8] iex(5)> foo 6 iex(6)> bar '\a\b' I would have expected bar to be [7,8] in the end, however it has the value…
P Varga
  • 19,174
  • 12
  • 70
  • 108
1
vote
1 answer

undefined function sigil_I/2 (there is no such import)

I am working on RDFGraph using elixir. I am running the following command on iex: iex(1)> DC.format(~I, ~L"Paper") and get this error: ** (CompileError) iex:1: undefined function sigil_I/2 (there is no such import) The…
munim
  • 33
  • 10
1
vote
1 answer

iex.iexs file is not loading on test environment

I'am trying to load the iex.iexs file when debugging a test. I created an alias in Mix.exs that tries to import it. defp aliases do [ ..., "ex.file": [&import_iex_file/1, "compile"] ] end defp import_iex_file(_var) do …
Lilith
  • 13
  • 3
1
vote
0 answers

How do I import .iex.exs automatically before hitting a pry breakpoint in iex?

When starting iex normally (iex -S mix or iex), it will run the .iex.exs file in the current directory (or ~/.iex.exs). If running tests, if there is a pry (require IEx; IEx.pry) it will pause execution and open a prompt. However this means that…
Freedom_Ben
  • 11,247
  • 10
  • 69
  • 89
1
vote
1 answer

Elixir/Erlang: Error when a variable list merge with many other lists

I have this function: defp get_list(map, l, i) do list = l ++ map where map is the new list who comes every repetition, so l is merged with it and attributed to list it works great for a small number of pages, the problem is when lots of pages…
1
vote
3 answers

How to start Phoenix server when you are already in iex?

I know we can launch iex -S mix phoenix.server. But say I am already in iex -S mix. What can I do to get the server started? Thank you.
1
vote
3 answers

Elixir: How to get bit_size of an Integer variable?

I need to get the size of bits used in one Integer variable. like this: bit_number = 1 bit_number = bit_number <<< 2 bit_size(bit_number) # must return 3 here the bit_size/1 function is for 'strings', not for integers but, in the exercise, whe…
Sérgio B.
  • 35
  • 6
1
vote
2 answers

Elixir IEx shell, how to break out of current `receive` block

I'm new to elixir, experimenting around in iex shell to learn, and I have be a noob question. For simplicity let's call the current shell session process the "main process". I spawn a child process, write a receive block in "main process" to listen…
hackape
  • 18,643
  • 2
  • 29
  • 57
1
vote
3 answers

wxmac elixir error when trying to run :observer.start in iex

After running :observer.start in iex I received the follwing messages. I tried uninstalling and reinstalling both Elixir and Homebrew but to no avail. objc[58977]: Class wxNSProgressIndicator is implemented in both…
Kenny
  • 21
  • 1
  • 2
1
vote
2 answers

Force carriage returns in IEx Ports' stderr?

If I open a Port in IEx for a script that prints anything to stderr, none of the output is printed with carriage returns. How can I fix this? I am running external software whose output I cannot control, so I can't just add the returns…
Ian Hunter
  • 9,466
  • 12
  • 61
  • 77
1
vote
1 answer

How can I run batch in a shell?

I want to have a batch file that opens the command prompt, launches the iex shell within it and then starts my elixir program. The issue I'm having is that as soon as I invoke iex -S mix, which compiles the code and opens the elixir shell, then I am…
C. K.
  • 71
  • 1
  • 11
1
vote
1 answer

Elixir regex matching literal backslash

Surprisingly the regex matcher does not match backslash correcly. For example Regex.split(~r{\\}, "C:\foo\bar") ["C:\foo\bar"] Regex.match?(~r/\\/, "C:\foo\bar") false I would expect a positive match, but maybe I'm escaping \ wrong. Let's test…
Arijoon
  • 2,184
  • 3
  • 24
  • 32
1
vote
2 answers

How to retrieve all of the loaded modules in `iex`?

I wanted to know if there was a standard NotImplementedError I could pass to Kernel.raise/1. I was curious whether I could figure out (beyond just trying it) whether that module existed. More generally, it seems useful to be able to search or even…
Kenny Evitt
  • 9,291
  • 5
  • 65
  • 93
1
vote
1 answer

Fixing arrow keys in IEX in TMUX session

I use TMUX and vim for everything, and recently started working with Elixir. Whenever I run an elixir process, including iex -S mix, I cannot use the error keys as it instead prints out ^[[A for the up arrow, ^[[B for the down arrow, etc. How can I…
cadlac
  • 2,802
  • 3
  • 18
  • 34
1
vote
2 answers

(Ecto.Query.CompileError) Tuples can only be used in comparisons with literal tuples of the same size. - Elixir

Where I'm at For this example, consider Friends.repo Table Person has fields :id, :name, :age Example Ecto query: iex> from(x in Friends.Person, where: {x.id, x.age} in [{1,10}, {2, 20}, {1, 30}], select: [:name]) When I run this, I get relevant…
Kaushik Evani
  • 1,154
  • 9
  • 17