-
O que é e por que usar?
Programação Funcional (FP) é um paradigma de programação que trata a computação como a avaliação de funções matemáticas, evitando a mudança de estado e dados mutáveis. Ela enfatiza a aplicação de funções a entradas para produzir saídas, sem modificar o estado. Na programação funcional, funções são tratadas como cidadãos de primeira classe, o que significa que podem ser atribuídas a variáveis, passadas como argumentos e retornadas de outras funções.
-
Características-chave da programação funcional incluem:
- Estilo declarativo em vez de imperativo
- Ênfase no que deve ser computado, ao invés de como deve ser computado
-
Evitar efeitos colaterais e mudanças de estado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type nat = O | S of nat | |
let rec fold succ acc n = | |
match n with | |
| O -> acc | |
| S n' -> | |
let acc = succ acc in | |
fold succ acc n' | |
let add x y = fold (fun n -> S n) y x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
a=pd.read_json('https://resultados.tse.jus.br/oficial/ele2022/544/dados-simplificados/br/br-c0001-e000544-r.json') | |
print('\n'.join([ f"{c['nm']:<20}\t{c['vap']}\t{c['pvap']}%" for c in a['cand']])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local QuestsBlockHeroic = {} | |
local QuestNameCache = {} | |
function populateQuestsBlockHeroic(quest, zone) | |
if (QuestsBlockHeroic[zone] == nil) then | |
QuestsBlockHeroic[zone] = {} | |
end | |
if (QuestsBlockHeroic[zone] ~= nil) then | |
table.insert(QuestsBlockHeroic[zone], quest) | |
print("[QuestBlockHeroic] Quest "..quest.." added to zone "..GetAreaName(zone)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORG 0 | |
init: | |
LDA num_zero | |
STA result_more_sb ; MORE SB DIGIT (MMC) | |
STA result_less_sb ;LESS SB DIGIT (MMC) | |
STA mmc_more_sb ;MMC - TEMP MORE SB DIGIT | |
STA mmc_less_sb ;MMC - TEMP LESS SB DIGIT | |
ORG 128 | |
declare: | |
op_A: DB 112 ; ADRESS>128 |
Esta publicação foi traduzida e adaptada para acessibilidade em PT/BR, a versão original e feita pelo @MarcoWorms em inglês, para visualiza-la clique aqui.
- Se você nunca teve contato com crypto e não tenha criado uma conta em uma corretora, para comprar $FTM, recomendamos utilizar a Binance (Clique aqui para acessar o mesmo link sem o codigo de afiliado).
- Após criar uma conta em uma corretora, deposite dinheiro FIAT/moeda fiduciária da sua escolha na carteira da sua corretora.
- Uma vez que você depositou fundos você pode comprar $FTM diretamente de um mercado ou utilizar o conversor automático da Binance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data (++) :: [a] -> [a] -> Exp [a] | |
type instance Eval ((++) '[] bs) = bs | |
type instance Eval ((++) (a ': as') bs) = a ': Eval ((++) as' bs) | |
data Mappend :: a -> a -> Exp a | |
type instance Eval (Mappend '() '()) = '() | |
type instance Eval (Mappend (a :: Constraint) (b :: Constraint)) = (a, b) | |
type instance Eval (Mappend (a :: [k]) (b :: [k])) = Eval (a ++ b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.Calendar; | |
import java.util.stream.Stream; | |
public class Clube { | |
private ArrayList<Membros> listaAcesso; | |
private static Calendar dataAcesso; | |
private static Calendar dataToday; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Comparator; | |
class Ordenador implements Comparator<Integer> { | |
public int compare(Integer o1, Integer o2){ | |
return o2.compareTo(o1); | |
} | |
} | |
public class Shumlambs { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.BorderLayout; | |
import java.awt.Color; | |
import java.awt.Container; | |
import javax.swing.Action; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
public class ShumlabsFrame extends JFrame { |
NewerOlder