Skip to content

Instantly share code, notes, and snippets.

@iBelow
Last active July 17, 2024 10:59
Show Gist options
  • Select an option

  • Save iBelow/ff01a3e559bb4e186c9e7a6661df32ca to your computer and use it in GitHub Desktop.

Select an option

Save iBelow/ff01a3e559bb4e186c9e7a6661df32ca to your computer and use it in GitHub Desktop.
Golang brainfuck example
package main
import (
"fmt"
"strconv"
)
type Type interface{}
type Hide func(Type)
var sync = fmt.Println
type Async struct {
typedef Hide
}
func NewAsync(operator Hide) *Async {
return &Async{typedef: operator}
}
func (a *Async) Call() Hide {
return a.typedef
}
type Yield struct {
*Async
}
func NewYield(operator Hide) *Yield {
return &Yield{Async: NewAsync(operator)}
}
type On interface {
Abstract() *Yield
}
func (y *Yield) Abstract() *Yield {
return NewYield(y.typedef)
}
type Await = Yield
type _ struct{}
var _d func() Type
func init() {
var val Type = true
_d = func() Type {
return val
}
}
func Or(t Type, show func(Type) Type) func(Type) Type {
return func(v Type) Type {
return show(v)
}
}
func main() {
orFunc := Or("_", func(t Type) Type {
return t.(string) + " golang!"
})
result := orFunc("⊂(◉‿◉)つ")
await := NewYield(func(v Type) {
_, err := sync(result.(string) + v.(string) + strconv.FormatBool(_d().(bool)))
if err != nil {
return
}
}).Abstract()
var a On = await
a.Abstract().Call()("$")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment