vrest-demo

basic example of call V from R by using json.

Little-intro abt V

It is compiled and simple language. It compile very fast with tcc < 1s and binary are so smaller in size compared to c,c++,go,rust. By default it handle memory leaks but if you want to build low level things like os, embedded system you can disable garbage collector
My server only is 2mb approx and with -prod(v -prod json.v) it is only 301kb size. Unlike tensorflow, torch have huge memory
v's scientific library consume very less memory. You can also do cross compile.

1. First compile & run executable file ./json(linux) and .\json.exe(window)

First you have to install v Installation Guide
window = v -cc gcc json.v
linux = v json.v
mac = v json.v

2. then call from R
library(httr)
library(jsonlite)


url <- "http://localhost:8080/mean"
#body ex <- '{"data":[4,5,6]}'
l <- list(data = c(1,2,3))
j <- toJSON(l)

# post request
req <- POST(url, body = j, encode = "json")

# response
res <- content(req, type = "text", encoding = "UTF-8")
res <- fromJSON(res)
res$result