Skip to content

Instantly share code, notes, and snippets.

View adolfont's full-sized avatar

Adolfo Neto adolfont

View GitHub Profile
@adolfont
adolfont / likert-elixir-forum.r
Last active July 8, 2019 19:22
Generator of Likert-scale plots for Elixir Forum survey data
Input =("
Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18
4 4 4 4 4 4 3 3 4 3 4 4 4 2 3 3 3 2
5 3 4 4 5 4 4 2 3 3 4 3 4 4 4 5 2 5
4 5 5 5 5 4 5 3 3 3 3 3 4 1 3 3 1 3
4 5 5 5 5 5 5 3 4 4 5 3 4 3 5 4 4 4
5 5 5 5 5 3 4 3 3 3 3 3 3 1 5 5 4 5
3 5 4 4 4 3 3 3 3 4 5 3 3 4 2 2 2 2
4 5 5 4 5 2 1 3 1 1 1 1 1 1 5 5 1 4
4 4 4 4 4 4 3 3 3 3 3 3 3 3 4 4 2 5
@adolfont
adolfont / cpl_ex.md
Last active July 12, 2019 10:50
Classical Propositional Logic in Elixir - Blog Post Draft

This was a draft of a blog post that is now published here: Classical Propositional Logic in Elixir

Classical Propositional Logic

I am a professor and I teach Introduction to Logic for Computing. One of the subjects I teach is Classical Propositional Logic. I use a Brazilian book as my main reference but this book is also quite good.

In Classical Propositional Logic there are two truth-values: true and false. A proposition is a declarative sentence which can be either true or false.

Examples of propositions are:

defmodule Cpl do
@moduledoc """
Documentation for Classical Propositional Logoc.
"""
defp arity(connective, language) do
language[:connectives][connective]
end
@spec is_formula(any, any) :: boolean
defmodule CplTest do
use ExUnit.Case
doctest Cpl
import Cpl
@lp %{
atoms: MapSet.new([:p, :q, :r, :s]),
connectives: %{not: 1, and: 2, or: 2, implies: 2}
}
@adolfont
adolfont / tableau.md
Last active July 18, 2019 19:01
Tablôs Analíticos em Elixir

Como representar o tablô?

[Raiz, Esquerda, Direita\]

Início

[Fórmulas do Tablô, , ]
defmodule Geometria do
def pi do
3.1415
end
def circunferencia(raio) do
2 * pi() * raio
end
def area_circulo(raio) do
kl = [name: “Ada Lovelace”, born: 1815, died: 1852, known_for: “mathematics”, known_for: “computing” ]
for x <- [:t, :f], y <- [:t, :f], do: {x,y}
for x <- [:t, :f], y <- [:t, :f], do: [x,y]
for z <- [:t, :f], l <- (for x <- [:t, :f], y <- [:t, :f], do: [x,y]), do: [z, l]
for z <- [:t, :f], l <- (for x <- [:t, :f], y <- [:t, :f], do: [x,y]), do: [z| l]
for z <- [0, 1], l <- (for x <- [0, 1], y <- [0, 1], do: [x,y]), do: [z| l]
for x <- [:t, :f], y <- [:t, :f], do: {x,y}
for x <- [:t, :f], y <- [:t, :f], do: [x,y]
for z <- [:t, :f], l <- (for x <- [:t, :f], y <- [:t, :f], do: [x,y]), do: [z, l]
for z <- [:t, :f], l <- (for x <- [:t, :f], y <- [:t, :f], do: [x,y]), do: [z| l]
for z <- [0, 1], l <- (for x <- [0, 1], y <- [0, 1], do: [x,y]), do: [z| l]