parent
2724e71aa6
commit
4c3e5f9d5d
|
@ -482,6 +482,11 @@ fn mult {
|
||||||
((x, y), scalar as :number) -> mult (scalar, (x, y))
|
((x, y), scalar as :number) -> mult (scalar, (x, y))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pow {
|
||||||
|
"Raises a number to the power of another number."
|
||||||
|
(x as :number, y as :number) -> base :pow (x, y)
|
||||||
|
}
|
||||||
|
|
||||||
fn div {
|
fn div {
|
||||||
"Divides numbers. Panics on division by zero."
|
"Divides numbers. Panics on division by zero."
|
||||||
(x as :number) -> x
|
(x as :number) -> x
|
||||||
|
@ -1232,8 +1237,28 @@ fn penwidth {
|
||||||
() -> do turtle_state > unbox > :penwidth
|
() -> do turtle_state > unbox > :penwidth
|
||||||
}
|
}
|
||||||
|
|
||||||
box state = nil
|
&&& fake some lispisms with tuples
|
||||||
|
fn cons {
|
||||||
|
"Old-timey lisp `cons`. `Cons`tructs a tuple out of two arguments."
|
||||||
|
(x, y) -> (x, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn car {
|
||||||
|
"Old-timey lisp `car`. Stands for 'contents of the address register.' Returns the first element in a `cons`ed pair (or any two-tuple)."
|
||||||
|
((x, _)) -> x
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cdr {
|
||||||
|
"Old-timey list `cdr`. Stands for 'contents of the decrement register.' Returns the second element in a `cons`ed pair, usually representing the rest of the list."
|
||||||
|
((_, x)) -> x
|
||||||
|
}
|
||||||
|
|
||||||
|
fn llist {
|
||||||
|
"Makes an old-timey linked list of its arguments, of LISt Processor fame."
|
||||||
|
(...xs) -> foldr (cons, xs, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
&&& processes
|
||||||
fn self {
|
fn self {
|
||||||
"Returns the current process's pid, as a keyword."
|
"Returns the current process's pid, as a keyword."
|
||||||
() -> base :process (:self)
|
() -> base :process (:self)
|
||||||
|
@ -1247,11 +1272,6 @@ fn send {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& fn spawn! {
|
|
||||||
& "Spawns a new process running the function passed in."
|
|
||||||
& (f as :fn) -> base :process (:spawn, f)
|
|
||||||
& }
|
|
||||||
|
|
||||||
fn yield! {
|
fn yield! {
|
||||||
"Forces a process to yield."
|
"Forces a process to yield."
|
||||||
() -> base :process (:yield)
|
() -> base :process (:yield)
|
||||||
|
@ -1264,10 +1284,10 @@ fn alive? {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link! {
|
fn link! {
|
||||||
"Creates a link between two processes. There are two types of links: `:report`, which sends a message to pid1 when pid2 dies; and `:enforce`, which causes a panic in one when the other dies. The default is `:report`."
|
"Creates a link between two processes. There are two types of links: `:report`, which sends a message to pid1 when pid2 dies; and `:panic`, which causes a panic in one when the other dies. The default is `:report`."
|
||||||
(pid1 as :keyword, pid2 as :keyword) -> link! (pid1, pid2, :report)
|
(pid1 as :keyword, pid2 as :keyword) -> link! (pid1, pid2, :report)
|
||||||
(pid1 as :keyword, pid2 as :keyword, :report) -> base :process (:link_report, pid1, pid2)
|
(pid1 as :keyword, pid2 as :keyword, :report) -> base :process (:link_report, pid1, pid2)
|
||||||
(pid1 as :keyword, pid2 as :keyword, :enforce) -> base :process (:link_enforce, pid1, pid2)
|
(pid1 as :keyword, pid2 as :keyword, :panic) -> base :process (:link_panic, pid1, pid2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flush! {
|
fn flush! {
|
||||||
|
@ -1469,6 +1489,7 @@ fn read_input {
|
||||||
pi
|
pi
|
||||||
pos?
|
pos?
|
||||||
position
|
position
|
||||||
|
pow
|
||||||
print!
|
print!
|
||||||
pu!
|
pu!
|
||||||
pw!
|
pw!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user