What console output commands are available in Erlang? - erlang

What console output commands are available in Erlang?
I know about io:format but was wondering what other output libraries exist.

For quick debugging, I find quite useful the erlang:display/1.

Related

Is there something like Python help function in Fsharp interactive?

Using Python in command line you can write help(function) to see docstring.
Is there something similar in Fsharp for fsi?
Do you have any tips and tricks for working in fsi anyway?
What is even possible to find out without using IDE? Just from interactive session.
EDIT:
This question is actually addressed to Python guys who know Fsharp as well. I guess MS guys relying on their VS might find my question pretty strange :)
So far it seems that my question has simple answer: NO.
EXAMPLE:
Lets say you are logged to remote computer via console. I dont know whether this is typical or even possible scenario. For some reason I started fsi and now what? Am I lost or do I have some chances to get some help from fsi directly
DISCLAMER:
I know Scott Wlaschins fsharpforfunandprofit.com pretty well. But his example is dedicated to C# users. Pythonists have different workflow.
If you are used to interactive python, and you like the approach, you may have a look at this F# engine for iPython Notebook:
https://github.com/fsprojects/IfSharp
Yes.
Simple introspection can be done by typeof <_> or typedefof<_>.
For example:
typeof<System.Console>;;
In fsi you can use TAB completation, but apperantly just from command line. It is not working in my Xamarin.
Neat trick is to run:
fsi --use:yourfile.fsx
which run your file and let you test it interactively.
For more info you can use in command line fsi.exe --help.

Erlang Shell Working Directory

I am configuring Ideaj to open an Erlang REPL by setting it up as and external tool, however the working directory param is ignored. Is there a way once the REPL is open to switch the working directory?
Within the shell use the command cd("some/path") and it will work pretty much the same way you would expect from an ordinary shell.
This means you can move around your project directories and run c(module_name) and be in the local loading path as well -- which can be pretty convenient when hand-tweaking/testing things.
As an aside... most folks don't use an IDE with Erlang, because the shell has so much stuff already built into it, and your OS itself already has whatever other tools you usually want. I've yet to see someone start with an IDE and stick with it in Erlang (usually wind up becoming either Emacs users or go the vim + coreutils route).
Also, pwd() and ls() work as you'd expect.
Regarding IDEs- I find the Erlang Intellij plugin (http://ignatov.github.io/intellij-erlang/) very usable, and when doing more than relatively short one-offs in vim (with Erlang plugin) the code completion and Find Usages kinds of IDE functionality to be useful.
Give it a shot - YMMV.

GDB debug info parser/description

During the work I faced with the following problem:
I need to parse GDB debug info.
Separate debug info file is a binary, so I can not read it without knowing a format.
So, here is the question:
Is there any ready parser for GDB info, or at least document describing it?
Is there any ready parser for GDB info
There is no such thing. There are various debug info formats (DWARF, STABS, etc.) and multiple consumers of these debug formats (GDB is one such consumer).
If you are on Linux, the default debug format is DWARF, documented here.
I need to parse ... debug info
Depending on your actual needs, readelf -w or already mentioned libdwarf may be appropriate. Or you could write your own parser from scratch, though it's unlikely to be the optimal solution.
You should probably take a look at libdwarf. See http://sourceforge.net/projects/libdwarf/ or http://wiki.dwarfstd.org/index.php?title=Libdwarf_And_Dwarfdump

techniques for parsing interactive input(like a shell)?

I'm working on a program that can be used directly from the command line with options and input files, or entirely interactively like a shell. For the initial execution I'm using GNU's Getopt to parse the command line options.
When being used on a file I'm using Flex and Bison. This simplifies the parsing greatly since the grammar is very simple, but I'm not entirely sure how I should tackle the shell aspect. I have used GNU's readline and history libraries before, when then I did this I relied solely on strtok and many comparisons with nested switch statements. It worked but it seemed kind of like a hack-job too me...
Is there a better way to approach this problem?
For the data input that the shell would allow I was thinking about piping it directly to a temp file and using Flex and Bison again, but for various parameters(like the command line options that Getopt is parsing for me now) is there a better way?
I was toying around with the idea of trying to recycle my getopt code, since its flexible to capture everything and if its not a option I could assume its data and pipe it out. But I'd love a 2nd opinion.
Thanks
Just write it in Python. Use the cmd module to write the shell program and use shlex for parsing input just like the shell.

Where can I find documentation for the Erlang shell?

The Erlang documentation contains the documentation of modules.
Where can I find the documentation of the Erlang shell? (Which is not a module, I suppose.)
This page in the documentation seems to be a starting point. Especially the link in it. Check also the first link in it, with the shell's manpage.
I'm using Getting Started with Erlang, chapter 1.2.1. It's about the shell and brings you up to speed on usage, etc..
I think Erlang shell is also a module.
Take a look at this: Erlang shell
This might also be helpful, as well as this.

Resources