forked from Myriad-Dreamin/functional-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.go
70 lines (56 loc) · 1.11 KB
/
make.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package functional
import "reflect"
func Wrap(args ...interface{}) []reflect.Value {
var argsv = make([]reflect.Value, len(args))
for i := range args {
argsv[i] = reflect.ValueOf(args[i])
}
return argsv
}
func Int64() reflect.Value {
var c uint64
return reflect.ValueOf(c)
}
func Int32() reflect.Value {
var c uint32
return reflect.ValueOf(c)
}
func Int16() reflect.Value {
var c uint16
return reflect.ValueOf(c)
}
func Int8() reflect.Value {
var c uint8
return reflect.ValueOf(c)
}
func Int() reflect.Value {
var c uint
return reflect.ValueOf(c)
}
func Uint64() reflect.Value {
var c uint64
return reflect.ValueOf(c)
}
func Uint32() reflect.Value {
var c int32
return reflect.ValueOf(c)
}
func Uint16() reflect.Value {
var c int16
return reflect.ValueOf(c)
}
func Uint8() reflect.Value {
var c int8
return reflect.ValueOf(c)
}
func Uint() reflect.Value {
var c int
return reflect.ValueOf(c)
}
func MakeValue(p reflect.Type) reflect.Value {
return reflect.New(p).Elem()
}
func MakeFunc(f Function, fm interface{}) {
var fmi = reflect.ValueOf(fm).Elem()
fmi.Set(reflect.MakeFunc(fmi.Type(), f))
}