![]() ![]() Then hit Cmd-B to run the file and see the build output as shown in the video. If you're using Sublime Text with the elixir-tmbundle plugin as we are in the videos, you can run an Elixir file by first going to the menu item Tools -> Build System and selecting elixir. We can start an iex session as node inside of a network by passing the -sname option. Then fire up an iex session and you should have shell history. Once you've changed the appropriate file, make sure to either open a new command-line window or source your. bashrc or the like:Įxport ERL_AFLAGS="-kernel shell_history enabled" To enable shell history, add the following line to your. iex> recompile() Compiling 1 file (.ex) :ok iex> recompile() :noop. ![]() We love this feature! Oddly, shell history is disabled by default. When you install Elixir, besides getting the elixir, elixirc and iex executables. The iex shell can keep a history of expressions you've run so you can use up/down arrow keys to traverse the history. Just hit the up arrow to step back in iex history and the down arrow to step forward. Want to re-run something you've already typed in iex? No problem. iex> recompile() Compiling 1 file (. To spend a few minutes reviewing the online documentation for the IEx module. To see all the helper functions at your disposal. Start an iex session and then type h (followed by Return) This recompiles and reloads the given module, which is Servy PACKAGES.TXT Mon Apr 25 13:44: This file provides details on the Slackware packages found in the. To start a session in the context of a project, you need to passįinally, to recompile a module while in iex, use the When you are testing code in Elixir and you’ve made a change to the source file you may want to reload the new code. When you start a standard iex session, it doesn't knowĪbout the paths and dependencies of a mix project. Let’s add another function, notifyall/1: sender/lib/sender.ex The notifyall/1. In fact, even the iex> prompt was not showing. To exit the iex session, press Ctrl+C twice.Īlternatively, you can tell iex to interpret an Elixir file while starting by passing the relative path of the file: Don’t forget to run the recompile () command first if you’ve been running IEx already: Did you notice the delay We had to wait three seconds until we saw the printed output and result. The c helper function compiles the given file in memory, the module ( Servy in this case) is loaded into the session, and any code outside of the module is interpreted. Use the c helper function to compile and run the file: To compile the full project in this case, you can do iex(4)> recompile Compiling 1 file (. The file gets compiled into bytecode (in memory) and then run on an Erlang virtual machine.įire up an iex (Interactive Elixir) session and then Often time I make changes in source code while in IEx session. Run the elixir command with the relative path of the Elixir file: Here's a quick recap of the commands we used in the video to run an Elixir file: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |