September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
1
Task/Metaprogramming/00META.yaml
Normal file
1
Task/Metaprogramming/00META.yaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
--- {}
|
||||
24
Task/Metaprogramming/Go/metaprogramming.go
Normal file
24
Task/Metaprogramming/Go/metaprogramming.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
type person struct{
|
||||
name string
|
||||
age int
|
||||
}
|
||||
|
||||
func copy(p person) person {
|
||||
return person{p.name, p.age}
|
||||
}
|
||||
|
||||
func main() {
|
||||
p := person{"Dave", 40}
|
||||
fmt.Println(p)
|
||||
q := copy(p)
|
||||
fmt.Println(q)
|
||||
/*
|
||||
is := []int{1, 2, 3}
|
||||
it := make([]int, 3)
|
||||
copy(it, is)
|
||||
*/
|
||||
}
|
||||
37
Task/Metaprogramming/Julia/metaprogramming.julia
Normal file
37
Task/Metaprogramming/Julia/metaprogramming.julia
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
macro dowhile(condition, block)
|
||||
quote
|
||||
while true
|
||||
$(esc(block))
|
||||
if !$(esc(condition))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
macro dountil(condition, block)
|
||||
quote
|
||||
while true
|
||||
$(esc(block))
|
||||
if $(esc(condition))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
using Primes
|
||||
|
||||
arr = [7, 31]
|
||||
|
||||
@dowhile (!isprime(arr[1]) && !isprime(arr[2])) begin
|
||||
println(arr)
|
||||
arr .+= 1
|
||||
end
|
||||
println("Done.")
|
||||
|
||||
@dountil (isprime(arr[1]) || isprime(arr[2])) begin
|
||||
println(arr)
|
||||
arr .+= 1
|
||||
end
|
||||
println("Done.")
|
||||
7
Task/Metaprogramming/Phix/metaprogramming.phix
Normal file
7
Task/Metaprogramming/Phix/metaprogramming.phix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
object x
|
||||
#isginfo{x,0b0101,5,7,integer,3}
|
||||
-- {var,type,min,max,etype,len}
|
||||
-- (0b0101 is dword sequence|integer)
|
||||
x = {1,2,3} -- sequence of integer, length 3
|
||||
x = 5 -- integer 5 (becomes min)
|
||||
x = 7 -- integer 7 (becomes max)
|
||||
3
Task/Metaprogramming/Prolog/metaprogramming-1.pro
Normal file
3
Task/Metaprogramming/Prolog/metaprogramming-1.pro
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
:- initialization(main).
|
||||
main :- clause(less_than(1,2),B),writeln(B).
|
||||
less_than(A,B) :- A<B.
|
||||
3
Task/Metaprogramming/Prolog/metaprogramming-2.pro
Normal file
3
Task/Metaprogramming/Prolog/metaprogramming-2.pro
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
assertz((mother(Child, Mother) :-
|
||||
parent(Child, Mother),
|
||||
female(Mother))).
|
||||
Loading…
Add table
Add a link
Reference in a new issue