This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns defwrapper | |
(:require [clojure.string :as str])) | |
(set! *warn-on-reflection* true) | |
(defn class-methods [^Class class] | |
(seq (.getMethods class))) | |
(defn constructors [^Class klazz] | |
(.getDeclaredConstructors klazz)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.core.async :as async] | |
'[clj-http.client :as client] | |
'[clojure.data.json :as json]) | |
(def concurrency 5) | |
(let [in (async/chan) | |
out (async/chan) | |
request-handler (fn [url out*] | |
(async/go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | Name | Type 1 | Type 2 | HP | Attack | Defense | Sp. Atk | Sp. Def | Speed | Generation | Legendary | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Bulbasaur | Grass | Poison | 45 | 49 | 49 | 65 | 65 | 45 | 1 | False | |
2 | Ivysaur | Grass | Poison | 60 | 62 | 63 | 80 | 80 | 60 | 1 | False | |
3 | Venusaur | Grass | Poison | 80 | 82 | 83 | 100 | 100 | 80 | 1 | False | |
4 | Mega Venusaur | Grass | Poison | 80 | 100 | 123 | 122 | 120 | 80 | 1 | False | |
5 | Charmander | Fire | 39 | 52 | 43 | 60 | 50 | 65 | 1 | False | ||
6 | Charmeleon | Fire | 58 | 64 | 58 | 80 | 65 | 80 | 1 | False | ||
7 | Charizard | Fire | Flying | 78 | 84 | 78 | 109 | 85 | 100 | 1 | False | |
8 | Mega Charizard X | Fire | Dragon | 78 | 130 | 111 | 130 | 85 | 100 | 1 | False | |
9 | Mega Charizard Y | Fire | Flying | 78 | 104 | 78 | 159 | 115 | 100 | 1 | False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# As a primer you saw also earlier that I wrote | |
# some text in the code, but it wasn't evaluated. | |
# These are comments, you can use them by simply | |
# using "#" before the text. | |
###### I can add also more "#" to draw the attention | |
# on that comment. | |
# Assign names | |
# We can do math with R as we would do in a simple calculator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate some random number | |
x <- runif(10) | |
y <- runif(10) | |
# Print generated numbers | |
x | |
y | |
# Sum the two vectors | |
x + y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read data from csv | |
df <- read.csv("some_data.csv") | |
# Make a plot of the data | |
plot(df$debt, df$gdp) | |
# Fit a linear regression | |
lm(gdp ~ debt, data = df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) # This loads ggplot2 package, it's better and easier than base R plot | |
# This is the colors' palette used in the chart | |
pal <- c("#0E37B1", "#FF4100", "#00B65E", "#FFAE00", "#394C86", "#C66746", "#318A5F", "#C69E46") | |
# Here the code for the plot [don't worry, in next posts I'll | |
# explain better every line of code, just keep following me ;) ] | |
ggpoints <- ggplot(df, aes(HC, LC, color = Country))+ | |
geom_point(size = 3, shape = 16)+ | |
scale_color_manual(values = pal)+ |