Skip to content

Instantly share code, notes, and snippets.

View stormwatch's full-sized avatar

Ezequiel Birman stormwatch

View GitHub Profile
@stormwatch
stormwatch / myverb.org
Last active December 28, 2020 23:27
Learning verb.el and org mode

Goal

I am learning Vagrant and friends. I am currently writing a document in Org Mode where I intend to compare different providers and boxes. Ideally I’d like to automate and generate the comparision dynamically. Vagrant provides an API to query their box cloud registry. It is not very sofisticated in terms of searching but it sort of works.

My initial efforts with verb.el are geared towards getting simple results, then maybe I can manage to generalize the functions and code blocks in order for them to accept arguments.

-module(super).
-export([super/0]).
%% Comments on killing processes
%% 1. Without a supervisor:
%% evaluating ~exit(Pid,kill)~ kills Pid but the listener keeps looping.
%% If we were to kill the listener instead with ~exit(whereis(echo), kill)~ then
-module(text).
-export(
[
format/1,
rio/0,
super/0,
take_line/1,
take_line/2,
take_paragraph/1,
-module(index).
-export([create/1]).
create(Name) ->
{ok,File} = file:open(Name,[read]),
create(File, 1, #{}).
create(File, Line_number, Map) ->
case io:get_line(File,"") of
eof -> file:close(File),
-module(two18).
-export([double/1, double2/1, evens/1, evens2/1, median/1, count_elements/1, modes/1]).
%% Define an Erlang function double/1 to double the elements of a list of
%% numbers.
double([]) ->
[];
double([X | Xs]) ->
-module(two15).
-export([product/1, product_tr/1, maximum/1, maximum_tr/1]).
product([X]) ->
X;
product([X|Xs]) ->
X * product(Xs).
product_tr([X|Xs]) ->
@stormwatch
stormwatch / two8.erl
Last active May 23, 2020 03:17
2.8 Pulling it all together (second week assignment)
-module(two8).
-export([perimeter/1, area/1, enclose/1, bits/1, bits_tr/1]).
%% Shapes
%% Define a function perimeter/1 which takes a shape and returns the perimeter
%% of the shape.
%% Choose a suitable representation of triangles, and augment area/1 and
-module(perfect).
-export([perfect/1]).
perfect(N) ->
perfect(N, 2, 1).
perfect(N, D, Sum) when D * 2 < N, Sum < N ->
if
N rem D =:= 0 ->
-module(one15).
-export([xOr1/2, xOr2/2, xOr3/2, xOr4/2, xOr5/2, xOr6/2, xOr7/2, maxThree/3, howManyEqual/3, howManyEqual2/3, howManyEqual3/3]).
%% first example given by Prof. Thompson
xOr1(true, false) ->
true;
xOr1(false, true) ->
true;
xOr1(_,_) ->
false.
[Trace - 02:01:34 ] Sending request 'initialize - (1)'.
Params: {
"processId": null,
"rootPath": "/usr/local/src/cursos/Erlang/2020 Thompson",
"clientInfo": {
"name": "emacs",
"version": "GNU Emacs 26.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.13)\n of 2020-01-28"
},
"rootUri": "file:///usr/local/src/cursos/Erlang/2020%20Thompson",
"capabilities": {