From 2a69b3160c26fae87b5e1fff196c67ba9965a127 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Wed, 6 Sep 2017 18:36:16 -0700 Subject: [PATCH] Added some racket and go --- go/fizzbuzz/main.go | 46 ++++++++++++++++++++ go/fizzbuzz/test.go | 14 ++++++ racket/first_practice/fuck.rkt | 14 ++++++ racket/first_practice/hello-world-client.rkt | 17 ++++++++ racket/first_practice/hello-world.rkt | 3 ++ 5 files changed, 94 insertions(+) create mode 100644 go/fizzbuzz/main.go create mode 100644 go/fizzbuzz/test.go create mode 100644 racket/first_practice/fuck.rkt create mode 100644 racket/first_practice/hello-world-client.rkt create mode 100644 racket/first_practice/hello-world.rkt diff --git a/go/fizzbuzz/main.go b/go/fizzbuzz/main.go new file mode 100644 index 0000000..ca15eaf --- /dev/null +++ b/go/fizzbuzz/main.go @@ -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) + +} diff --git a/go/fizzbuzz/test.go b/go/fizzbuzz/test.go new file mode 100644 index 0000000..79ba7f9 --- /dev/null +++ b/go/fizzbuzz/test.go @@ -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) +} diff --git a/racket/first_practice/fuck.rkt b/racket/first_practice/fuck.rkt new file mode 100644 index 0000000..7b96384 --- /dev/null +++ b/racket/first_practice/fuck.rkt @@ -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) diff --git a/racket/first_practice/hello-world-client.rkt b/racket/first_practice/hello-world-client.rkt new file mode 100644 index 0000000..b28718e --- /dev/null +++ b/racket/first_practice/hello-world-client.rkt @@ -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) diff --git a/racket/first_practice/hello-world.rkt b/racket/first_practice/hello-world.rkt new file mode 100644 index 0000000..1e2995a --- /dev/null +++ b/racket/first_practice/hello-world.rkt @@ -0,0 +1,3 @@ +#lang racket + +(display "Hello Justin you faggot!!!\n")