SlideShare a Scribd company logo
1 of 39
Download to read offline
Go Elixir
2018/6/14
Fukuoka.go#11
•
• Fusic
• Go Elixir React PHP 

• Twitter : @kobatako_
• Qiita : @kobatako
Elixir
Elixir
• 

• 

• 

Elixir
• 

Go
• 

Go
• 

Go
Elixir
• 

Go
• 

Go
• 

Go
🤔
※23
Elixir
Elixir
• Elixir
•
•
• Erlang VM
Go
func CalculateSleepTime(series map[string][]SleepTerm, results vital.SleeptimemeterResults) map[string][]SleepTerm {
var start time.Time
for _, value := range results.Data {
//
sleep, _ := time.Parse(datetimeFormat, value.SleepDatetime)
wakeup, _ := time.Parse(datetimeFormat, value.WakeupDatetime)
//
// 12
if isTimeAm(sleep) {
start = replaceTime(sleep.AddDate(0, 0, -1), 12, 0, 0)
// 12
} else {
start = replaceTime(sleep, 12, 0, 0)
}
//
startTime := sleep.Sub(start)
wakeupTime := wakeup.Sub(start)
series[start.Format(dateFormat)] =
append(series[start.Format(dateFormat)], SleepTerm{
Start: sleep,
Wakeup: wakeup,
StartTime: startTime,
WakeupTime: wakeupTime,
Duration: wakeup.Sub(sleep),
}
)
}
return series
}
Elixir
def calculate_sleep_time([data | tail], series) do
##
with {:ok, sleep} <- Timex.parse(data.sleep_datetime, @datetime_format),
{:ok, wakeup} <- Timex.parse(data.wakeup_datetime, @datetime_format) do
#
start =
if time_am?(sleep) do
# 12
Timex.shift(sleep, days: -1)
|> replace_time(12, 0, 0)
else
# 12
replace_time(12, 0, 0)
end
#
start_time = Timex.diff(sleep, start)
wakeup_time = Timex.diff(wakeup, start)
res_list = series ++ [{Timex.format!(start, @date_format), %{start: sleep, wakwup: wakeup,
start_time: start_time, wakeup_time: wakeup_time, duration: Timex.diff(wakeup,
sleep, :duration)}}]
calculate_sleep_time(tail, res_list)
end
end
// Go
sleep, _ := time.Parse(datetimeFormat, value.SleepDatetime)
wakeup, _ := time.Parse(datetimeFormat, value.WakeupDatetime)
# Elixir
with {:ok, sleep} <- Timex.parse(data.sleep_datetime, @datetime_format),
{:ok, wakeup} <- Timex.parse(data.wakeup_datetime, @datetime_format) do
#
end
•
• Elixir with
// Go
if isTimeAm(sleep) {
start = replaceTime(sleep.AddDate(0, 0, -1), 12, 0, 0)
} else {
start = replaceTime(sleep, 12, 0, 0)
}
# Elixir
start =
if time_am?(sleep) do
Timex.shift(sleep, days: -1) # Timex.shift
|> replace_time(12, 0, 0) # replace_time
else
replace_time(12, 0, 0)
end
• Elixir if
// Go
series[start.Format(dateFormat)] =
append(series[start.Format(dateFormat)], SleepTerm{
Start: sleep,
}
)
# Elixir
res_list = series ++ [
{Timex.format!(start, date_format), %{start: sleep }}
]
• ++
// Go
for _, value := range results.Data {
}
# Elixir
# data tail
def calculate_sleep_time([data | tail], series) do
with {:ok, sleep} <- Timex.parse(data.sleep_datetime, @datetime_format),
{:ok, wakeup} <- Timex.parse(data.wakeup_datetime, @datetime_format) do
calculate_sleep_time(tail, res_list)
end
end
•
// Go
return series
}
# Elixir
def calculate_sleep_time([], series) do
series
end
def calculate_sleep_time([data | tail], series) do
end
• return
Go
•
•
•
Go
•
• Json
•
Elixir
• Json
•
• 

Elixir
•
•
•
Go & Elixir
Go & Elixir
• 

•
• Go Elixir
•
Elixir
🤣
Go
&
※
GoとElixir、同時開発した時の気づき

More Related Content

What's hot

Cluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeCluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeSteffen Wenz
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Cloudflare
 
Perl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReducePerl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReducePedro Figueiredo
 
SciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilitySciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilityESUG
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simplerAlexander Mostovenko
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxSignalFx
 
Parallel Computing in R
Parallel Computing in RParallel Computing in R
Parallel Computing in Rmickey24
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by exampleYunWon Jeong
 
Lua London Meetup 2013
Lua London Meetup 2013Lua London Meetup 2013
Lua London Meetup 2013Cloudflare
 
What's Special About Elixir
What's Special About ElixirWhat's Special About Elixir
What's Special About ElixirNeven Rakonić
 
Elixir 5 minute intro
Elixir 5 minute introElixir 5 minute intro
Elixir 5 minute introDoug Goldie
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod PolyakovYulia Shcherbachova
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable LispAstrails
 
証明駆動開発のたのしみ@名古屋reject会議
証明駆動開発のたのしみ@名古屋reject会議証明駆動開発のたのしみ@名古屋reject会議
証明駆動開発のたのしみ@名古屋reject会議Hiroki Mizuno
 
Rubyslava + PyVo #48
Rubyslava + PyVo #48Rubyslava + PyVo #48
Rubyslava + PyVo #48Jozef Képesi
 

What's hot (20)

Cluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeCluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in Practice
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
 
Perl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReducePerl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReduce
 
SciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with AgilitySciSmalltalk: Doing Science with Agility
SciSmalltalk: Doing Science with Agility
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simpler
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
ECMA Script
ECMA ScriptECMA Script
ECMA Script
 
Parallel Computing in R
Parallel Computing in RParallel Computing in R
Parallel Computing in R
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by example
 
Prgišče Lispa
Prgišče LispaPrgišče Lispa
Prgišče Lispa
 
Lua London Meetup 2013
Lua London Meetup 2013Lua London Meetup 2013
Lua London Meetup 2013
 
What's Special About Elixir
What's Special About ElixirWhat's Special About Elixir
What's Special About Elixir
 
Jk rubyslava 25
Jk rubyslava 25Jk rubyslava 25
Jk rubyslava 25
 
Elixir 5 minute intro
Elixir 5 minute introElixir 5 minute intro
Elixir 5 minute intro
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 
証明駆動開発のたのしみ@名古屋reject会議
証明駆動開発のたのしみ@名古屋reject会議証明駆動開発のたのしみ@名古屋reject会議
証明駆動開発のたのしみ@名古屋reject会議
 
Rubyslava + PyVo #48
Rubyslava + PyVo #48Rubyslava + PyVo #48
Rubyslava + PyVo #48
 
Golang Channels
Golang ChannelsGolang Channels
Golang Channels
 
Go on!
Go on!Go on!
Go on!
 

Similar to GoとElixir、同時開発した時の気づき

Beyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript GeneratorsBeyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript GeneratorsDarren Cruse
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...DroidConTLV
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015qmmr
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
Go Says WAT?
Go Says WAT?Go Says WAT?
Go Says WAT?jonbodner
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The LandingHaci Murat Yaman
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfpublic void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfisenbergwarne4100
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
Phoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってるPhoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってるTakahiro Kobaru
 
The mighty js_function
The mighty js_functionThe mighty js_function
The mighty js_functiontimotheeg
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
ECMAScript 6 new features
ECMAScript 6 new featuresECMAScript 6 new features
ECMAScript 6 new featuresGephenSG
 

Similar to GoとElixir、同時開発した時の気づき (20)

Beyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript GeneratorsBeyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript Generators
 
"let ECMAScript = 6"
"let ECMAScript = 6" "let ECMAScript = 6"
"let ECMAScript = 6"
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
Go Says WAT?
Go Says WAT?Go Says WAT?
Go Says WAT?
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
ES6, WTF?
ES6, WTF?ES6, WTF?
ES6, WTF?
 
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfpublic void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Phoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってるPhoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってる
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
ECMA5 and ES6 Promises
ECMA5 and ES6 PromisesECMA5 and ES6 Promises
ECMA5 and ES6 Promises
 
The mighty js_function
The mighty js_functionThe mighty js_function
The mighty js_function
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Groovy
GroovyGroovy
Groovy
 
Django Celery
Django Celery Django Celery
Django Celery
 
ECMAScript 6 new features
ECMAScript 6 new featuresECMAScript 6 new features
ECMAScript 6 new features
 

More from Takahiro Kobaru

Erlangでソフトウェアルータを作ってる話
Erlangでソフトウェアルータを作ってる話Erlangでソフトウェアルータを作ってる話
Erlangでソフトウェアルータを作ってる話Takahiro Kobaru
 
AppSyncをReactで使ってみた
AppSyncをReactで使ってみたAppSyncをReactで使ってみた
AppSyncをReactで使ってみたTakahiro Kobaru
 
SSOとか、SAMLとか、認証してみる
SSOとか、SAMLとか、認証してみるSSOとか、SAMLとか、認証してみる
SSOとか、SAMLとか、認証してみるTakahiro Kobaru
 
Mnesiaで分散ノードに入門してみた
Mnesiaで分散ノードに入門してみたMnesiaで分散ノードに入門してみた
Mnesiaで分散ノードに入門してみたTakahiro Kobaru
 
ReactでGraphQLを使っている
ReactでGraphQLを使っているReactでGraphQLを使っている
ReactでGraphQLを使っているTakahiro Kobaru
 
Elixir ライブラリ 「absinthe」でGraphQLに入門
Elixir ライブラリ 「absinthe」でGraphQLに入門Elixir ライブラリ 「absinthe」でGraphQLに入門
Elixir ライブラリ 「absinthe」でGraphQLに入門Takahiro Kobaru
 

More from Takahiro Kobaru (6)

Erlangでソフトウェアルータを作ってる話
Erlangでソフトウェアルータを作ってる話Erlangでソフトウェアルータを作ってる話
Erlangでソフトウェアルータを作ってる話
 
AppSyncをReactで使ってみた
AppSyncをReactで使ってみたAppSyncをReactで使ってみた
AppSyncをReactで使ってみた
 
SSOとか、SAMLとか、認証してみる
SSOとか、SAMLとか、認証してみるSSOとか、SAMLとか、認証してみる
SSOとか、SAMLとか、認証してみる
 
Mnesiaで分散ノードに入門してみた
Mnesiaで分散ノードに入門してみたMnesiaで分散ノードに入門してみた
Mnesiaで分散ノードに入門してみた
 
ReactでGraphQLを使っている
ReactでGraphQLを使っているReactでGraphQLを使っている
ReactでGraphQLを使っている
 
Elixir ライブラリ 「absinthe」でGraphQLに入門
Elixir ライブラリ 「absinthe」でGraphQLに入門Elixir ライブラリ 「absinthe」でGraphQLに入門
Elixir ライブラリ 「absinthe」でGraphQLに入門
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

GoとElixir、同時開発した時の気づき

  • 2. • • Fusic • Go Elixir React PHP 
 • Twitter : @kobatako_ • Qiita : @kobatako
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 15. 🤔
  • 16. ※23
  • 17.
  • 20.
  • 21. Go func CalculateSleepTime(series map[string][]SleepTerm, results vital.SleeptimemeterResults) map[string][]SleepTerm { var start time.Time for _, value := range results.Data { // sleep, _ := time.Parse(datetimeFormat, value.SleepDatetime) wakeup, _ := time.Parse(datetimeFormat, value.WakeupDatetime) // // 12 if isTimeAm(sleep) { start = replaceTime(sleep.AddDate(0, 0, -1), 12, 0, 0) // 12 } else { start = replaceTime(sleep, 12, 0, 0) } // startTime := sleep.Sub(start) wakeupTime := wakeup.Sub(start) series[start.Format(dateFormat)] = append(series[start.Format(dateFormat)], SleepTerm{ Start: sleep, Wakeup: wakeup, StartTime: startTime, WakeupTime: wakeupTime, Duration: wakeup.Sub(sleep), } ) } return series }
  • 22. Elixir def calculate_sleep_time([data | tail], series) do ## with {:ok, sleep} <- Timex.parse(data.sleep_datetime, @datetime_format), {:ok, wakeup} <- Timex.parse(data.wakeup_datetime, @datetime_format) do # start = if time_am?(sleep) do # 12 Timex.shift(sleep, days: -1) |> replace_time(12, 0, 0) else # 12 replace_time(12, 0, 0) end # start_time = Timex.diff(sleep, start) wakeup_time = Timex.diff(wakeup, start) res_list = series ++ [{Timex.format!(start, @date_format), %{start: sleep, wakwup: wakeup, start_time: start_time, wakeup_time: wakeup_time, duration: Timex.diff(wakeup, sleep, :duration)}}] calculate_sleep_time(tail, res_list) end end
  • 23. // Go sleep, _ := time.Parse(datetimeFormat, value.SleepDatetime) wakeup, _ := time.Parse(datetimeFormat, value.WakeupDatetime) # Elixir with {:ok, sleep} <- Timex.parse(data.sleep_datetime, @datetime_format), {:ok, wakeup} <- Timex.parse(data.wakeup_datetime, @datetime_format) do # end • • Elixir with
  • 24. // Go if isTimeAm(sleep) { start = replaceTime(sleep.AddDate(0, 0, -1), 12, 0, 0) } else { start = replaceTime(sleep, 12, 0, 0) } # Elixir start = if time_am?(sleep) do Timex.shift(sleep, days: -1) # Timex.shift |> replace_time(12, 0, 0) # replace_time else replace_time(12, 0, 0) end • Elixir if
  • 25. // Go series[start.Format(dateFormat)] = append(series[start.Format(dateFormat)], SleepTerm{ Start: sleep, } ) # Elixir res_list = series ++ [ {Timex.format!(start, date_format), %{start: sleep }} ] • ++
  • 26. // Go for _, value := range results.Data { } # Elixir # data tail def calculate_sleep_time([data | tail], series) do with {:ok, sleep} <- Timex.parse(data.sleep_datetime, @datetime_format), {:ok, wakeup} <- Timex.parse(data.wakeup_datetime, @datetime_format) do calculate_sleep_time(tail, res_list) end end •
  • 27. // Go return series } # Elixir def calculate_sleep_time([], series) do series end def calculate_sleep_time([data | tail], series) do end • return
  • 28.
  • 34. Go & Elixir • 
 • • Go Elixir •
  • 37. &
  • 38.