Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Clojure
Search
Julian Espinel
March 01, 2014
Programming
73
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to Clojure
Spanish version
Julian Espinel
March 01, 2014
More Decks by Julian Espinel
See All by Julian Espinel
Deploy and monitor an application with Docker
julianespinel
0
81
Building a microservice
julianespinel
0
74
Microservices
julianespinel
1
75
Autheo
julianespinel
1
180
Other Decks in Programming
See All in Programming
Hono + Inertia + React で LP を構築した話
oukayuka
2
190
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.4k
Flow は今どうなっているか
mizdra
PRO
0
810
「人を評価する AI」の設計と実装
ryoyanara
0
280
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
150
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.9k
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
280
Introducing Stack Pull Request in GitHub
kkamegawa
0
120
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
130
AIエージェント時代のコードレビューを設計する
nogu66
3
660
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
170
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.1k
Featured
See All Featured
Visualization
eitanlees
152
17k
Unsuck your backbone
ammeep
672
58k
WENDY [Excerpt]
tessaabrams
12
39k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
320
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
310
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
310
Darren the Foodie - Storyboard
khoart
PRO
3
3.8k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
220
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.6k
Transcript
Introducción a Clojure Implementando un API REST
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
1. ¿Qué es Clojure? Piet Mondrian Composition II in Red,
Blue, and Yellow 1930
1. ¿Qué es Clojure? Rich Hickey Clojure programming language 2007
1. ¿Qué es Clojure? 1. Lenguaje de programación
1. ¿Qué es Clojure? 1. Lenguaje de programación
1. ¿Qué es Clojure? 1. Lenguaje de programación Permite side
effects (acceso a la base de datos, consumo de servicios externos, etc.) Idealmente se debe programar sin side effects. Ejemplo función impura.
1. ¿Qué es Clojure? 1. Lenguaje de programación Ejemplo función
pura.
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
2. Conceptos básicos 1. Paradigma programación funcional 2. Concepto: Code
as data 3. Programación concurrente
2. Conceptos básicos Paradigma programación funcional 1. Estructuras de datos
inmutables.
2. Conceptos básicos Paradigma programación funcional 2. Funciones como “First-class
citizens”. (map inc [1 2 3 4 5]) -> (2 3 4 5 6)
2. Conceptos básicos Code as data
2. Conceptos básicos Programación concurrente
2. Conceptos básicos Programación concurrente 3. Refs (STM) 4. Futures
5. Promises
2. Conceptos básicos (Resumen) • Estructuras de datos inmutables. (Se
pueden compartir entre threads). • Funciones como elementos de primer orden. • “Construcciones” propias del lenguaje para el manejo de concurrencia.
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
3. ¿Por qué aprender Clojure? “A language that doesn't affect
the way you think about programming, is not worth knowing.” Alan Perlis.
3. ¿Por qué aprender Clojure?
3. ¿Por qué aprender Clojure?
3. ¿Por qué aprender Clojure?
3. ¿Por qué aprender Clojure? Piet Mondrian Composition II in
Red, Blue, and Yellow 1930 Minimalismo
3. ¿Por qué aprender Clojure? Clojure es un lenguaje minimalista
Sintaxis: simple limitada consistente
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
4. ¿Qué necesito para programar?
4. ¿Qué necesito para programar? Leiningen Herramienta de automatización de
proyectos escritos en Clojure.
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
5. Sintaxis del lenguaje ¿Este es el lenguaje con muchos
paréntesis? LISP: LISt Processing
5. Sintaxis del lenguaje 1. Expresiones S: “Code as data”
2. Prefix notation (+ 1 2) (+ 1 2 3 4 5) -> 3 -> 15
5. Sintaxis del lenguaje 3. Packages Namespaces (ns bog.jvm.meetup) ¿Cómo
declaro una clase? ¿Cómo declaro una variable? ¿Cómo declaro un método?
5. Sintaxis del lenguaje 4. Clases Estructuras de datos mapas
{:key value} (assoc {} :key1 “value1” :key2 “value2”) -> {:key1 “value1” :key2 “value2”}
5. Sintaxis del lenguaje 4. Clases Estructuras de datos a.
deftype b. defrecord c. reify
5. Sintaxis del lenguaje 4. Estructuras de datos clojure.core •
nil • Char • Numbers • String
5. Sintaxis del lenguaje 4. Estructuras de datos clojure.core •
Set • List • Vector • Map
5. Sintaxis del lenguaje 5. Variables Valores inmutables (def nombre-valor
valor) (def hello-world “Hello world”) hello-world -> Hello world
5. Sintaxis del lenguaje 5. Valores inmutables (def basic-map {})
(def hello-world “Hello world”) (assoc basic-map :message hello-world) -> {:message “Hello world”}
5. Sintaxis del lenguaje 6. Métodos Funciones a. Declarar una
función: (defn nombre-funcion “documentacion” [lista-de-parametros] cuerpo-funcion)
5. Sintaxis del lenguaje 6. Funciones b. Llamar una función:
(nombre-funcion lista-de-parametros)
5. Sintaxis del lenguaje 6. Funciones
5. Sintaxis del lenguaje 6. Funciones Arity overloading Parámetros opcionales
5. Sintaxis del lenguaje Code as data (extra)
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
6. API REST en Clojure 1. REST El ejemplo es
REST nivel 2
6. API REST en Clojure 2. Aplicación Directorio de servicios
6. API REST en Clojure 2. Aplicación HTTP request HTTP
response Front-end Back-end
6. API REST en Clojure 3. Estructura del código back-end
Servicios Estructuras de datos Persistencia Infraestructura
6. API REST en Clojure 4. Pruebas e integración continua
Midje & Midje &
6. API REST en Clojure 5. Nombramiento de archivos Mejores
prácticas de Clojure: a. minusculas b. palabras separadas por - ej: horario-api.clj, citas-api.clj
6. API REST en Clojure 5. Nombramiento de archivos horario-api.clj
-> horario_api.clj Interoperabilidad con Java
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
7. Parte final
7. Parte final Recursos 1. Code: https://github.com/julianespinel/directory 2. Slides: https://speakerdeck.com/julianespinel
7. Parte final
Agenda 1. ¿Qué es Clojure? 2. Conceptos básicos 3. ¿Por
qué aprender Clojure? 4. ¿Qué necesito para programar? 5. Sintaxis del lenguaje 6. API REST en Clojure 7. Parte final 8. Fuentes
8. Fuentes 1. http://clojure.org 2. http://clojure-doc.org 3. http://clojuredocs.org/ 4. http://coding.smashingmagazine.com/2013/04/18/introduction-to-programming-type-systems
5. http://blogs.perl.org/users/ovid/2010/08/what-to-know-before-debating-type-systems.html 6. http://www.lispcast.com/static-vs-dynamic-typing 7. http://gigasquidsoftware.com/blog/2014/02/01/hitchhikers-guide-to-clojure/ 8. http://christophermaier.name/blog/2011/07/07/writing-elegant-clojure-code-using-higher-order- functions 9. http://blakesmith.me/2012/05/25/understanding-clojure-concurrency-part-2.html 10. http://www.cs.yale.edu/quotes.html 11. http://en.wikipedia.org/wiki/Piet_Mondrian 12. http://clojure.org/rationale
8. Fuentes 13. http://tech.puredanger.com/2010/02/09/clojure-4-private-functions/ 14. http://clojure.org/functional_programming 15. http://clojure.org/cheatsheet 16. http://martinfowler.com/articles/richardsonMaturityModel.html
17. http://stackoverflow.com/questions/4420944/why-does-clojure-convert-dashes-in-names-to- underscores-in-the-filesystem