SlideShare a Scribd company logo
Леонид Шевцов «Clojure в деле»
Спикер:
Тема:
Леонид	
  Шевцов
Clojure	
  в	
  деле
(def
(apply
))
(defn project-point-to-line-fraction
"Projection of point on line (returns a real number; 0 = point is closest to v;
1 = point is closest to w; 1>f>0 - on the [v;w] segment; otherwise not on
the [v;w] segment). Returns 0 if v and w is the same point"
[point [v w]]
(let [length2 (dist2 v w)]
(if (< length2 0.00001) ; a point
0
(/ (+ (* (- (:x point) (:x v)) (- (:x w) (:x v)))
(* (- (:y point) (:y v)) (- (:y w) (:y v))))
length2))))
ФункцияДанные Результат
Функция Функция
Функция Функция
Слой
абстракции
Волшебные
структуры данных
Иммутабельные, разделяющие память, ленивые
Ленивая быстрая сортировка
Удобная работа с
функциями
Создавать, передавать как параметры, изменять
(map #(if %1 %2 %3) conditions xs ys)
((partial perform-calculation config)
(-> x x-to-y y-to-z)
Стандартная
библиотека
(defn points-to-segments
"Convert a polyline represented by points
into a vector of segments"
[points]
(into [] (partition 2 1 points)))
Несравненная
расширяемость
DSL, DRY
Встроенная поддержка
многопоточности
Атомы, транзакции, агенты
TDD, ReplDD
(facts
"about expr-transform"
(fact
"transforms expressions"
(algebra/expr-transform [:not [:and "x" "y"]]
[:or [:not "x"] [:not "y"]]
(algebra/expr :not [:and "a" "b"]))
=> (algebra/expr :or [:not "a"] [:not "b"])
(algebra/expr-transform [:not [:not "x"]]
"x"
(algebra/expr :not [:not "x"]))
=> "x")
Среда разработки
Cursive (Intellij IDEA)
Деплой
Heroku, Apache, Docker
Библиотеки
(ns jsfp.parser
(:require [clojure.string :as s])
(:import (org.antlr.v4.runtime ANTLRInputStream
CommonTokenStream
BailErrorStrategy)
(org.antlr.v4.runtime.tree ParseTree)
(jsfp ImperativeLanguageLexer
ImperativeLanguageParser)))
(defn antlr-parse [source-code]
(let [lexer (ImperativeLanguageLexer.
(ANTLRInputStream. source-code))
tokens (CommonTokenStream. lexer)
parser (ImperativeLanguageParser. tokens)
proving-structure (.provingStructure parser)]
(if (zero? (.getNumberOfSyntaxErrors parser))
proving-structure
nil)))
ClojureScript, Om
Самое страшное
(defn expr-match
"Attempts to match expression by a pattern.
Pattern is a structure of [operator param1 [operator param2 param3]...
String params in pattern are matched against any sub-expression, identifier
or primitive
Boolean and numeric params in pattern are matched by equality.
Returns a map of string params to their values, or false if there is no match"
[pattern expression]
(if (identifier? pattern)
{pattern expression}
(if (primitive? pattern)
(and (= expression pattern) {})
(and (expr? expression)
(let [operator (first pattern) params (next pattern)]
(and (= operator (:operator expression))
(let [forward-param-bindings
(map expr-match params (:params expression))
forward-match
(not-any? false? forward-param-bindings)
reverse-param-bindings
(and (not forward-match)
(expr-commutative? expression)
(map expr-match
params
(reverse (:params expression))))
reverse-match
(and reverse-param-bindings
(not-any? false? reverse-param-bindings))
param-bindings
(or (and forward-match forward-param-bindings)
(and reverse-match reverse-param-bindings))]
(and param-bindings (merge-bindings param-bindings)))))))))
Леонид Шевцов «Clojure в деле»
Спасибо! Вопросы?
Леонид Шевцов
Web: http://L-S.me
GitHub: @leonid-shevtsov
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

More Related Content

PDF
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
PDF
Reactive x
PDF
The Ring programming language version 1.5.3 book - Part 25 of 184
PPT
JDBC Core Concept
PPT
Networking Core Concept
PDF
Programming with Python and PostgreSQL
PDF
Use C++ to Manipulate mozSettings in Gecko
PDF
Effective Modern C++ - Item 35 & 36
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Reactive x
The Ring programming language version 1.5.3 book - Part 25 of 184
JDBC Core Concept
Networking Core Concept
Programming with Python and PostgreSQL
Use C++ to Manipulate mozSettings in Gecko
Effective Modern C++ - Item 35 & 36

What's hot (20)

PDF
Bartosz Milewski, “Re-discovering Monads in C++”
PPTX
ES6 in Real Life
PPT
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
PDF
Python postgre sql a wonderful wedding
PDF
Ns2: Introduction - Part I
PDF
Ns2: OTCL - PArt II
PDF
"PostgreSQL and Python" Lightning Talk @EuroPython2014
PDF
Rainer Grimm, “Functional Programming in C++11”
PPTX
JVM Architecture - Java
PPTX
Psycopg2 - Connect to PostgreSQL using Python Script
PDF
NS2: AWK and GNUplot - PArt III
PPT
Mintz q207
PPTX
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
PDF
Wprowadzenie do technologi Big Data i Apache Hadoop
PDF
C c++-meetup-1nov2017-autofdo
PPTX
PDF
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
PDF
Java Performance Puzzlers
PDF
The Ring programming language version 1.4.1 book - Part 7 of 31
PPTX
What’s new in C# 6
Bartosz Milewski, “Re-discovering Monads in C++”
ES6 in Real Life
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
Python postgre sql a wonderful wedding
Ns2: Introduction - Part I
Ns2: OTCL - PArt II
"PostgreSQL and Python" Lightning Talk @EuroPython2014
Rainer Grimm, “Functional Programming in C++11”
JVM Architecture - Java
Psycopg2 - Connect to PostgreSQL using Python Script
NS2: AWK and GNUplot - PArt III
Mintz q207
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
Wprowadzenie do technologi Big Data i Apache Hadoop
C c++-meetup-1nov2017-autofdo
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Java Performance Puzzlers
The Ring programming language version 1.4.1 book - Part 7 of 31
What’s new in C# 6
Ad

Viewers also liked (20)

PPTX
นิทาน
PPTX
Миша Постольный «Контрформа». Харьков.
PDF
«Особенности разработки 2D игры в Unity на примере проекта “Маша и Медведь”»....
PDF
Ointment Toothpaste Cream Manufacturing Plant
PPTX
Pen pc tecn
PPTX
Makeinindia-by Rohan Marthak
PPTX
Building Pennsylvania's First Detector Network Part 2
PPTX
«Lean UX — мелочи для успешных проектов» Анастасия Режепп, DataArt
PDF
Slides coder dojoparma
PPTX
128059 final ppt30.08.2K16
PPTX
«QA Community: что делать с людьми, которые хотят работать побольше» Евгений ...
PDF
Benefits for Millennials
PPTX
Reader’s theater (1)
PPTX
Propiedad intelectual del soft ware
PDF
Иван Гришаев «Саблайм текст – ИДЕ моей мечты
PDF
Никита Корчагин - Introduction to iOS development
PPTX
Расширение Visual studio для ASP.NET Identity
PPTX
180 blue dining room training
PPTX
Big data school demo
PDF
Артур Чеканов «Microframeworks» (Python Meetup)
นิทาน
Миша Постольный «Контрформа». Харьков.
«Особенности разработки 2D игры в Unity на примере проекта “Маша и Медведь”»....
Ointment Toothpaste Cream Manufacturing Plant
Pen pc tecn
Makeinindia-by Rohan Marthak
Building Pennsylvania's First Detector Network Part 2
«Lean UX — мелочи для успешных проектов» Анастасия Режепп, DataArt
Slides coder dojoparma
128059 final ppt30.08.2K16
«QA Community: что делать с людьми, которые хотят работать побольше» Евгений ...
Benefits for Millennials
Reader’s theater (1)
Propiedad intelectual del soft ware
Иван Гришаев «Саблайм текст – ИДЕ моей мечты
Никита Корчагин - Introduction to iOS development
Расширение Visual studio для ASP.NET Identity
180 blue dining room training
Big data school demo
Артур Чеканов «Microframeworks» (Python Meetup)
Ad

More from DataArt (20)

PDF
DataArt Custom Software Engineering with a Human Approach
PDF
DataArt Healthcare & Life Sciences
PDF
DataArt Financial Services and Capital Markets
PDF
About DataArt HR Partners
PDF
Event management в IT
PDF
Digital Marketing from inside
PPTX
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
PDF
DevOps Workshop:Что бывает, когда DevOps приходит на проект
PDF
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
PDF
«Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
PDF
Communication in QA's life
PDF
Нельзя просто так взять и договориться, или как мы работали со сложными людьми
PDF
Знакомьтесь, DevOps
PDF
DevOps in real life
PDF
Codeless: автоматизация тестирования
PDF
Selenoid
PDF
Selenide
PDF
A. Sirota "Building an Automation Solution based on Appium"
PDF
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
PPTX
IT talk: Как я перестал бояться и полюбил TestNG
DataArt Custom Software Engineering with a Human Approach
DataArt Healthcare & Life Sciences
DataArt Financial Services and Capital Markets
About DataArt HR Partners
Event management в IT
Digital Marketing from inside
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
DevOps Workshop:Что бывает, когда DevOps приходит на проект
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
«Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
Communication in QA's life
Нельзя просто так взять и договориться, или как мы работали со сложными людьми
Знакомьтесь, DevOps
DevOps in real life
Codeless: автоматизация тестирования
Selenoid
Selenide
A. Sirota "Building an Automation Solution based on Appium"
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
IT talk: Как я перестал бояться и полюбил TestNG

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
Introduction to Artificial Intelligence
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
ai tools demonstartion for schools and inter college
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Essential Infomation Tech presentation.pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms I-SECS-1021-03
How Creative Agencies Leverage Project Management Software.pdf
history of c programming in notes for students .pptx
Introduction to Artificial Intelligence
Design an Analysis of Algorithms II-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
top salesforce developer skills in 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
Odoo Companies in India – Driving Business Transformation.pdf
ai tools demonstartion for schools and inter college
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
2025 Textile ERP Trends: SAP, Odoo & Oracle
Understanding Forklifts - TECH EHS Solution
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Softaken Excel to vCard Converter Software.pdf
Essential Infomation Tech presentation.pptx

Леонид Шевцов «Clojure в деле»