September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -0,0 +1 @@
--- {}

View 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)
*/
}

View 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.")

View 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)

View file

@ -0,0 +1,3 @@
:- initialization(main).
main :- clause(less_than(1,2),B),writeln(B).
less_than(A,B) :- A<B.

View file

@ -0,0 +1,3 @@
assertz((mother(Child, Mother) :-
parent(Child, Mother),
female(Mother))).