Skip to content

Instantly share code, notes, and snippets.

View mvlootman's full-sized avatar

Michiel Vlootman mvlootman

View GitHub Profile
import json
struct weather {
id int
main string
description string
icon string
}
struct document {
weather []weather
@mvlootman
mvlootman / tree.v
Last active August 20, 2019 13:53
tree - V code
struct TNode {
pub mut:
id int
children []*TNode
}
struct Record{
pub:
id int
parent int
@mvlootman
mvlootman / tree.go
Created August 20, 2019 13:47
tree - go code
package tree
import (
"fmt"
"sort"
)
//Record sctruct holds initial records
type Record struct {
ID int
reader, writer = IO.pipe # writes in parent -> reads in child
reader2, writer2 = IO.pipe # writes in child -> reads in parent
Process.run(command: "./child", input: reader, output: writer2) do
puts "inside master block"
writer.puts "message from master 2"
end
reader2.each_line { |x| puts "rcvd: #{x}"}
puts "done" # doesn't get to this line