This document provides an overview of programming with Go Lang. It discusses why Go Lang is useful, including its support for multicore performance, microservices, concurrency, static binaries, and testing. It then covers various Go Lang content like first apps, types, loops, functions, arrays/slices/maps, interfaces, methods, empty interfaces, pointers, and error handling. Code examples are provided to demonstrate many of these concepts.
This talk will explore inference from the perspective of protocols and generics and is based off a series of blog posts I've written(foxinswift.com) on the topic. In the first part of my talk casting number types through inference. I'll then show you struct serialization example demonstrating inferring a type through a mapping function. My last example will take you through inferring an associatedtype on a barebones promise implementation and we'll use it to in the context of making a network request. To finish things off I'll briefly speak on what's new in swift generics and some limitations of those features.
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
An updated version of my talk on virtual machine cores comparing techniques in C and Go for implementing dispatch loops, stacks & hash maps.
Lots of tested and debugged code is provided as well as references to some useful/interesting books.
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively.
This talk will explore inference from the perspective of protocols and generics and is based off a series of blog posts I've written(foxinswift.com) on the topic. In the first part of my talk casting number types through inference. I'll then show you struct serialization example demonstrating inferring a type through a mapping function. My last example will take you through inferring an associatedtype on a barebones promise implementation and we'll use it to in the context of making a network request. To finish things off I'll briefly speak on what's new in swift generics and some limitations of those features.
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
An updated version of my talk on virtual machine cores comparing techniques in C and Go for implementing dispatch loops, stacks & hash maps.
Lots of tested and debugged code is provided as well as references to some useful/interesting books.
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively.
Introduction to Swift programming language.Icalia Labs
Take a look to Swift, if you've been developing for iOS in Objective-C many things may look familiar, maybe just "upgraded". If you're a first timer diving into iOS development we strongly recommend you to understand first the basics of Cocoa.
Highlights a bunch of different Python tricks and tips - from the stupid to the awesome (and a bit of both).
See how to register a 'str'.decode('hail_mary') codec, call_functions[1, 2, 3] instead of call_functions(1, 2, 3), creating a "Clojure-like" threading syntax by overloading the pipe operator, create useful equality mocks by overloading the equality operator, ditch JSON for pySON and put together a tiny lisp based on Norvig's awesome article.
FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
Moore's Law may be dead, but CPUs acquire more cores every year. If you want to minimize response latency in your application, you need to use every last core - without wasting resources that would destroy performance and throughput. Traditional locks grind threads to a halt and are prone to deadlocks, and although actors provide a saner alternative, they compose poorly and are at best weakly-typed.
In this presentation, created exclusively for Scalar Conf, John reveals a new alternative to the horrors of traditional concurrency, directly comparing it to other leading approaches in Scala. Witness the beauty, simplicity, and power of declarative concurrency, as you discover how functional programming is the most practical solution to solving the tough challenges of concurrency.
Introduction to Swift programming language.Icalia Labs
Take a look to Swift, if you've been developing for iOS in Objective-C many things may look familiar, maybe just "upgraded". If you're a first timer diving into iOS development we strongly recommend you to understand first the basics of Cocoa.
Highlights a bunch of different Python tricks and tips - from the stupid to the awesome (and a bit of both).
See how to register a 'str'.decode('hail_mary') codec, call_functions[1, 2, 3] instead of call_functions(1, 2, 3), creating a "Clojure-like" threading syntax by overloading the pipe operator, create useful equality mocks by overloading the equality operator, ditch JSON for pySON and put together a tiny lisp based on Norvig's awesome article.
FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
Moore's Law may be dead, but CPUs acquire more cores every year. If you want to minimize response latency in your application, you need to use every last core - without wasting resources that would destroy performance and throughput. Traditional locks grind threads to a halt and are prone to deadlocks, and although actors provide a saner alternative, they compose poorly and are at best weakly-typed.
In this presentation, created exclusively for Scalar Conf, John reveals a new alternative to the horrors of traditional concurrency, directly comparing it to other leading approaches in Scala. Witness the beauty, simplicity, and power of declarative concurrency, as you discover how functional programming is the most practical solution to solving the tough challenges of concurrency.
Pendant plusieurs semaines, les Rennais ont partagé leurs idées et leurs attentes pour Rennes en 2030 : retrouvez dans cette plaquette la restitution de la concertation ainsi que les orientations du projet.
Conférence des Geeks Anonymes sur " le langage Go ", par Thomas Hayen le 23 septembre 2020.
Cette conférence est disponible en vidéo sur Youtube : https://youtu.be/AlGGneVGTJk
An introduction into Googles programming language Go, which had its first release in March 2012. The talk has been held at the regulars' table of the GTUG Bremen.
Emerging Languages: A Tour of the HorizonAlex Payne
A tour of a number of new programming languages, organized by the job they're best suited for. Presented at Philadelphia Emerging Technology for the Enterprise 2012.
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
This talk takes a deep dive into asynchronous programming patterns and practices, with an emphasis on the promise pattern.
We go through the basics of the event loop, highlighting the drawbacks of asynchronous programming in a naive callback style. Fortunately, we can use the magic of promises to escape from callback hell with a powerful and unified interface for async APIs. Finally, we take a quick look at the possibilities for using coroutines both in current and future (ECMAScript Harmony) JavaScript.
2. Why Go Lang?
▪ Multicore Performance
▪ Microservices: Go use asynchronous I/O so that our application can interact
with any number of services without blocking web requests.
▪ Concurrency
▪ Static Binaries:Go applications compile quickly and launch immediately.
▪ Testing: Go Provide inbuilt support forTesting
▪ Benchmarking: Go Provide in build support for benchmarking
▪
3. Content
▪ First Go App.
▪ Types in Go
▪ Loops in Go
▪ Functions and function pointers
▪ Array , Slice and Map
▪ Interface
▪ Error Handling.
4. Basic Go App
package main
import "fmt"
func main() {
fmt.Println("Hello, shishir")
}
5. Types in Go
func learnTypes() {
str := "Learn Go !"
str1 := `A "raw" string literal
can include line breaks.`
fmt.Println("Print String:", str, "Print Multi line string:", str1)
f := 3.14554646457 //This is float value.
complex := 3 + 4i //This is complex number.
fmt.Println("print float value", f, "Print complex number", complex)
6. Types in Go
var arr [4]int //delcaration of array. At run time default value of int will be
given //which is 0
arr1 := [...]int{2, 4, 6, 78, 9, 90, 0}
fmt.Println("arr with default value", arr, "array with init value", arr1)
}
7. Loops in Go
func learnLoops() {
x := 6
if x > 5 {
fmt.Println("value of x is greater that 5")
}
fmt.Println("Lets print table of 2")
for i := 0; i <= 10; i++ {
fmt.Println(i * 2)
}
8. Loops in Go
//While loop.
y := 0
for {
y++
fmt.Println("Value ofY is :", y)
if y > 100 {
fmt.Println("Y value reached to 100")
break
}
}
9. Functions in Go
package main
import "fmt"
import "math/rand"
import "time"
func isFunction() (x string) {
return "Yes i am a function"
}
func parameterizedFunction(x, y int) {
z := x + y
fmt.Println("I don't return any value, i calculate and print", z)
}
10. Functions in Go
func functionWithReturnValue(x, y string) (z string) {
z = x + y
return //Named return value automatically returns value of z
}
func funcWithMultipleReturnValue(x, y string) (a, b, c string) {
a = x
b = y
c = x + y
return a, b, c
}
11. Functions in Go
func doSameRandomAddition() (z int) {
var arr [100]int
for x := 0; x < 100; x++ {
rand.Seed(time.Now().UnixNano())
y := rand.Intn(1000000)
fmt.Println("Random number generated is", y)
arr[x] = y
}
for x := 0; x < 100; x++ {
z = z + arr[x]
}
return z
}
12. Functions in Go
//Function having return type as function
func myfunc(x string) func(y, z string) string {
return func(y, z string) string {
return fmt.Sprintf("%s %s %s", y, z, x)
}
}
13. Functions in Go
// Deferred statements are executed just before the function returns.
func learnDefer() (ok bool) {
defer fmt.Println("deferred statements execute in reverse (LIFO)
order.")
defer fmt.Println("nThis line is being printed first because")
// Defer is commonly used to close a file, so the function closing
the
// file stays close to the function opening the file.
return true
}
14. Functions in Go
func main() {
fmt.Println(isFunction())
x := 10
y := 20
a := "Hello My Name is"
b := "Shishir"
parameterizedFunction(x, y)
z := functionWithReturnValue(a, b)
fmt.Println(z)
a, b, c := funcWithMultipleReturnValue(a, b)
fmt.Println("value of 1st Return", a, "value of 2nd return", b,
"Value of 3rd return", c)
functionOverloading(x, a)
f := doSameRandomAddition()
fmt.Println("Sum of array is :", f)
fmt.Println(myfunc("shishir")("Hello", "My name is"))
learnDefer()
}
15. Method Receiver and Interface
package main
import (
"fmt"
)
//While technically Go isn’t an Object Oriented Programming
language,
// types and methods allow for an object-oriented style of
programming.
//The big difference is that Go does not support type inheritance
but instead has
//a concept of interface.
type user struct {
name, lastname string
}
16. Method Receiver and Interface
func (u user) greetMe() {
fmt.Println("My name is :", u.name, u.lastname)
}
type Person struct {
name user
}
func (a Person) greetMe() {
fmt.Println(a.name.name, a.name.lastname)
}
17. Method Receiver and Interface
func main() {
u := user{"shishir", "dwivedi"}
x := user{name: "shishir"}
y := user{lastname: "dwivedi"}
z := user{}
u.greetMe()
x.greetMe()
y.greetMe()
z.greetMe()
}
18. Method Receiver and Interface
type animal interface {
makeSound() string
doAnmialSpecificAction() string
}
type horse struct {
sound string
action string
}
type bird struct {
sound string
action string
}
type fish struct {
sound string
action string
}
21. Method Receiver and Interface
func main(){
h := horse{"Horse Running", "Running"}
b := bird{"Bird Sound", "flying"}
f := fish{"fishSound", "swimining"}
fmt.Println(h.makeSound())
fmt.Println(h.doAnmialSpecificAction())
fmt.Println(b.makeSound())
fmt.Println(b.doAnmialSpecificAction())
fmt.Println(f.makeSound())
fmt.Println(f.doAnmialSpecificAction())
}
22. Empty Interface
// Empty interface is used to pass any variable number of paramter.
func variableParam(variableInterface ...interface{}) {
// underscore (_) is ignoring index value of the array.
for _, param := range variableInterface {
paramRecived := param
fmt.Print(paramRecived)
}
}
func main() {
variableParam("shishir", 2, 3+4i, "hello", 3.445665, h, b, f)
}
23. Pointer Receiver
//Pointer Reciver.: you can pass address of the reciver to func if you want to
manipulate
// Actual reciever. If address in not passed one copy is created and manipulation is
//Done at that copy.
func (h *horse) pointerReciver() {
h.sound = "I am chaning horse sound"
h.action = "i am chaning horse action"
}
func (h *horse) doSomethingElse() {
h.sound = "hhhh"
h.action = "action"
}
25. Array Slice and Map
package main
import (
"fmt"
"math/rand"
"time"
)
//Function whose return type is array.
//Function should return with type and memory size as well.
func arrayFunction() (arr1 [100]int64) {
var arr [100]int64
for x := 0; x < 100; x++ {
rand.Seed(time.Now().UnixNano())
number := rand.Int63()
fmt.Println("Random number generated", number)
arr[x] = number
time.Sleep(10 * time.Nanosecond)
}
return arr
}
26. Array Slice and Map
//Slices
func sliceExample() {
lenOfString := 10
mySlice := make([]string, 0)
mySlice = append(mySlice, "shishir")
fmt.Println(mySlice, "Lenght of slice", len(mySlice))
mySlice = append(mySlice, "Dwivedi")
for x := 0; x < 100; x++ {
mySlice = append(mySlice, generateRandomString(lenOfString))
}
fmt.Print(mySlice)
x := mySlice[:10]
fmt.Println(x)
x = mySlice[:]
fmt.Println(x)
x = mySlice[20:]
fmt.Println(x)
}
27. Array Slice and Map
func generateRandomString(strlen int) string {
arr := make([]byte, strlen)
const chars = "abcdefghijklmnopqrstuvwxyz0123456789"
for x := 0; x < strlen; x++ {
rand.Seed(time.Now().UnixNano())
arr[x] = chars[rand.Intn(len(chars))]
time.Sleep(10 * time.Nanosecond)
}
return string(arr)
}
28. Array Slice and Map
func mapExample() {
mapList := make(map[string]int)
//adding random string as key and random int as value
for x := 0; x < 100; x++ {
rand.Seed(time.Now().UnixNano())
number := rand.Intn(x)
mapList[generateRandomString(10)] = number
time.Sleep(10 * time.Nanosecond)
}
//Printing Map using Range Iterator.
fmt.Println(mapList)
}
29. Array Slice and Map
func main() {
fmt.Println("Array following number:", arrayFunction())
multiDimenisonalArray()
sliceExample()
mapExample()
}