├── README.md
├── anotacoes
├── dezembro-2020
│ ├── 25-12-2020.md
│ ├── 26-12-2020.md
│ └── 27-12-2020.md
├── fevereiro-2021
│ ├── 02-02-2021.md
│ └── 07-02-2021.md
└── janeiro-2021
│ ├── 10-01-2021.md
│ ├── 24-01-2021.md
│ ├── 25-01-2021.md
│ ├── 30-01-2021.md
│ └── 31-01-2021.md
└── exemplos
└── aplicacao-1
├── .gitignore
├── .idea
├── .gitignore
├── .name
├── ClojureProjectResolveSettings.xml
├── compiler.xml
├── libraries
│ ├── Leiningen__clojure_complete_0_2_5.xml
│ ├── Leiningen__nrepl_0_6_0.xml
│ ├── Leiningen__org_clojure_clojure_1_10_1.xml
│ ├── Leiningen__org_clojure_core_specs_alpha_0_2_44.xml
│ └── Leiningen__org_clojure_spec_alpha_0_2_176.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── aplicacao-1.iml
├── doc
└── intro.md
├── project.clj
├── src
└── aplicacao_1
│ └── core.clj
└── test
└── aplicacao_1
└── core_test.clj
/README.md:
--------------------------------------------------------------------------------
1 | # **Aprendendo Clojure.**
2 |
3 | Olá, comecei a estudar clojure com o intuito de aprofundar meu conhecimento no paradigma funcional e decidi mapear aqui minha jornada nessa nova linguagem de programação.
4 |
5 | Vou adicionar nesse repositorio todas as minhas anotações, livros e artigos relacionados a essa nova quest de aprender clojure, o conteudo será disponibilizado em português e inglês.
6 |
7 | Caso você não tenha conhecimento no paradigma funcional, acredito que o primeiro passo seja se ambientar e entender um pouco sobre imutabilidade, high-order-function, funções puras e etc. Dessa forma acredito que será mais facil entender algumas decisões que existem dentro do clojure, inclusive se você so teve contato com paradigma de orientação a objeto.
8 |
9 | ### **Ultima anotações postadas:**
10 |
11 | - [clique aqui para ler 02.02.2021](./anotacoes/fevereiro-2021/02-02-2021.md)
12 | - [clique aqui para ler 30.01.2021](./anotacoes/janeiro-2021/25-01-2021.md)
13 |
14 | # **Conteudos:**
15 |
16 | ## **Aborda ambos os topicos funcional e clojure:**
17 |
18 | #### Videos:
19 | - [Formação Clojure - Alura](https://cursos.alura.com.br/formacao-clojure)
20 |
21 | ## **Especifico sobre funcional:**
22 |
23 | #### Videos:
24 |
25 | - [Functional Programming in 40 Minutes - Russ Olsen](https://www.youtube.com/watch?v=0if71HOyVjY)
26 | - [Functional Design Patterns - Scott Wlaschin](https://www.youtube.com/watch?v=srQt1NAHYC0)
27 | - [From Concurrency to Parallelism](https://www.youtube.com/watch?v=ZampUP6PdQA)
28 | - [Leon Barrett - Clojure Parallelism Beyond Futures](https://www.youtube.com/watch?v=BzKjIk0vgzE)
29 | - [core async Concurrency Without Callbacks - Stuart Halloway](https://www.youtube.com/watch?v=BcHI3U0FuoY)
30 | - [Programação Funcional Parte 2 - Functors e Monads](https://soundcloud.com/lambdatres/220-programacao-funcional-parte-2-functors-e-monads)
31 | - [Concurrency is not Parallelism by Rob Pike](https://www.youtube.com/watch?v=oV9rvDllKEg)
32 |
33 | #### Artigos:
34 | - [Domain-driven design in FP](https://naveennegi.medium.com/thoughts-on-domain-driven-design-in-functional-languages-83c43ec518d)
35 |
36 | ## **Especifico sobre clojure:**
37 |
38 | #### Videos:
39 |
40 | - [Clojure introdução à programação funcional - Gregorio Melo - Alura](https://cursos.alura.com.br/course/clojure-introducao-a-programacao-funcional/)
41 | - [Clojure Tutorial Canal do Youtube - Derek Banas](https://www.youtube.com/watch?v=ciGyHkDuPAE)
42 | - [Podcast sobre funcional e clojure - Hipster](https://podcasts.google.com/feed/aHR0cHM6Ly9oaXBzdGVycy50ZWNoL2ZlZWQvcG9kY2FzdC8/episode/aHR0cHM6Ly9oaXBzdGVycy50ZWNoLz9wPTI0OTU?hl=pt-BR&ved=2ahUKEwip6vK0-N_tAhV6H7kGHYHoAXoQjrkEegQIBhAL&ep=6)
43 | - [Components]: Clojure framework to manipulate state of application
44 | - [Github](https://github.com/stuartsierra/component)
45 | - [Youtube Video](https://www.youtube.com/watch?v=13cmHf_kt-Q)
46 |
47 | #### Livros:
48 | - [Programação Funcional - Introdução Clojure - Gregorio Melo](https://www.casadocodigo.com.br/products/livro-programacao-funcional-clojure)
49 | - [Living Clojure - Carin Meier](https://www.amazon.com.br/dp/B00W4DTCSW/ref=dp-kindle-redirect?_encoding=UTF8&btkr=1)
50 | - [Clojure for the brave and true - book](https://www.braveclojure.com/getting-started/)
51 |
52 | #### Artigos:
53 |
54 | - [Iniciando em Clojure - Gregorio Melo](https://medium.com/trainingcenter/iniciando-estudos-na-linguagem-de-programa%C3%A7%C3%A3o-clojure-d4cb3801234e)
55 | - [Lendo Clojure de outra forma - Gregorio Melo](https://programacaofuncional.com.br/programacao-funcional-com-clojure.pdf)
56 | - [Encontrei esse conteudo em um github, acredito que tenha relação com a universidade de helsinque na finlandia](http://iloveponies.github.io/120-hour-epic-sax-marathon/index.html)
57 | - [Clojure: Entendendo (Infinite) Lazy Sequences - Antonio Gabriel Pereira de Andrade](https://medium.com/@antonio.gabriel/clojure-entendendo-infinite-lazy-sequences-2fd87275e048)
58 | - [Asynchronous Clojure](https://medium.com/swlh/asynchronous-clojure-a59fa0f9bda0)
59 |
60 | #### Bibliotecas:
61 |
62 | - [clojure.java-time](https://github.com/dm3/clojure.java-time)
63 |
64 | ## **Minhas anotações:**
65 |
66 | Na pasta anotações você encontra o conteudo que estudei nos respectivos dias, portanto o nivel de complexidade será aumentado conforme avanço nos estudos da linguagem para facilitar a consulta vou classificar pelos meses:
67 |
68 | **Dezembro 2020:**
69 |
70 | - Comecei os estudos a partir do dia 25/12/2020, não tinha conhecimento sobre a linguagem de programação clojure, estava aprendendo a sintaxe, portanto os exemplos são bem simples.
71 |
72 | **Janeiro 2021:**
73 |
74 | - Comecei a organizar o codigo melhor, pois aprendi como utilizar referência de importação para facilitar a organização do codigo.
75 |
76 | - O conhecimento sobre a sintaxe da linguagem de programação está mais claro, aprendi a utilizar funções e criar minhas proprias, comecei a estudar recursividade e utilizar os argumentos como condicao para execução de uma função.
77 |
78 | - Estou começando a entender melhor como funciona coleções dentro do clojure e as funções que existem na linguagem para facilitar sua manipulação, como filter, map, group-by, recur, loop, keep e etc, além disso comecei a entender que a maior parte das funções do clojure são lazy, isto é, entenda como "executam o necessário", dessa forma fica claro que operações com uma grande quantidade de dados se tornam mais performaticas.
79 |
80 | - Comecei a entender como funciona o tratamento de exceções e a criação da estrutura de dados fila, assim como lidar com dados mutaveis atraves de atoms e swap!.
81 |
82 |
83 |
84 | # **Esse readme está em constante atualização.**
85 |
--------------------------------------------------------------------------------
/anotacoes/dezembro-2020/25-12-2020.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 25-12-2020
2 |
3 | - Para clojure virgula é considerado um espaço.
4 | ```
5 | def exemploVetor ["1","2"]);
6 | ```
7 | - Clojure é imutavel.
8 | - conj adiciona valores em um vetor sem alterar o valor inicial do vetor devido a imutabilidade.
9 | ```
10 | user=> (def exemploVetor[1 2 3 4])
11 | #'user/exemploVetor
12 | user=> (conj exemploVetor 5 6)
13 | [1 2 3 4 5 6]
14 | ```
15 | - Criar simbolos (seria algo semelhante a variaveis) local
16 |
17 | ```
18 | (defn valor-descontado
19 | "Retorna o valor com desconto de 10%."
20 | [valor-bruto]
21 | (let [desconto 0.10])
22 | (* valor-bruto (- 1 desconto)))
23 | ```
24 |
25 | - Assim como N representa o BigInt (90N), o M representa o BigDecimal (90M)
26 |
27 | - o let pode receber mais definições de simbolo
28 |
29 | ```
30 | (defn valor-descontado
31 | "Retorna o valor com desconto de 10%."
32 | [valor-bruto]
33 | (let [taxa-de-desconto (/ 10 100) ;Primeiro
34 | desconto (* valor-bruto taxa-de-desconto)] ;Segundo
35 | (println "Calculando desconto de" desconto)
36 | (- valor-bruto desconto)))
37 | ```
38 |
39 | - O if no clojure é considerado uma forma e não uma função: https://clojure.org/reference/special_forms#if
40 |
41 | ```
42 | (if (> 20 10)(println "true") (println "false"))
43 | ```
--------------------------------------------------------------------------------
/anotacoes/dezembro-2020/26-12-2020.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 26-12-2020
2 |
3 | - "ns" é usado para definir namespace, por exemplo, no começo do arquivo:
4 |
5 | ```
6 | (ns alura-estoque.core)
7 | ```
8 |
9 | - predicates: são utilizados quando no final do nome da função possui o ponto de interrogação, por exemplo:
10 |
11 | ```
12 | (defn deve-fazer-algo?)
13 | ```
14 |
15 | - operador "when" retorna somente o valor verdadeiro, por exemplo:
16 |
17 | ```
18 | (when (> valor 100)
19 | true))
20 | ```
21 |
22 | - Atalhos IntelliJ: o de reload: *CTRL Shift L* e de execução da linha base em que você está trabalhando *CTRL Shift P*.
23 |
24 | - Funções que recebem ou retornam funções são chamadas de "higher order functions".
25 |
26 | - Funções lambda "%" caso ela tivesse mais parametros usariamos %1 e %2
27 | ```
28 | (def valor-maior-100? #(> % 100))
29 |
30 | (valor-maior-100? 23)
31 | Output:
32 | false
33 |
34 | (valor-maior-100? 333)
35 | Output:
36 | true
37 |
38 | ```
--------------------------------------------------------------------------------
/anotacoes/dezembro-2020/27-12-2020.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 27-12-2020
2 |
3 | - função **"update"** é usado para atualizar posições do novo vetor criado, baseado no vetor antigo, como em clojure os dados são imutaveis coleções não são atualizadas, sempre é criado uma nova. por exemplo:
4 |
5 | ```
6 | (def vetor-exemplo [0 1 2 3])
7 | (update vetor-exemplo 1 inc)
8 |
9 | Output:
10 | [0 2 2 3]
11 | ```
12 | - função **"inc e dec"**, função inc é usada para acrescentar um valor, o nome é derivado de incremento enquanto dec é derivado de decremento.
13 |
14 | - função **"even"**, verifica se o valor é par.
15 |
16 | - função **"map"** basicamente ela percorre os dados da sua coleção equivale a um **"for"**
17 |
18 | ```
19 | (def vetor-exemplo [1 2 3 4 5])
20 | (map inc vetor-exemplo)
21 |
22 | Output:
23 | (2 3 4 5 6)
24 |
25 | ```
26 |
27 | - função **"filter"** basicamente ela verifica os dados da sua coleção e aplica o filtro proposto nos elementos:
28 |
29 | ```
30 | (def vetor-exemplo [1 2 3 4 5])
31 | (filter even? vetor-exemplo) ;Verifica os valores par da coleção
32 |
33 | Output:
34 | (2 4)
35 |
36 | ```
37 |
38 | - função **"reduce"** basicamente ela aplica o resultado de uma função no proximo elemento.
39 |
40 | ```
41 | (def vetor-exemplo [1 2 3 4 5])
42 | (reduce + vetor-exemplo)
43 |
44 | Output:
45 | (15)
46 |
47 | ```
48 |
49 |
--------------------------------------------------------------------------------
/anotacoes/fevereiro-2021/02-02-2021.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 02-02-2021
2 |
3 | Trabalhando com valores mutaveis em clojure, para isso vamos utilizar ````atom```` que é uma das formas de manipular o estado de um simbolo, imagine que o ````atom```` cria uma camada em cima do seu objeto e essa camada é mutavel, portanto permite que você faça alterações.
4 |
5 | O primeiro passo vamos criar uma fila com o nome de agenda, e apos usar a função ````atom````:
6 |
7 | ```
8 | (def ^:private agenda (atom {:compromissos h.model/nova_fila}))
9 | ```
10 |
11 | Entender esse conceito do ````atom```` pode parecer complexo, porque até agora estavamos lidando com coleções imutaveis, então recomendo ler a doc do clojure sobre esse tópico, assim como os demais citados nas anotações:
12 | https://clojuredocs.org/clojure.core/atom
13 |
14 | No exemplo vamos utilizar a função ````adicionar-compromisso```` que será responsável por criar novos itens na nossa fila.
15 |
16 | Para "forçar" que essa fila seja mutavel vamos utilizar o swap! normalmente as funções que permitem que simbolos se tornem mutaveis utilizam o sinal de exclamação no final da palavra reservada
17 |
18 | E a sintaxe ficará da seguinte forma:
19 |
20 | ```(swap! [nome fila atomica] [funcao que sera aplicada] [hashmap] [elemento]))```
21 |
22 | Vamos ao exemplo:
23 |
24 | ```
25 | (ns exemplo.core
26 | (:use [clojure pprint])
27 | (:require [exemplo.model :as h.model]))
28 |
29 | (def ^:private agenda (atom {:compromissos h.model/nova_fila}))
30 |
31 | (defn adicionar-compromisso [item]
32 | (swap! agenda update :compromissos conj item))
33 |
34 | (let [compromissos ["Dentista" "Vacinar contra Covid" "Palestrar na TDC 2021" "Escrever artigo sobre Threads no Clojure"]]
35 | (pprint(map adicionar-compromisso compromissos)))
36 |
37 | ```
38 | Nesse exemplo definimos *agenda* como um simbolo global porém privado para ser utilizado somente nesse namespace.
39 |
40 | Criamos a função adiciona-compromisso que tem a responsabilidade de adicionar itens a nossa agenda na qual é feito o update da agenda.
41 |
42 | **Output:**
43 | ```
44 | ({:compromissos <-("Dentista")-<}
45 | {:compromissos <-("Dentista" "Vacinar contra Covid")-<}
46 | {:compromissos
47 | <-("Dentista" "Vacinar contra Covid" "Palestrar na TDC 2021")-<}
48 | {:compromissos
49 | <-("Dentista"
50 | "Vacinar contra Covid"
51 | "Palestrar na TDC 2021"
52 | "Escrever artigo sobre Threads no Clojure")-<})
53 | ```
--------------------------------------------------------------------------------
/anotacoes/fevereiro-2021/07-02-2021.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mguardarini/aprendendo-clojure/508d5425bd704ae236d276de88a82e7b34a7a9ae/anotacoes/fevereiro-2021/07-02-2021.md
--------------------------------------------------------------------------------
/anotacoes/janeiro-2021/10-01-2021.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 10-01-2021
2 |
3 | - Como realizar referencia de importação, dica importante utilizar underscore em vez de hifen no namespace, pode causar erro de compilação.
4 |
5 | - Para realizar a referencia, considere o seguinte exemplo:
6 |
7 | ```
8 | (ns test.mauro)
9 | (defn testFuncao [] (println "Hi Lorena"))
10 | ```
11 |
12 | Para realizar o import basta utilizar o require em conjunto com o as:
13 |
14 | ```
15 | (ns test.core
16 | (:require [test.mauro :as fn]))
17 |
18 | (fn/testFuncao) ;Chamando a função pode ser feito dessa forma.
19 |
20 |
21 | (#'fn/testFuncao) ;Pode ser feito dessa forma também.
22 | ```
23 |
24 | - Algumas API's que aprendi sobre hoje quando for construir uma API Rest:
25 |
26 | ; Compojure - Biblioteca basica de rotas
27 | [compojure "1.6.1"]
28 |
29 | ; Biblioteca http para criar o servidor e cliente
30 | [http-kit "2.3.0"]
31 |
32 | ; utilizada para query params.
33 | [ring/ring-defaults "0.3.2"]
34 |
35 | ;Clojure data.JSON library
36 | [org.clojure/data.json "0.2.6"]
--------------------------------------------------------------------------------
/anotacoes/janeiro-2021/24-01-2021.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 24-01-2021
2 |
3 | - Função **"do"** é utilizada para executar todo um bloco que exista dentro de um condicional.
4 |
5 | - Função **"first"** é utilizada para pegar o primeiro elemento de um vetor.
6 |
7 | - Função **"rest"** é utilizada para pegar a partir do segundo elemento de um vetor.
8 | - Função **"next"** é utilizada para pegar o proximo elemento de um vetor.
9 |
10 | - Função **"recur"** é usado para executar a mesma funcao por um numero finito de vezes, por exemplo caso você queira utilizar para executar em todos os elementos de um vetor, em vez de utilizar a função map, poderia ser feito da seguinte forma:
11 |
12 | Esse tipo de recusão é chamado de recursao de cauda, porque o recur foi utilizado no ultimo elemento que é executado na funcao, "na cauda", caso tenha mais de um retorno possivel poderia ser utilizado mais de uma vez, por exemplo, se tivesse um condicional:
13 | ```
14 | (defn desconto-20-porcento [valor]
15 | (cond
16 | (< 0 valor) (println "desconto:" (* valor 0.2))
17 | :else (println "desconto so aplicado para valores maiores que zero")))
18 |
19 | (defn aplica-desconto
20 | [funcao sequencia]
21 | (let [primeiro (first sequencia)]
22 | (if (not
23 | (nil? primeiro))
24 | (do
25 | (funcao primeiro)
26 | (recur funcao (rest sequencia)))
27 | )))
28 |
29 | (aplica-desconto desconto-20-porcento (range 10))
30 |
31 | ```
32 | Nesse exemplo é aplicado a funcao desconto-20 para todos os elementos criados em um range de 20, isto é de 0 ate 20.
33 |
34 | Uma outra forma de escrever o mesmo codigo seria utilizando a função map que teria o trabalho da nossa função de recursão "aplica-desconto"
35 |
36 | O codigo ficaria da seguinte forma:
37 |
38 | ```
39 | (map desconto-20 (range 10))
40 | ```
41 |
42 | Como já foi dito em outras anotações a função map percorre todos os elementos do nosso vetor aplicando a função *desconto-20*
43 |
44 | Uma das vantagens que acredito que tenha ao utilizar recursividade em vez da função map é o controle que você terá do codigo permitindo customizações.
45 |
46 | ## *Variação de funções com multiplos argumentos:*
47 |
48 | Nesse exemplo vamos considerar que preciso que a minha função possa receber um ou dois argumentos. Dessa forma a execução será feita com base no numero de argumentos, basicamente, o objetivo dessa função é contar o numero de elementos do meu vetor, optei por utilizar a recursividade de cauda que apresentei no topico anterior:
49 |
50 | ```
51 | (defn conta-numero-elementos
52 | ([elementos] (conta 0 elementos))
53 | ([total-ate-agora elementos]
54 | (if (seq elementos)
55 | (recur (inc total-ate-agora) (next elementos))
56 | total-ate-agora)))
57 | ```
58 | A chamada poderia feita dessa forma, que o construtor com o numero de argumentos que seria chamado é esse ([total-ate-agora elementos], pois estou inicializando a função com o total-ate-agora em "0" e os elementos que seria o vetor.
59 |
60 | ```(println (conta-numero-elementos 0 ["aws" "github" "azure" "circleCi"]))```
61 |
62 | Mas também poderia ser chamado dessa forma, que seria utilizado esses argumentos ([elementos] (conta 0 elementos)), ou seja, minha função recursiva pode possuir duas formas de ser utilizada passando o total-ate-agora de numero de elements ou não:
63 |
64 | ```(println (conta-numero-elementos ["aws" "github" "azure" "circleCi"]))```
65 |
66 | Uma outra forma de ter o mesmo resultado seria utilizar a função **count** que demonstrei em topicos anteriores que é responsavel por contar quantidade de elementos do vetor.
67 |
68 | ```(count ["aws" "github" "azure" "circleCi"])```
69 |
--------------------------------------------------------------------------------
/anotacoes/janeiro-2021/25-01-2021.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 25-01-2021
2 |
3 | - Função **loop** pode ser utilizada para executar um laço de repetição, entretanto acredito que ela não devesse ser utilizada sendo que existe a possibilidade de você utilizar recursão como expliquei na anotação do dia [24.01.2021](../janeiro-2021/24-01-2021.md).
4 |
5 | Entretanto pode existir casos que seja necessário o uso do loop, então segue um exemplo de como utiliza-lo, vamos utilizar o exemplo da função conta-numero-elementos:
6 |
7 | A sintaxe do **"loop"** lembra um pouco a do **"for"** quando você utiliza linguagens orientada a objeto.
8 |
9 | ```
10 | (defn conta-numero-elementos
11 | ([elementos])
12 | (loop [total-ate-agora 0
13 | elementos-restantes elementos]
14 | (if (seq elementos-restantes)
15 | (recur (inc total-ate-agora) (next elementos-restantes))
16 | total-ate-agora)))
17 | ```
18 |
19 | o **"recur"** nesse exemplo está sendo utilizado para retornar ao **"loop"** e executar esse bloco, a partir do **"if"** novamente , caso eu tivesse alguma função antes do loop ela não é executada mais de uma vez, porque está antes, se você tiver mais codigo antes do loop o nivel de complexidade ciclomatica da sua função começa a aumentar nesse caso, talvez seja necessário uma refatoração pois a sua função está com mais responsabilidade do que deveria, indo contra um dos dogmas das boas praticas de desenvolvimento de software que é *single responsability*.
20 |
21 | Bom, continuando os estudos em clojure aprendi mais algumas coisas legais relacionadas a coleção:
22 |
23 | Para isso vamos precisar de dados para fazer essa manipulação, considere criar um arquivo chamado bancodedados.clj e inserir os dados abaixo, basicamente criei três objetos para representar feriados:
24 |
25 | ```
26 | (ns loja.exemplo.bancodedados)
27 | (use 'java-time)
28 |
29 | (def feriado1 {:id (.toString (java.util.UUID/randomUUID))
30 | :nome "aniversario de sp"
31 | :data-feriado (local-date-time 2021 1 25)
32 | })
33 |
34 | (def feriado2 {:id (.toString (java.util.UUID/randomUUID))
35 | :nome "Natal"
36 | :data-feriado (local-date-time 2021 12 25)
37 | })
38 |
39 | (def feriado3 {:id (.toString (java.util.UUID/randomUUID))
40 | :nome "Natal-2"
41 | :data-feriado (local-date-time 2021 12 25)
42 | })
43 |
44 | (defn feriados-2021 []
45 | [feriado1, feriado2,feriado3])
46 | ```
47 |
48 | - Função **"group-by"** é utilizada para realizar agrupamentos a partir de um determinado indicador, no exemplo abaixo vamos utilizar o campo data-feriado para realizar o agrupamento, portanto a função **"group-by"** receberá dois argumentos uma função que será responsavel por dizer qual campo deve ser utilizado para agrupar (```agrupamento-por-data```) e a nossa coleção (```l.db/feriados-2021```).
49 |
50 | O output será as coleções agrupadas dentro de um vetor pelo indicar que nesse caso é o campo ```data-feriado``` .
51 |
52 | ```
53 | (ns exemplo.exemplo25012021
54 | (:require [exemplo.bancodedados :as l.db]))
55 |
56 | (defn agrupamento-por-data
57 | [elemento]
58 | (:data-feriado elemento))
59 |
60 | (println (group-by agrupamento-por-data (l.db/feriados-2021)))
61 |
62 | ```
63 | ### **Output:**
64 | ```
65 |
66 | {
67 | #object[java.time.LocalDateTime 0x1fb91a30 2021-01-25T00:00]
68 | [
69 | {
70 | :id 993a0f9c-912a-42d4-bb12-6e64311ec4f4,
71 | :nome aniversario de sp,
72 | :data-feriado #object[java.time.LocalDateTime 0x1fb91a30 2021-01-25T00:00]
73 | }
74 | ],
75 | #object[java.time.LocalDateTime 0x1a3872ee 2021-12-25T00:00]
76 | [
77 | {
78 | :id d0734804-4f9d-40dc-949e-4290e0cd0499,
79 | :nome Natal,
80 | :data-feriado #object[java.time.LocalDateTime 0x1a3872ee 2021-12-25T00:00]
81 | }
82 | {
83 | :id 7537d5bf-0d4c-47ff-a960-6fd346cac333,
84 | :nome Natal-2,
85 | :data-feriado #object[java.time.LocalDateTime 0x7dbfc257 2021-12-25T00:00]
86 | }
87 | ]
88 | }
89 |
90 | ```
91 |
92 | ## *Biblioteca para manipular datas*
93 |
94 | Para gerar a data utilizei uma biblioteca chamada [Clojure.Java-Time](https://github.com/dm3/clojure.java-time) ela funciona como um wrapper para Java 8 Date-Time API, escolhi essa lib porque ela é simples de utilizar, tem poucas issues e está sendo mantida pela comunidade o ultimo era a cerca de 4 meses.
95 |
96 | O primeiro passo para utiliza-la é referenciar no seu projeto.clj:
97 | ```[clojure.java-time "0.3.2"]``` e após utilizar o use no arquivo que você for utiliza-lo, dessa forma: ```(use 'java-time) ``` a função que utilizei para preencher o campo *data-feriado* foi a ```local-date-time``` basicamente ela pode receber como argumento o ```[ano-mes-dia]``` ficando dessa forma:
98 | ```
99 | (local-date-time 2021 12 25)
100 | ```
101 |
--------------------------------------------------------------------------------
/anotacoes/janeiro-2021/30-01-2021.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 30-01-2021
2 |
3 | - Implementando uma fila (queue) em clojure, para isso é necessário utilizar ``` clojure.lang.PersistentQueue/EMPTY``` portanto vamos ao exemplo:
4 |
5 | ```
6 |
7 | (def nova-fila clojure.lang.PersistentQueue/EMPTY)
8 |
9 | (defn fila-vacinacao []
10 | (println "Fila Vacinação")
11 | (pprint (conj nova-fila 90 85 80 75)))
12 |
13 | (fila-vacinacao)
14 |
15 | ```
16 | **Output:**
17 |
18 | ```
19 | #object[clojure.lang.PersistentQueue 0x4351171a clojure.lang.PersistentQueue@1]
20 |
21 | ```
22 |
23 | Um pouco ruim de entender o que está acontecendo né? Para melhorar você pode utilizar a função ```pprint``` basicamente o que ela faz é formatar a informação que você está enviando de forma mais legivel, mas para isso é necessário importar no namespace que você está utilizando para isso utilizaremos o```use```:
24 |
25 | ```
26 | (ns exemplo.core
27 | (:use [clojure.pprint]))
28 |
29 | (defn fila-vacinacao []
30 | (let [fila clojure.lang.PersistentQueue/EMPTY]
31 | (println "Fila Vacinação")
32 | (pprint (conj fila 90 85 80 75))))
33 |
34 | (fila-vacinacao)
35 | ```
36 |
37 | **Output:**
38 | ```
39 | Fila Vacinação
40 | <-(90 85 80 75)-<
41 | ```
42 |
43 | - Função **"throw"** pode ser utilizada quando você desejar retornar uma exceção para o usuário, para demonstrar vamos definir uma regra para o tamanho do nosso vetor e caso o limite seja ultrapassado vamos retornar uma exceção para o usuário:
44 |
45 | Para facilitar o teste vamos criar dois vetores que checamos o seu tamanho:
46 |
47 | ```
48 | (def vetorCheio [1 2 3 4 5 6])
49 | (def vetorComVaga [1 2 3 4])
50 |
51 | ```
52 | E apos vamos definir a função que checa o tamanho do vetor, temos uma condição que checa se o tamanho do vetor é maior que 5 elementos e caso seja retorna exceção utilizando a função **"throw"**, utilizando a função ```ex-info``` que é responsavel por adicionar algumas informações a mais a exceção, no nosso caso "Vetor ja está cheio":
53 | ```
54 | (defn tem-vaga-no-vetor? [fila]
55 | (if (>= (count fila) 5)
56 | (throw (ex-info "Vetor ja está cheio" {:tentando-add vetor}))
57 | true))
58 | ```
59 | Quando executamos a função os outputs são os seguintes:
60 |
61 | **Cenario de erro:**
62 | ```
63 | (tem-vaga-na-vetor? vetorCheio)
64 | ```
65 | **Output:**
66 |
67 | ```
68 | Execution error (ExceptionInfo) at loja.core/tem-vaga-na-fila? (form-init3220695797824362203.clj:3).
69 | Vetor ja está cheia ;Mensagem que definimos
70 | ```
71 | **Cenario de sucesso:**
72 | ```
73 | (tem-vaga-na-vetor? vetorComVaga)
74 | ```
75 | **Output:**
76 | ```
77 | => true
78 | ```
--------------------------------------------------------------------------------
/anotacoes/janeiro-2021/31-01-2021.md:
--------------------------------------------------------------------------------
1 | # Anotações do dia 31-01-2021
2 |
3 | Trabalhando com valores mutaveis em clojure, para isso vamos utilizar ````atom```` que é uma das formas de manipular o estado de um objeto, imagine que o ````atom```` cria uma camada em cima do seu objeto e essa camada é mutavel, portanto permite que você faça alterações.
4 |
5 | O primeiro passo vamos criar uma fila com o nome de agenda, e apos usar a função ````atom````:
6 |
7 | ```
8 | (def ^:private agenda (atom {:compromissos h.model/nova_fila}))
9 | ```
10 |
11 | Entender esse conceito do ````atom```` pode parecer complexo, porque até agora estavamos lidando com coleções imutaveis, então recomendo ler a doc do clojure sobre esse tópico:
12 | https://clojuredocs.org/clojure.core/atom
13 |
14 | No exemplo vamos utilizar a função ````adicionar-compromisso```` que será responsável por criar novos itens na nossa fila.
15 |
16 | Para "forçar" que essa fila seja mutavel vamos utilizar o swap! normalmente as funções que permitem que objetos se tornem mutaveis utilizam o sinal de exclamação no final da palavra reservada
17 |
18 | E a sintaxe ficará da seguinte forma:
19 |
20 | ```(swap! [nome fila atomica] [funcao que sera aplicada] [hashmap] [elemento]))```
21 |
22 | Vamos ao exemplo:
23 |
24 | ```
25 | (ns exemplo.core
26 | (:use [clojure pprint])
27 | (:require [exemplo.model :as h.model]))
28 |
29 | (def ^:private agenda (atom {:compromissos h.model/nova_fila}))
30 |
31 | (defn adicionar-compromisso [item]
32 | (swap! agenda update :compromissos conj item))
33 |
34 | (let [compromissos ["Dentista" "Vacinar contra Covid" "Palestrar na TDC 2021" "Escrever artigo sobre Threads no Clojure"]]
35 | (pprint(map adicionar-compromisso compromissos)))
36 |
37 | ```
38 | Nesse exemplo definimos *agenda* como um simbolo global porém privado para ser utilizado somente nesse namespace.
39 |
40 | Criamos a função adiciona-compromisso que tem a responsabilidade de adicionar itens a nossa agenda na qual é feito o update da agenda.
41 |
42 | **Output:**
43 | ```
44 | ({:compromissos <-("Dentista")-<}
45 | {:compromissos <-("Dentista" "Vacinar contra Covid")-<}
46 | {:compromissos
47 | <-("Dentista" "Vacinar contra Covid" "Palestrar na TDC 2021")-<}
48 | {:compromissos
49 | <-("Dentista"
50 | "Vacinar contra Covid"
51 | "Palestrar na TDC 2021"
52 | "Escrever artigo sobre Threads no Clojure")-<})
53 | ```
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /classes
3 | /checkouts
4 | profiles.clj
5 | pom.xml
6 | pom.xml.asc
7 | *.jar
8 | *.class
9 | /.lein-*
10 | /.nrepl-port
11 | .hgignore
12 | .hg/
13 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/.name:
--------------------------------------------------------------------------------
1 | aplicacao-1
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/ClojureProjectResolveSettings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | IDE
5 |
6 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/libraries/Leiningen__clojure_complete_0_2_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/libraries/Leiningen__nrepl_0_6_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/libraries/Leiningen__org_clojure_clojure_1_10_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/libraries/Leiningen__org_clojure_core_specs_alpha_0_2_44.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/libraries/Leiningen__org_clojure_spec_alpha_0_2_176.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 | All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
3 |
4 | ## [Unreleased]
5 | ### Changed
6 | - Add a new arity to `make-widget-async` to provide a different widget shape.
7 |
8 | ## [0.1.1] - 2020-12-28
9 | ### Changed
10 | - Documentation on how to make the widgets.
11 |
12 | ### Removed
13 | - `make-widget-sync` - we're all async, all the time.
14 |
15 | ### Fixed
16 | - Fixed widget maker to keep working when daylight savings switches over.
17 |
18 | ## 0.1.0 - 2020-12-28
19 | ### Added
20 | - Files from the new template.
21 | - Widget maker public API - `make-widget-sync`.
22 |
23 | [Unreleased]: https://github.com/your-name/aplicacao-1/compare/0.1.1...HEAD
24 | [0.1.1]: https://github.com/your-name/aplicacao-1/compare/0.1.0...0.1.1
25 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/LICENSE:
--------------------------------------------------------------------------------
1 | Eclipse Public License - v 2.0
2 |
3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
4 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
5 | OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6 |
7 | 1. DEFINITIONS
8 |
9 | "Contribution" means:
10 |
11 | a) in the case of the initial Contributor, the initial content
12 | Distributed under this Agreement, and
13 |
14 | b) in the case of each subsequent Contributor:
15 | i) changes to the Program, and
16 | ii) additions to the Program;
17 | where such changes and/or additions to the Program originate from
18 | and are Distributed by that particular Contributor. A Contribution
19 | "originates" from a Contributor if it was added to the Program by
20 | such Contributor itself or anyone acting on such Contributor's behalf.
21 | Contributions do not include changes or additions to the Program that
22 | are not Modified Works.
23 |
24 | "Contributor" means any person or entity that Distributes the Program.
25 |
26 | "Licensed Patents" mean patent claims licensable by a Contributor which
27 | are necessarily infringed by the use or sale of its Contribution alone
28 | or when combined with the Program.
29 |
30 | "Program" means the Contributions Distributed in accordance with this
31 | Agreement.
32 |
33 | "Recipient" means anyone who receives the Program under this Agreement
34 | or any Secondary License (as applicable), including Contributors.
35 |
36 | "Derivative Works" shall mean any work, whether in Source Code or other
37 | form, that is based on (or derived from) the Program and for which the
38 | editorial revisions, annotations, elaborations, or other modifications
39 | represent, as a whole, an original work of authorship.
40 |
41 | "Modified Works" shall mean any work in Source Code or other form that
42 | results from an addition to, deletion from, or modification of the
43 | contents of the Program, including, for purposes of clarity any new file
44 | in Source Code form that contains any contents of the Program. Modified
45 | Works shall not include works that contain only declarations,
46 | interfaces, types, classes, structures, or files of the Program solely
47 | in each case in order to link to, bind by name, or subclass the Program
48 | or Modified Works thereof.
49 |
50 | "Distribute" means the acts of a) distributing or b) making available
51 | in any manner that enables the transfer of a copy.
52 |
53 | "Source Code" means the form of a Program preferred for making
54 | modifications, including but not limited to software source code,
55 | documentation source, and configuration files.
56 |
57 | "Secondary License" means either the GNU General Public License,
58 | Version 2.0, or any later versions of that license, including any
59 | exceptions or additional permissions as identified by the initial
60 | Contributor.
61 |
62 | 2. GRANT OF RIGHTS
63 |
64 | a) Subject to the terms of this Agreement, each Contributor hereby
65 | grants Recipient a non-exclusive, worldwide, royalty-free copyright
66 | license to reproduce, prepare Derivative Works of, publicly display,
67 | publicly perform, Distribute and sublicense the Contribution of such
68 | Contributor, if any, and such Derivative Works.
69 |
70 | b) Subject to the terms of this Agreement, each Contributor hereby
71 | grants Recipient a non-exclusive, worldwide, royalty-free patent
72 | license under Licensed Patents to make, use, sell, offer to sell,
73 | import and otherwise transfer the Contribution of such Contributor,
74 | if any, in Source Code or other form. This patent license shall
75 | apply to the combination of the Contribution and the Program if, at
76 | the time the Contribution is added by the Contributor, such addition
77 | of the Contribution causes such combination to be covered by the
78 | Licensed Patents. The patent license shall not apply to any other
79 | combinations which include the Contribution. No hardware per se is
80 | licensed hereunder.
81 |
82 | c) Recipient understands that although each Contributor grants the
83 | licenses to its Contributions set forth herein, no assurances are
84 | provided by any Contributor that the Program does not infringe the
85 | patent or other intellectual property rights of any other entity.
86 | Each Contributor disclaims any liability to Recipient for claims
87 | brought by any other entity based on infringement of intellectual
88 | property rights or otherwise. As a condition to exercising the
89 | rights and licenses granted hereunder, each Recipient hereby
90 | assumes sole responsibility to secure any other intellectual
91 | property rights needed, if any. For example, if a third party
92 | patent license is required to allow Recipient to Distribute the
93 | Program, it is Recipient's responsibility to acquire that license
94 | before distributing the Program.
95 |
96 | d) Each Contributor represents that to its knowledge it has
97 | sufficient copyright rights in its Contribution, if any, to grant
98 | the copyright license set forth in this Agreement.
99 |
100 | e) Notwithstanding the terms of any Secondary License, no
101 | Contributor makes additional grants to any Recipient (other than
102 | those set forth in this Agreement) as a result of such Recipient's
103 | receipt of the Program under the terms of a Secondary License
104 | (if permitted under the terms of Section 3).
105 |
106 | 3. REQUIREMENTS
107 |
108 | 3.1 If a Contributor Distributes the Program in any form, then:
109 |
110 | a) the Program must also be made available as Source Code, in
111 | accordance with section 3.2, and the Contributor must accompany
112 | the Program with a statement that the Source Code for the Program
113 | is available under this Agreement, and informs Recipients how to
114 | obtain it in a reasonable manner on or through a medium customarily
115 | used for software exchange; and
116 |
117 | b) the Contributor may Distribute the Program under a license
118 | different than this Agreement, provided that such license:
119 | i) effectively disclaims on behalf of all other Contributors all
120 | warranties and conditions, express and implied, including
121 | warranties or conditions of title and non-infringement, and
122 | implied warranties or conditions of merchantability and fitness
123 | for a particular purpose;
124 |
125 | ii) effectively excludes on behalf of all other Contributors all
126 | liability for damages, including direct, indirect, special,
127 | incidental and consequential damages, such as lost profits;
128 |
129 | iii) does not attempt to limit or alter the recipients' rights
130 | in the Source Code under section 3.2; and
131 |
132 | iv) requires any subsequent distribution of the Program by any
133 | party to be under a license that satisfies the requirements
134 | of this section 3.
135 |
136 | 3.2 When the Program is Distributed as Source Code:
137 |
138 | a) it must be made available under this Agreement, or if the
139 | Program (i) is combined with other material in a separate file or
140 | files made available under a Secondary License, and (ii) the initial
141 | Contributor attached to the Source Code the notice described in
142 | Exhibit A of this Agreement, then the Program may be made available
143 | under the terms of such Secondary Licenses, and
144 |
145 | b) a copy of this Agreement must be included with each copy of
146 | the Program.
147 |
148 | 3.3 Contributors may not remove or alter any copyright, patent,
149 | trademark, attribution notices, disclaimers of warranty, or limitations
150 | of liability ("notices") contained within the Program from any copy of
151 | the Program which they Distribute, provided that Contributors may add
152 | their own appropriate notices.
153 |
154 | 4. COMMERCIAL DISTRIBUTION
155 |
156 | Commercial distributors of software may accept certain responsibilities
157 | with respect to end users, business partners and the like. While this
158 | license is intended to facilitate the commercial use of the Program,
159 | the Contributor who includes the Program in a commercial product
160 | offering should do so in a manner which does not create potential
161 | liability for other Contributors. Therefore, if a Contributor includes
162 | the Program in a commercial product offering, such Contributor
163 | ("Commercial Contributor") hereby agrees to defend and indemnify every
164 | other Contributor ("Indemnified Contributor") against any losses,
165 | damages and costs (collectively "Losses") arising from claims, lawsuits
166 | and other legal actions brought by a third party against the Indemnified
167 | Contributor to the extent caused by the acts or omissions of such
168 | Commercial Contributor in connection with its distribution of the Program
169 | in a commercial product offering. The obligations in this section do not
170 | apply to any claims or Losses relating to any actual or alleged
171 | intellectual property infringement. In order to qualify, an Indemnified
172 | Contributor must: a) promptly notify the Commercial Contributor in
173 | writing of such claim, and b) allow the Commercial Contributor to control,
174 | and cooperate with the Commercial Contributor in, the defense and any
175 | related settlement negotiations. The Indemnified Contributor may
176 | participate in any such claim at its own expense.
177 |
178 | For example, a Contributor might include the Program in a commercial
179 | product offering, Product X. That Contributor is then a Commercial
180 | Contributor. If that Commercial Contributor then makes performance
181 | claims, or offers warranties related to Product X, those performance
182 | claims and warranties are such Commercial Contributor's responsibility
183 | alone. Under this section, the Commercial Contributor would have to
184 | defend claims against the other Contributors related to those performance
185 | claims and warranties, and if a court requires any other Contributor to
186 | pay any damages as a result, the Commercial Contributor must pay
187 | those damages.
188 |
189 | 5. NO WARRANTY
190 |
191 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
192 | PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
193 | BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
194 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
195 | TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
196 | PURPOSE. Each Recipient is solely responsible for determining the
197 | appropriateness of using and distributing the Program and assumes all
198 | risks associated with its exercise of rights under this Agreement,
199 | including but not limited to the risks and costs of program errors,
200 | compliance with applicable laws, damage to or loss of data, programs
201 | or equipment, and unavailability or interruption of operations.
202 |
203 | 6. DISCLAIMER OF LIABILITY
204 |
205 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
206 | PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
207 | SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
208 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
209 | PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
210 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
211 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
212 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
213 | POSSIBILITY OF SUCH DAMAGES.
214 |
215 | 7. GENERAL
216 |
217 | If any provision of this Agreement is invalid or unenforceable under
218 | applicable law, it shall not affect the validity or enforceability of
219 | the remainder of the terms of this Agreement, and without further
220 | action by the parties hereto, such provision shall be reformed to the
221 | minimum extent necessary to make such provision valid and enforceable.
222 |
223 | If Recipient institutes patent litigation against any entity
224 | (including a cross-claim or counterclaim in a lawsuit) alleging that the
225 | Program itself (excluding combinations of the Program with other software
226 | or hardware) infringes such Recipient's patent(s), then such Recipient's
227 | rights granted under Section 2(b) shall terminate as of the date such
228 | litigation is filed.
229 |
230 | All Recipient's rights under this Agreement shall terminate if it
231 | fails to comply with any of the material terms or conditions of this
232 | Agreement and does not cure such failure in a reasonable period of
233 | time after becoming aware of such noncompliance. If all Recipient's
234 | rights under this Agreement terminate, Recipient agrees to cease use
235 | and distribution of the Program as soon as reasonably practicable.
236 | However, Recipient's obligations under this Agreement and any licenses
237 | granted by Recipient relating to the Program shall continue and survive.
238 |
239 | Everyone is permitted to copy and distribute copies of this Agreement,
240 | but in order to avoid inconsistency the Agreement is copyrighted and
241 | may only be modified in the following manner. The Agreement Steward
242 | reserves the right to publish new versions (including revisions) of
243 | this Agreement from time to time. No one other than the Agreement
244 | Steward has the right to modify this Agreement. The Eclipse Foundation
245 | is the initial Agreement Steward. The Eclipse Foundation may assign the
246 | responsibility to serve as the Agreement Steward to a suitable separate
247 | entity. Each new version of the Agreement will be given a distinguishing
248 | version number. The Program (including Contributions) may always be
249 | Distributed subject to the version of the Agreement under which it was
250 | received. In addition, after a new version of the Agreement is published,
251 | Contributor may elect to Distribute the Program (including its
252 | Contributions) under the new version.
253 |
254 | Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
255 | receives no rights or licenses to the intellectual property of any
256 | Contributor under this Agreement, whether expressly, by implication,
257 | estoppel or otherwise. All rights in the Program not expressly granted
258 | under this Agreement are reserved. Nothing in this Agreement is intended
259 | to be enforceable by any entity that is not a Contributor or Recipient.
260 | No third-party beneficiary rights are created under this Agreement.
261 |
262 | Exhibit A - Form of Secondary Licenses Notice
263 |
264 | "This Source Code may also be made available under the following
265 | Secondary Licenses when the conditions for such availability set forth
266 | in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public
267 | License as published by the Free Software Foundation, either version 2
268 | of the License, or (at your option) any later version, with the GNU
269 | Classpath Exception which is available at
270 | https://www.gnu.org/software/classpath/license.html."
271 |
272 | Simply including a copy of this Agreement, including this Exhibit A
273 | is not sufficient to license the Source Code under Secondary Licenses.
274 |
275 | If it is not possible or desirable to put the notice in a particular
276 | file, then You may include the notice in a location (such as a LICENSE
277 | file in a relevant directory) where a recipient would be likely to
278 | look for such a notice.
279 |
280 | You may add additional accurate notices of copyright ownership.
281 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/README.md:
--------------------------------------------------------------------------------
1 | # aplicacao-1
2 |
3 | O intuito dessa aplicação é colocar em pratica o conhecimento documentado na anotações abaixo:
4 |
5 | - [Anotação do dia 25.12.2020](../../anotações/25-12-2020.md)
6 | - [Anotação do dia 26.12.2020](../../anotações/26-12-2020.md)
7 | - [Anotação do dia 27.12.2020](../../anotações/27-12-2020.md)
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/aplicacao-1.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/doc/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to aplicacao-1
2 |
3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
4 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/project.clj:
--------------------------------------------------------------------------------
1 | (defproject aplicacao-1 "0.1.0-SNAPSHOT"
2 | :description "FIXME: write description"
3 | :url "http://example.com/FIXME"
4 | :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
5 | :url "https://www.eclipse.org/legal/epl-2.0/"}
6 | :dependencies [[org.clojure/clojure "1.10.1"]]
7 | :repl-options {:init-ns aplicacao-1.core})
8 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/src/aplicacao_1/core.clj:
--------------------------------------------------------------------------------
1 | (ns aplicacao-1.core)
2 |
3 | (defn foo
4 | "I don't do a whole lot."
5 | [x]
6 | (println x "Hello, World!"))
7 |
--------------------------------------------------------------------------------
/exemplos/aplicacao-1/test/aplicacao_1/core_test.clj:
--------------------------------------------------------------------------------
1 | (ns aplicacao-1.core-test
2 | (:require [clojure.test :refer :all]
3 | [aplicacao-1.core :refer :all]))
4 |
5 | (deftest a-test
6 | (testing "FIXME, I fail."
7 | (is (= 0 1))))
8 |
--------------------------------------------------------------------------------