YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -1,4 +1,3 @@
USE: infix
[infix
5*(1+1) ! 10
infix]
MACRO: pre ( quot -- quot ) reverse ;
[ + 2 2 ] pre ! 4

View file

@ -0,0 +1 @@
[ + 3 + 2 2 ] pre ! 7

View file

@ -0,0 +1,3 @@
MACRO: pre ( quot -- quot ) 1 cut swap [ 0 ] dip reduce 1quotation ;
[ + 1 2 3 4 5 ] pre ! 15

View file

@ -0,0 +1,4 @@
USE: infix
[infix
5*(1+1) ! 10
infix]

View file

@ -0,0 +1,30 @@
package main
import "fmt"
type ibool bool
const itrue ibool = true
func (ib ibool) iif(cond bool) bool {
if cond {
return bool(ib)
}
return bool(!ib)
}
func main() {
var needUmbrella bool
raining := true
// normal syntax
if raining {
needUmbrella = true
}
fmt.Printf("Is it raining? %t. Do I need an umbrella? %t\n", raining, needUmbrella)
// inverted syntax
raining = false
needUmbrella = itrue.iif(raining)
fmt.Printf("Is it raining? %t. Do I need an umbrella? %t\n", raining, needUmbrella)
}

View file

@ -0,0 +1 @@
536→N