Added some racket and go

This commit is contained in:
Logen Kain 2017-09-06 18:36:16 -07:00
parent 2e1fff90e8
commit 2a69b3160c
5 changed files with 94 additions and 0 deletions

46
go/fizzbuzz/main.go Normal file
View File

@ -0,0 +1,46 @@
package main
/*Fizz buzz
Fiz on divisable on 3, buzz on divisable on 5, and fizbuzz if divisiable by both.
*/
import "fmt"
func main() {
//For Version
/* for num := 1; num < 101; num++ {
if num%3 == 0 && num%5 != 0 {
fmt.Println(num, " ", "fizz")
} else if (num%5 == 0) && (num%3 != 0) {
fmt.Println(num, " ", "buzz")
} else if num%5 == 0 && num%3 == 0 {
fmt.Println(num, " ", "fizzbuzz!!!")
} else {
fmt.Println(num)
}
}
*/
//recursive version
fizzBuzz(1, 100)
}
func fizzBuzz(small, big int) {
if small > big {
return
}
if small%3 == 0 && small%5 != 0 {
fmt.Println(small, " ", "fizz")
} else if (small%5 == 0) && (small%3 != 0) {
fmt.Println(small, " ", "buzz")
} else if small%5 == 0 && small%3 == 0 {
fmt.Println(small, " ", "fizzbuzz!!!")
} else {
fmt.Println(small)
}
fizzBuzz(small+1, big)
}

14
go/fizzbuzz/test.go Normal file
View File

@ -0,0 +1,14 @@
package main
import "fmt"
func main() {
var a int = 100
if a < 20 {
fmt.Printf("a is less than 20\n")
} else {
fmt.Printf("a is not less than 20\n")
}
fmt.Printf("value of a is : %d\n", a)
}

View File

@ -0,0 +1,14 @@
#lang racket/gui
(require racket/gui/base)
(define frame (new frame% [label "Example"]))
(define msg (new message% [parent frame]
[label "No events so far..."]))
(new button% [parent frame]
[label "Click Me"]
[callback (lambda (button event)
(send msg set-label "Button click"))])
(send frame show #t)

View File

@ -0,0 +1,17 @@
#lang racket
(require net/zmq)
(define ctxt (context 1))
(define sock (socket ctx `REQ))
(printf "Connecting to hello world server...\n")
(socket-connect! sock "tcp://localhost:5555")
(for ([request (in-range 10)])
(printf "Sending request ~a...\n" request)
(socket-send! sock #"Hello")
(define message (socket-recv! sock))
(printf "Received reply ~a [~a]\n" request message))
(context-close! ctxt)

View File

@ -0,0 +1,3 @@
#lang racket
(display "Hello Justin you faggot!!!\n")