Fixed broken code because of unsafe-nth.

This commit is contained in:
Erik Svedäng 2020-02-07 15:06:21 +01:00
parent 4fe7ea072b
commit b7de401b82
16 changed files with 219 additions and 204 deletions

View File

@ -144,8 +144,9 @@
(defn put [m k v]
(let [idx (Int.positive-mod (hash k) @(n-buckets &m))]
(update-buckets m &(fn [b]
(let [n (Array.unsafe-nth &b idx)]
(Array.aset b idx (Bucket.put @n k v)))))))
(let [n (Array.unsafe-nth &b idx)
new-b (Bucket.put @n k v)]
(Array.aset b idx new-b))))))
(doc put! "Put a a value v into map m, using the key k, in place.")
(defn put! [m k v]
@ -212,8 +213,9 @@
(defn remove [m k]
(let [idx (Int.positive-mod (hash k) @(n-buckets &m))]
(update-buckets m &(fn [b]
(let [n (Array.unsafe-nth &b idx)]
(Array.aset b idx (Bucket.shrink @n k)))))))
(let [n (Array.unsafe-nth &b idx)
new-b (Bucket.shrink @n k)]
(Array.aset b idx new-b))))))
(doc all? "Do all key-value pairs pass the given predicate (of two arguments)?")
(defn all? [pred m]
@ -400,8 +402,9 @@
(defn remove [s k]
(let [idx (Int.positive-mod (hash k) @(n-buckets &s))]
(update-buckets s &(fn [b]
(let [n (Array.unsafe-nth &b idx)]
(Array.aset b idx (SetBucket.shrink n k)))))))
(let [n (Array.unsafe-nth &b idx)
new-b (SetBucket.shrink n k)]
(Array.aset b idx new-b))))))
(doc all? "Does the predicate hold for all values in this set?")
(defn all? [pred set]

View File

@ -149,7 +149,7 @@
Array
</h1>
<div class="module-description">
</div>
<div class="binder">
<a class="anchor" href="#=">
@ -161,7 +161,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), (Ref (Array a) StaticLifetime)] Bool)
(λ [(Ref (Array a) b), (Ref (Array a) b)] Bool)
</p>
<pre class="args">
(= a b)
@ -181,7 +181,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime)] Bool) c), (Ref (Array b) StaticLifetime)] Bool)
(λ [(Ref ((λ a) [(Ref b c)] Bool) d), (Ref (Array b) c)] Bool)
</p>
<pre class="args">
(all? f a)
@ -204,7 +204,7 @@
(λ [Int] (Array a))
</p>
<span>
</span>
<p class="doc">
<p>allocates an uninitialized array. You can initialize members using <a href="#aset-uninitialized"><code>aset-uninitialized</code></a>.</p>
@ -221,7 +221,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime)] Bool) c), (Ref (Array b) StaticLifetime)] Bool)
(λ [(Ref ((λ a) [(Ref b c)] Bool) d), (Ref (Array b) c)] Bool)
</p>
<pre class="args">
(any? f a)
@ -244,7 +244,7 @@
(λ [(Array a), Int, a] (Array a))
</p>
<span>
</span>
<p class="doc">
<p>sets an array element at the index <code>n</code> to a new value.</p>
@ -264,7 +264,7 @@
(λ [(Ref (Array a) b), Int, a] ())
</p>
<span>
</span>
<p class="doc">
<p>sets an array element at the index <code>n</code> to a new value in place.</p>
@ -284,7 +284,7 @@
(λ [(Ref (Array a) b), Int, a] ())
</p>
<span>
</span>
<p class="doc">
<p>sets an uninitialized array member. The old member will not be deleted.</p>
@ -301,7 +301,7 @@
defn
</div>
<p class="sig">
(λ [(Array a), Int, (Ref ((λ b) [(Ref a StaticLifetime)] a) c)] (Array a))
(λ [(Array a), Int, (Ref ((λ b) [(Ref a c)] a) d)] (Array a))
</p>
<pre class="args">
(aupdate a i f)
@ -321,7 +321,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), Int, (Ref ((λ b) [(Ref a StaticLifetime)] a) c)] ())
(λ [(Ref (Array a) b), Int, (Ref ((λ c) [(Ref a b)] a) d)] ())
</p>
<pre class="args">
(aupdate! a i f)
@ -341,7 +341,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array (Array a)) StaticLifetime)] (Array a))
(λ [(Ref (Array (Array a)) b)] (Array a))
</p>
<pre class="args">
(concat xs)
@ -361,7 +361,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), (Ref a StaticLifetime)] Bool)
(λ [(Ref (Array a) b), (Ref a b)] Bool)
</p>
<pre class="args">
(contains? arr el)
@ -384,7 +384,7 @@
(λ [(Ref (Array a) b)] (Array a))
</p>
<span>
</span>
<p class="doc">
<p>copies an array.</p>
@ -422,7 +422,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime)] c) d), (Ref (Array b) StaticLifetime)] (Array c))
(λ [(Ref ((λ a) [(Ref b c)] d) e), (Ref (Array b) c)] (Array d))
</p>
<pre class="args">
(copy-map f a)
@ -446,7 +446,7 @@
(λ [(Array a)] ())
</p>
<span>
</span>
<p class="doc">
<p>deletes an array. This function should usually not be called manually.</p>
@ -463,7 +463,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), (Ref a StaticLifetime)] Int)
(λ [(Ref (Array a) b), (Ref a b)] Int)
</p>
<pre class="args">
(element-count a e)
@ -506,7 +506,7 @@
(λ [(Ref ((λ a) [(Ref b c)] Bool) d), (Array b)] (Array b))
</p>
<span>
</span>
<p class="doc">
<p>filters array members using a function. This function takes ownership.</p>
@ -526,7 +526,7 @@
(λ [(Ref ((λ a) [b] b) c), (Array b)] (Array b))
</p>
<span>
</span>
<p class="doc">
<p>applies a function <code>f</code> to an array <code>a</code>. The type of the elements cannot change.</p>
@ -543,7 +543,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] (Array (Pair Int a)))
(λ [(Ref (Array a) b)] (Array (Pair Int a)))
</p>
<pre class="args">
(enumerated xs)
@ -563,7 +563,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime)] Bool) c), (Ref (Array b) StaticLifetime)] (Maybe b))
(λ [(Ref ((λ a) [(Ref b c)] Bool) d), (Ref (Array b) c)] (Maybe b))
</p>
<pre class="args">
(find f a)
@ -584,7 +584,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime)] Bool) c), (Ref (Array b) StaticLifetime)] (Maybe Int))
(λ [(Ref ((λ a) [(Ref b c)] Bool) d), (Ref (Array b) c)] (Maybe Int))
</p>
<pre class="args">
(find-index f a)
@ -605,7 +605,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] (Maybe a))
(λ [(Ref (Array a) b)] (Maybe a))
</p>
<pre class="args">
(first a)
@ -626,7 +626,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), (Ref a StaticLifetime)] (Maybe Int))
(λ [(Ref (Array a) b), (Ref a b)] (Maybe Int))
</p>
<pre class="args">
(index-of a e)
@ -647,7 +647,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] (Maybe a))
(λ [(Ref (Array a) b)] (Maybe a))
</p>
<pre class="args">
(last a)
@ -671,7 +671,7 @@
(λ [(Ref (Array a) b)] Int)
</p>
<span>
</span>
<p class="doc">
<p>gets the length of the array.</p>
@ -688,7 +688,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] (Maybe a))
(λ [(Ref (Array a) b)] (Maybe a))
</p>
<pre class="args">
(maximum xs)
@ -709,7 +709,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] (Maybe a))
(λ [(Ref (Array a) b)] (Maybe a))
</p>
<pre class="args">
(minimum xs)
@ -730,7 +730,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a)), Int] (Maybe a))
(λ [(Ref (Array a) b), Int] (Maybe a))
</p>
<pre class="args">
(nth xs index)
@ -754,7 +754,7 @@
(λ [(Array a)] (Array a))
</p>
<span>
</span>
<p class="doc">
<p>removes the last element of an array and returns the new array.</p>
@ -774,7 +774,7 @@
(λ [(Ref (Array a) b)] a)
</p>
<span>
</span>
<p class="doc">
<p>removes an element <code>value</code> from the end of an array <code>a</code> in-place and returns it.</p>
@ -791,7 +791,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), (Ref ((λ b) [(Ref a StaticLifetime)] Bool) c)] Int)
(λ [(Ref (Array a) b), (Ref ((λ c) [(Ref a b)] Bool) d)] Int)
</p>
<pre class="args">
(predicate-count a pred)
@ -811,7 +811,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), Int] (Array a))
(λ [(Ref (Array a) b), Int] (Array a))
</p>
<pre class="args">
(prefix-array xs end-index)
@ -837,7 +837,7 @@
(prn x)
</pre>
<p class="doc">
</p>
</div>
<div class="binder">
@ -853,7 +853,7 @@
(λ [(Array a), a] (Array a))
</p>
<span>
</span>
<p class="doc">
<p>adds an element <code>value</code> to the end of an array <code>a</code>.</p>
@ -873,7 +873,7 @@
(λ [(Ref (Array a) b), a] ())
</p>
<span>
</span>
<p class="doc">
<p>adds an element <code>value</code> to the end of an array <code>a</code> in-place.</p>
@ -913,7 +913,7 @@
(λ [(Array a)] (Ptr a))
</p>
<span>
</span>
<p class="doc">
<p>returns an array <code>a</code> as a raw pointer—useful for interacting with C.</p>
@ -930,7 +930,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [b, (Ref c StaticLifetime)] b) d), b, (Ref (Array c) StaticLifetime)] b)
(λ [(Ref ((λ a) [b, (Ref c d)] b) e), b, (Ref (Array c) d)] b)
</p>
<pre class="args">
(reduce f x xs)
@ -1096,7 +1096,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] ())
(λ [(Ref (Array a) b)] ())
</p>
<pre class="args">
(sort! arr)
@ -1116,7 +1116,7 @@
defn
</div>
<p class="sig">
(λ [(Array a), (Ref ((λ b) [(Ref a StaticLifetime), (Ref a StaticLifetime)] Bool) c)] (Array a))
(λ [(Array a), (Ref ((λ b) [(Ref a c), (Ref a c)] Bool) d)] (Array a))
</p>
<pre class="args">
(sort-by arr f)
@ -1136,7 +1136,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), (Ref ((λ b) [(Ref a StaticLifetime), (Ref a StaticLifetime)] Bool) c)] ())
(λ [(Ref (Array a) b), (Ref ((λ c) [(Ref a b), (Ref a b)] Bool) d)] ())
</p>
<pre class="args">
(sort-by! arr f)
@ -1176,7 +1176,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) b), (Ref ((λ c) [(Ref a StaticLifetime), (Ref a StaticLifetime)] Bool) d)] (Array a))
(λ [(Ref (Array a) b), (Ref ((λ c) [(Ref a d), (Ref a d)] Bool) e)] (Array a))
</p>
<pre class="args">
(sorted-by arr f)
@ -1199,7 +1199,7 @@
(λ [(Ref (Array a) b)] String)
</p>
<span>
</span>
<p class="doc">
<p>converts an array to a string.</p>
@ -1216,7 +1216,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), Int, Int] (Array a))
(λ [(Ref (Array a) b), Int, Int] (Array a))
</p>
<pre class="args">
(subarray xs start-index end-index)
@ -1236,7 +1236,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), Int] (Array a))
(λ [(Ref (Array a) b), Int] (Array a))
</p>
<pre class="args">
(suffix-array xs start-index)
@ -1256,7 +1256,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] a)
(λ [(Ref (Array a) b)] a)
</p>
<pre class="args">
(sum xs)
@ -1276,7 +1276,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array (Array a)) StaticLifetime)] Int)
(λ [(Ref (Array (Array a)) b)] Int)
</p>
<pre class="args">
(sum-length xs)
@ -1316,7 +1316,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime), Int, Int] ())
(λ [(Ref (Array a) b), Int, Int] ())
</p>
<pre class="args">
(swap! a i j)
@ -1336,7 +1336,7 @@
defn
</div>
<p class="sig">
(λ [a, (Ref (λ [a] Bool)), (Ref (λ [a] a))] (Array a))
(λ [a, (Ref ((λ b) [a] Bool) c), (Ref ((λ b) [a] a) d)] (Array a))
</p>
<pre class="args">
(unreduce start test step)
@ -1363,7 +1363,7 @@ no longer satisfy <code>test</code>. The initial value is <code>start</code>.</p
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] a)
(λ [(Ref (Array a) b)] a)
</p>
<pre class="args">
(unsafe-first a)
@ -1384,7 +1384,7 @@ no longer satisfy <code>test</code>. The initial value is <code>start</code>.</p
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] a)
(λ [(Ref (Array a) b)] a)
</p>
<pre class="args">
(unsafe-last a)
@ -1405,16 +1405,36 @@ no longer satisfy <code>test</code>. The initial value is <code>start</code>.</p
template
</div>
<p class="sig">
(λ [(Ref (Array t)), Int] &amp;t)
(λ [(Ref (Array a) b), Int] (Ref a b))
</p>
<span>
</span>
<p class="doc">
<p>gets a reference to the <code>n</code>th element from an array <code>a</code>.</p>
</p>
</div>
<div class="binder">
<a class="anchor" href="#unsafe-raw">
<h3 id="unsafe-raw">
unsafe-raw
</h3>
</a>
<div class="description">
template
</div>
<p class="sig">
(λ [(Ref a (Array b))] (Ptr b))
</p>
<span>
</span>
<p class="doc">
<p>returns an array <code>a</code> as a raw pointer—useful for interacting with C.</p>
</p>
</div>
<div class="binder">
<a class="anchor" href="#zero">
<h3 id="zero">
@ -1445,7 +1465,7 @@ no longer satisfy <code>test</code>. The initial value is <code>start</code>.</p
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime), (Ref c StaticLifetime)] d) e), (Ref (Array b) StaticLifetime), (Ref (Array c) StaticLifetime)] (Array d))
(λ [(Ref ((λ a) [(Ref b c), (Ref d e)] f) g), (Ref (Array b) c), (Ref (Array d) e)] (Array f))
</p>
<pre class="args">
(zip f a b)

View File

@ -294,7 +294,7 @@
defn
</div>
<p class="sig">
(λ [&amp;Byte, &amp;Byte] Byte)
(λ [(Ref Byte a), (Ref Byte b)] Byte)
</p>
<pre class="args">
(add-ref x y)
@ -446,7 +446,7 @@
external
</div>
<p class="sig">
(λ [&amp;Byte] Byte)
(λ [(Ref Byte a)] Byte)
</p>
<span>
@ -503,7 +503,7 @@
external
</div>
<p class="sig">
(λ [&amp;String, Byte] String)
(λ [(Ref String a), Byte] String)
</p>
<span>
@ -541,7 +541,7 @@
external
</div>
<p class="sig">
(λ [&amp;String] Byte)
(λ [(Ref String a)] Byte)
</p>
<span>
@ -560,7 +560,7 @@
defn
</div>
<p class="sig">
(λ [&amp;Byte] Int)
(λ [(Ref Byte a)] Int)
</p>
<pre class="args">
(hash k)

View File

@ -695,7 +695,7 @@
external
</div>
<p class="sig">
(λ [&amp;String] Double)
(λ [(Ref String a)] Double)
</p>
<span>

View File

@ -657,7 +657,7 @@
external
</div>
<p class="sig">
(λ [&amp;String] Float)
(λ [(Ref String a)] Float)
</p>
<span>

View File

@ -149,7 +149,7 @@
IO
</h1>
<div class="module-description">
</div>
<div class="binder">
<a class="anchor" href="#EOF">
@ -164,7 +164,7 @@
Char
</p>
<span>
</span>
<p class="doc">
<p>the End-Of-File character as a literal.</p>
@ -184,10 +184,10 @@
Int
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
@ -203,10 +203,10 @@
Int
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
@ -222,10 +222,10 @@
Int
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
@ -281,7 +281,7 @@
(λ [(Ref String a)] ())
</p>
<span>
</span>
<p class="doc">
<p>prints a string ref to stderr, does not append a newline.</p>
@ -301,7 +301,7 @@
(λ [(Ref String a)] ())
</p>
<span>
</span>
<p class="doc">
<p>prints a string ref to stderr, appends a newline.</p>
@ -321,7 +321,7 @@
(λ [Int] a)
</p>
<span>
</span>
<p class="doc">
<p>exit the current program with a return code.</p>
@ -341,7 +341,7 @@
(λ [(Ptr FILE)] ())
</p>
<span>
</span>
<p class="doc">
<p>closes a file pointer.</p>
@ -361,7 +361,7 @@
(λ [(Ptr FILE)] ())
</p>
<span>
</span>
<p class="doc">
<p>flushes a file pointer (i.e. commits every write).</p>
@ -381,7 +381,7 @@
(λ [(Ptr FILE)] Char)
</p>
<span>
</span>
<p class="doc">
<p>gets a character from a file pointer.</p>
@ -401,7 +401,7 @@
(λ [(Ref String a), (Ref String b)] (Ptr FILE))
</p>
<span>
</span>
<p class="doc">
<p>opens a file by name using a mode (one or multiple of [r]ead, [w]rite, and [a]ppend), returns a file pointer. Consider using the function open-file instead.</p>
@ -421,7 +421,7 @@
(λ [a, Int, Int, (Ptr FILE)] Int)
</p>
<span>
</span>
<p class="doc">
<p>reads from a file pointer into a pointer.</p>
@ -441,7 +441,7 @@
(λ [(Ptr FILE), Int, Int] ())
</p>
<span>
</span>
<p class="doc">
<p>sets the position indicator of a file.</p>
@ -461,7 +461,7 @@
(λ [(Ptr FILE)] Int)
</p>
<span>
</span>
<p class="doc">
<p>gets the position indicator of a file.</p>
@ -481,7 +481,7 @@
(λ [a, Int, Int, (Ptr FILE)] ())
</p>
<span>
</span>
<p class="doc">
<p>writes to a file pointer.</p>
@ -501,7 +501,7 @@
(λ [] Char)
</p>
<span>
</span>
<p class="doc">
<p>gets a character from stdin.</p>
@ -521,7 +521,7 @@
(λ [] String)
</p>
<span>
</span>
<p class="doc">
<p>gets a line from stdin.</p>
@ -544,7 +544,7 @@
(getenv s)
</pre>
<p class="doc">
</p>
</div>
<div class="binder">
@ -557,7 +557,7 @@
defn
</div>
<p class="sig">
(λ [&amp;String, &amp;String] (Result (Ptr FILE) Int))
(λ [(Ref String a), (Ref String b)] (Result (Ptr FILE) Int))
</p>
<pre class="args">
(open-file filename mode)
@ -580,7 +580,7 @@
(λ [(Ref String a)] ())
</p>
<span>
</span>
<p class="doc">
<p>prints a string ref to stdout, does not append a newline.</p>
@ -600,7 +600,7 @@
(λ [(Ref String a)] ())
</p>
<span>
</span>
<p class="doc">
<p>prints a string ref to stdout, appends a newline.</p>
@ -617,7 +617,7 @@
defn
</div>
<p class="sig">
(λ [&amp;String] (Result String Int))
(λ [(Ref String a)] (Result String Int))
</p>
<pre class="args">
(read-&gt;EOF filename)
@ -640,7 +640,7 @@
(λ [(Ref String a)] String)
</p>
<span>
</span>
<p class="doc">
<p>returns the contents of a file passed as argument as a string.</p>
@ -660,7 +660,7 @@
(λ [(Ptr FILE)] ())
</p>
<span>
</span>
<p class="doc">
<p>rewinds a file pointer (i.e. puts input and output stream to beginning).</p>
@ -680,10 +680,10 @@
(Ptr FILE)
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
@ -699,10 +699,10 @@
(Ptr FILE)
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
@ -718,10 +718,10 @@
(Ptr FILE)
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder">
@ -737,7 +737,7 @@
(λ [String] ())
</p>
<span>
</span>
<p class="doc">
<p>unlinks a file (i.e. deletes it).</p>

View File

@ -161,7 +161,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref (Map a b) StaticLifetime)] Bool)
(λ [(Ref (Map a b) c), (Ref (Map a b) c)] Bool)
</p>
<pre class="args">
(= m1 m2)
@ -180,7 +180,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime), (Ref c StaticLifetime)] Bool) d), (Ref (Map b c) StaticLifetime)] Bool)
(λ [(Ref ((λ a) [(Ref b c), (Ref d c)] Bool) e), (Ref (Map b d) c)] Bool)
</p>
<pre class="args">
(all? pred m)
@ -220,7 +220,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref a StaticLifetime)] Bool)
(λ [(Ref (Map a b) c), (Ref a c)] Bool)
</p>
<pre class="args">
(contains? m k)
@ -340,7 +340,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [(Ref b StaticLifetime), (Ref c StaticLifetime)] c) d), (Map b c)] (Map b c))
(λ [(Ref ((λ a) [(Ref b c), (Ref d c)] d) e), (Map b d)] (Map b d))
</p>
<pre class="args">
(endo-map f m)
@ -360,7 +360,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref ((λ c) [(Ref a StaticLifetime), (Ref b StaticLifetime)] ()) d)] ())
(λ [(Ref (Map a b) c), (Ref ((λ d) [(Ref a c), (Ref b c)] ()) e)] ())
</p>
<pre class="args">
(for-each m f)
@ -380,7 +380,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array (Pair a b)) StaticLifetime)] (Map a b))
(λ [(Ref (Array (Pair a b)) c)] (Map a b))
</p>
<pre class="args">
(from-array a)
@ -400,7 +400,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref a StaticLifetime)] b)
(λ [(Ref (Map a b) c), (Ref a c)] b)
</p>
<pre class="args">
(get m k)
@ -420,7 +420,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref a StaticLifetime)] (Maybe b))
(λ [(Ref (Map a b) c), (Ref a c)] (Maybe b))
</p>
<pre class="args">
(get-maybe m k)
@ -440,7 +440,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref a StaticLifetime), (Ref b c)] b)
(λ [(Ref (Map a b) c), (Ref a c), (Ref b d)] b)
</p>
<pre class="args">
(get-with-default m k default-value)
@ -480,7 +480,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime)] (Array a))
(λ [(Ref (Map a b) c)] (Array a))
</p>
<pre class="args">
(keys m)
@ -500,7 +500,7 @@
defn
</div>
<p class="sig">
(λ [(Ref ((λ a) [b, (Ref c StaticLifetime), (Ref d StaticLifetime)] b) e), b, (Ref (Map c d) StaticLifetime)] b)
(λ [(Ref ((λ a) [b, (Ref c d), (Ref e d)] b) f), b, (Ref (Map c e) d)] b)
</p>
<pre class="args">
(kv-reduce f init m)
@ -520,7 +520,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime)] Int)
(λ [(Ref (Map a b) c)] Int)
</p>
<pre class="args">
(length m)
@ -580,7 +580,7 @@
defn
</div>
<p class="sig">
(λ [(Map a b), (Ref a StaticLifetime), (Ref b StaticLifetime)] (Map a b))
(λ [(Map a b), (Ref a c), (Ref b c)] (Map a b))
</p>
<pre class="args">
(put m k v)
@ -600,7 +600,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime), (Ref a StaticLifetime), (Ref b c)] ())
(λ [(Ref (Map a b) c), (Ref a c), (Ref b d)] ())
</p>
<pre class="args">
(put! m k v)
@ -620,7 +620,7 @@
defn
</div>
<p class="sig">
(λ [(Map a b), (Ref a StaticLifetime)] (Map a b))
(λ [(Map a b), (Ref a c)] (Map a b))
</p>
<pre class="args">
(remove m k)
@ -640,7 +640,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime)] (Map b a))
(λ [(Ref (Map a b) c)] (Map b a))
</p>
<pre class="args">
(reverse m)
@ -740,7 +740,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime)] String)
(λ [(Ref (Map a b) c)] String)
</p>
<pre class="args">
(str m)
@ -760,7 +760,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime)] (Array (Pair a b)))
(λ [(Ref (Map a b) c)] (Array (Pair a b)))
</p>
<pre class="args">
(to-array m)
@ -780,7 +780,7 @@
defn
</div>
<p class="sig">
(λ [(Map a b), (Ref a StaticLifetime), (Ref ((λ c) [b] b) StaticLifetime)] (Map a b))
(λ [(Map a b), (Ref a c), (Ref ((λ d) [b] b) c)] (Map a b))
</p>
<pre class="args">
(update m k f)
@ -840,7 +840,7 @@
defn
</div>
<p class="sig">
(λ [(Map a b), (Ref a StaticLifetime), (Ref ((λ c) [b] b) StaticLifetime), b] (Map a b))
(λ [(Map a b), (Ref a c), (Ref ((λ d) [b] b) c), b] (Map a b))
</p>
<pre class="args">
(update-with-default m k f v)
@ -860,7 +860,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Map a b) StaticLifetime)] (Array b))
(λ [(Ref (Map a b) c)] (Array b))
</p>
<pre class="args">
(vals m)

View File

@ -149,7 +149,7 @@
Maybe
</h1>
<div class="module-description">
</div>
<div class="binder">
<a class="anchor" href="#=">
@ -184,7 +184,7 @@
(λ [a] (Maybe a))
</p>
<span>
</span>
<p class="doc">
<p>creates a <code>Just</code>.</p>
@ -204,7 +204,7 @@
(λ [] (Maybe a))
</p>
<span>
</span>
<p class="doc">
<p>creates a <code>Nothing</code>.</p>
@ -221,7 +221,7 @@
defn
</div>
<p class="sig">
(λ [(Maybe a), (Ref (λ [a] b))] (Maybe b))
(λ [(Maybe a), (Ref ((λ b) [a] c) d)] (Maybe c))
</p>
<pre class="args">
(apply a f)
@ -244,7 +244,7 @@
(λ [(Ref (Maybe a) b)] (Maybe a))
</p>
<span>
</span>
<p class="doc">
<p>copies a <code>(Maybe a)</code>.</p>
@ -264,7 +264,7 @@
(λ [(Maybe a)] ())
</p>
<span>
</span>
<p class="doc">
<p>deletes a <code>(Maybe a)</code>. Should usually not be called manually.</p>
@ -325,7 +325,7 @@
(λ [(Ref (Maybe a) b)] Int)
</p>
<span>
</span>
<p class="doc">
<p>Gets the tag from a <code>Maybe</code>.</p>
@ -408,7 +408,7 @@ a value using <code>zero</code> if a <code>Nothing</code> is passed.</p>
(λ [(Ref (Maybe a) b)] String)
</p>
<span>
</span>
<p class="doc">
<p>stringifies a <code>&quot;Maybe&quot;</code>.</p>
@ -428,7 +428,7 @@ a value using <code>zero</code> if a <code>Nothing</code> is passed.</p>
(λ [(Ref (Maybe a) b)] String)
</p>
<span>
</span>
<p class="doc">
<p>stringifies a <code>&quot;Maybe&quot;</code>.</p>
@ -486,7 +486,7 @@ a value using <code>zero</code> if a <code>Nothing</code> is passed.</p>
defn
</div>
<p class="sig">
(λ [(Ref (Maybe a))] (Ptr a))
(λ [(Ref (Maybe a) b)] (Ptr a))
</p>
<pre class="args">
(unsafe-ptr a)

View File

@ -161,7 +161,7 @@
template
</div>
<p class="sig">
(λ [(Ptr p), Long] (Ptr p))
(λ [(Ptr a), Long] (Ptr a))
</p>
<span>
@ -181,7 +181,7 @@
template
</div>
<p class="sig">
(λ [(Ref (Ptr p))] (Ptr p))
(λ [(Ref (Ptr a) b)] (Ptr a))
</p>
<span>
@ -220,7 +220,7 @@
template
</div>
<p class="sig">
(λ [(Ptr p), (Ptr p)] Bool)
(λ [(Ptr a), (Ptr a)] Bool)
</p>
<span>
@ -240,7 +240,7 @@
template
</div>
<p class="sig">
(λ [Long] (Ptr p))
(λ [Long] (Ptr a))
</p>
<span>
@ -279,7 +279,7 @@
template
</div>
<p class="sig">
(λ [(Ptr p), Long] (Ptr p))
(λ [(Ptr a), Long] (Ptr a))
</p>
<span>
@ -299,7 +299,7 @@
template
</div>
<p class="sig">
(λ [(Ptr p)] Long)
(λ [(Ptr a)] Long)
</p>
<span>
@ -319,7 +319,7 @@
template
</div>
<p class="sig">
(λ [(Ptr p)] &amp;p)
(λ [(Ptr a)] (Ref a StaticLifetime))
</p>
<span>
@ -339,7 +339,7 @@
template
</div>
<p class="sig">
(λ [(Ptr p)] Long)
(λ [(Ptr a)] Long)
</p>
<span>

View File

@ -149,7 +149,7 @@
Result
</h1>
<div class="module-description">
</div>
<div class="binder">
<a class="anchor" href="#=">
@ -184,7 +184,7 @@
(λ [a] (Result b a))
</p>
<span>
</span>
<p class="doc">
<p>creates a <code>Error</code>.</p>
@ -204,7 +204,7 @@
(λ [a] (Result a b))
</p>
<span>
</span>
<p class="doc">
<p>creates a <code>Success</code>.</p>
@ -221,7 +221,7 @@
defn
</div>
<p class="sig">
(λ [(Result a b), (Ref (λ [a] (Result c b)))] (Result c b))
(λ [(Result a b), (Ref ((λ c) [a] (Result d b)) e)] (Result d b))
</p>
<pre class="args">
(and-then a f)
@ -242,7 +242,7 @@
defn
</div>
<p class="sig">
(λ [(Result a b), (Ref (λ [a] c)), (Ref (λ [b] d))] (Result c d))
(λ [(Result a b), (Ref ((λ c) [a] d) e), (Ref ((λ c) [b] f) g)] (Result d f))
</p>
<pre class="args">
(apply a success-f error-f)
@ -265,7 +265,7 @@
(λ [(Ref (Result a b) c)] (Result a b))
</p>
<span>
</span>
<p class="doc">
<p>copies a <code>(Result a b)</code>.</p>
@ -285,7 +285,7 @@
(λ [(Result a b)] ())
</p>
<span>
</span>
<p class="doc">
<p>deletes a <code>(Result a b)</code>. Should usually not be called manually.</p>
@ -308,7 +308,7 @@
(error? a)
</pre>
<p class="doc">
</p>
</div>
<div class="binder">
@ -364,7 +364,7 @@
(λ [(Ref (Result a b) c)] Int)
</p>
<span>
</span>
<p class="doc">
<p>Gets the tag from a <code>Result</code>.</p>
@ -381,7 +381,7 @@
defn
</div>
<p class="sig">
(λ [(Result a b), (Ref (λ [a] c))] (Result c b))
(λ [(Result a b), (Ref ((λ c) [a] d) e)] (Result d b))
</p>
<pre class="args">
(map a f)
@ -401,7 +401,7 @@
defn
</div>
<p class="sig">
(λ [(Result a b), (Ref (λ [b] c))] (Result a c))
(λ [(Result a b), (Ref ((λ c) [b] d) e)] (Result a d))
</p>
<pre class="args">
(map-error a f)
@ -421,11 +421,7 @@
defn
</div>
<p class="sig">
<<<<<<< HEAD
(λ [(Result a b), ((λ c) [b] (Result a d))] (Result a d))
=======
(λ [(Result a b), (Ref (λ [b] (Result a c)))] (Result a c))
>>>>>>> master
(λ [(Result a b), (Ref ((λ c) [b] (Result a d)) e)] (Result a d))
</p>
<pre class="args">
(or-else a f)
@ -449,7 +445,7 @@
(λ [(Ref (Result a b) c)] String)
</p>
<span>
</span>
<p class="doc">
<p>stringifies a <code>&quot;Result&quot;</code>.</p>
@ -469,7 +465,7 @@
(λ [(Ref (Result a b) c)] String)
</p>
<span>
</span>
<p class="doc">
<p>stringifies a <code>&quot;Result&quot;</code>.</p>
@ -568,11 +564,7 @@
defn
</div>
<p class="sig">
<<<<<<< HEAD
(λ [(Result a b), ((λ c) [b] a)] a)
=======
(λ [(Result a b), (Ref (λ [b] a))] a)
>>>>>>> master
(λ [(Result a b), (Ref ((λ c) [b] a) d)] a)
</p>
<pre class="args">
(unwrap-or-else a f)

View File

@ -180,7 +180,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime), Int] Double)
(λ [(Ref (Array Double) a), Int] Double)
</p>
<pre class="args">
(grouped-median data interval)
@ -200,7 +200,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(high-median data)
@ -240,7 +240,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(low-median data)
@ -260,7 +260,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array a) StaticLifetime)] a)
(λ [(Ref (Array a) b)] a)
</p>
<pre class="args">
(mean data)
@ -280,7 +280,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(median data)
@ -300,7 +300,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(pstdev data)
@ -340,7 +340,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(pvariance data)
@ -380,7 +380,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(stdev data)
@ -400,7 +400,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(stdev-pct data)
@ -419,7 +419,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Summary)
(λ [(Ref (Array Double) a)] Summary)
</p>
<pre class="args">
(summary samples)
@ -439,7 +439,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array Double) StaticLifetime)] Double)
(λ [(Ref (Array Double) a)] Double)
</p>
<pre class="args">
(variance data)

View File

@ -374,7 +374,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array String) StaticLifetime)] String)
(λ [(Ref (Array String) a)] String)
</p>
<pre class="args">
(concat strings)
@ -667,7 +667,7 @@
defn
</div>
<p class="sig">
(λ [(Ref String a), (Ref (Array String) StaticLifetime)] String)
(λ [(Ref String a), (Ref (Array String) b)] String)
</p>
<pre class="args">
(join sep strings)
@ -687,7 +687,7 @@
defn
</div>
<p class="sig">
(λ [Char, (Ref (Array String) StaticLifetime)] String)
(λ [Char, (Ref (Array String) a)] String)
</p>
<pre class="args">
(join-with-char sep strings)
@ -1060,7 +1060,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (Array String) StaticLifetime)] Int)
(λ [(Ref (Array String) a)] Int)
</p>
<pre class="args">
(sum-length strings)

View File

@ -161,7 +161,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] Bool)
(λ [(Ref (VectorN a) b), (Ref (VectorN a) b)] Bool)
</p>
<pre class="args">
(= a b)
@ -180,7 +180,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe (VectorN a)))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) c)] (Maybe (VectorN a)))
</p>
<pre class="args">
(add a b)
@ -199,7 +199,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe a))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) b)] (Maybe a))
</p>
<pre class="args">
(angle-between a b)
@ -219,7 +219,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe Bool))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) b)] (Maybe Bool))
</p>
<pre class="args">
(anti-parallel? a b)
@ -279,7 +279,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe a))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) c)] (Maybe a))
</p>
<pre class="args">
(dist a b)
@ -299,7 +299,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), a] (VectorN a))
(λ [(Ref (VectorN a) b), a] (VectorN a))
</p>
<pre class="args">
(div a n)
@ -318,7 +318,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe a))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) c)] (Maybe a))
</p>
<pre class="args">
(dot x y)
@ -358,7 +358,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime)] a)
(λ [(Ref (VectorN a) b)] a)
</p>
<pre class="args">
(mag o)
@ -378,7 +378,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime)] a)
(λ [(Ref (VectorN a) b)] a)
</p>
<pre class="args">
(mag-sq o)
@ -398,7 +398,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), a] (VectorN a))
(λ [(Ref (VectorN a) b), a] (VectorN a))
</p>
<pre class="args">
(mul a n)
@ -437,7 +437,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime)] (VectorN a))
(λ [(Ref (VectorN a) b)] (VectorN a))
</p>
<pre class="args">
(normalize o)
@ -457,7 +457,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe Bool))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) b)] (Maybe Bool))
</p>
<pre class="args">
(parallel? a b)
@ -477,7 +477,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe Bool))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) b)] (Maybe Bool))
</p>
<pre class="args">
(perpendicular? a b)
@ -636,7 +636,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime)] (Maybe (VectorN a)))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) c)] (Maybe (VectorN a)))
</p>
<pre class="args">
(sub a b)
@ -715,7 +715,7 @@
defn
</div>
<p class="sig">
(λ [(Ref (VectorN a) StaticLifetime), (Ref (VectorN a) StaticLifetime), a] (Maybe (VectorN a)))
(λ [(Ref (VectorN a) b), (Ref (VectorN a) c), a] (Maybe (VectorN a)))
</p>
<pre class="args">
(vlerp a b amnt)
@ -754,7 +754,7 @@
defn
</div>
<p class="sig">
(λ [((λ a) [b, c] d), (Ref (VectorN b) StaticLifetime), (Ref (VectorN c) StaticLifetime)] (Maybe (VectorN d)))
(λ [((λ a) [b, c] d), (Ref (VectorN b) e), (Ref (VectorN c) f)] (Maybe (VectorN d)))
</p>
<pre class="args">
(zip f a b)
@ -773,7 +773,7 @@
defn
</div>
<p class="sig">
(λ [((λ a) [b, c] d), (Ref (Array b) StaticLifetime), (Ref (Array c) StaticLifetime)] (VectorN d))
(λ [((λ a) [b, c] d), (Ref (Array b) e), (Ref (Array c) f)] (VectorN d))
</p>
<pre class="args">
(zip- f a b)

View File

@ -226,7 +226,7 @@
defn
</div>
<p class="sig">
(λ [(Ref SDLApp a), ((λ b) [(Ref SDLApp a), c, (Ref SDL_Event StaticLifetime)] c), ((λ d) [c] c), ((λ d) [(Ref SDLApp a), (Ptr SDL_Renderer), (Ref c e)] ()), c] ())
(λ [(Ref SDLApp a), ((λ b) [(Ref SDLApp a), c, (Ref SDL_Event d)] c), ((λ e) [c] c), ((λ e) [(Ref SDLApp a), (Ptr SDL_Renderer), (Ref c f)] ()), c] ())
</p>
<pre class="args">
(run-with-callbacks app event-fn update-fn draw-fn initial-state)

View File

@ -177,7 +177,7 @@ templateNth =
let t = VarTy "t"
in defineTemplate
(SymPath ["Array"] "unsafe-nth")
(FuncTy StaticLifetimeTy [RefTy (StructTy "Array" [t]) StaticLifetimeTy, IntTy] (RefTy t StaticLifetimeTy))
(FuncTy StaticLifetimeTy [RefTy (StructTy "Array" [t]) (VarTy "q"), IntTy] (RefTy t (VarTy "q")))
"gets a reference to the `n`th element from an array `a`."
(toTemplate "$t* $NAME (Array *aRef, int n)")
(toTemplate $ unlines ["$DECL {"
@ -201,11 +201,11 @@ templateRaw = defineTemplate
templateUnsafeRaw :: (String, Binder)
templateUnsafeRaw = defineTemplate
(SymPath ["Array"] "unsafe-raw")
(FuncTy [RefTy (StructTy "Array" [VarTy "t"])] (PointerTy (VarTy "t")))
(FuncTy StaticLifetimeTy [RefTy (VarTy "q") (StructTy "Array" [VarTy "t"])] (PointerTy (VarTy "t")))
"returns an array `a` as a raw pointer—useful for interacting with C."
(toTemplate "$t* $NAME (Array* a)")
(toTemplate "$DECL { return a->data; }")
(\(FuncTy [RefTy arrayType] _) -> [])
(\(FuncTy _ [RefTy arrayType _] _) -> [])
templateAset :: (String, Binder)
templateAset = defineTypeParameterizedTemplate templateCreator path t docs

View File

@ -98,7 +98,7 @@ templatePointerToRef = defineTemplate
templatePointerAdd = defineTemplate
(SymPath ["Pointer"] "add")
(FuncTy [PointerTy (VarTy "p"), LongTy] (PointerTy (VarTy "p")))
(FuncTy StaticLifetimeTy [PointerTy (VarTy "p"), LongTy] (PointerTy (VarTy "p")))
"adds a long integer value to a pointer."
(toTemplate "$p* $NAME ($p *p, long x)")
(toTemplate $ unlines ["$DECL {"
@ -108,7 +108,7 @@ templatePointerAdd = defineTemplate
templatePointerSub = defineTemplate
(SymPath ["Pointer"] "sub")
(FuncTy [PointerTy (VarTy "p"), LongTy] (PointerTy (VarTy "p")))
(FuncTy StaticLifetimeTy [PointerTy (VarTy "p"), LongTy] (PointerTy (VarTy "p")))
"subtracts a long integer value from a pointer."
(toTemplate "$p* $NAME ($p *p, long x)")
(toTemplate $ unlines ["$DECL {"
@ -118,7 +118,7 @@ templatePointerSub = defineTemplate
templatePointerWidth = defineTemplate
(SymPath ["Pointer"] "width")
(FuncTy [PointerTy (VarTy "p")] LongTy)
(FuncTy StaticLifetimeTy [PointerTy (VarTy "p")] LongTy)
"gets the byte size of a pointer."
(toTemplate "long $NAME ($p *p)")
(toTemplate $ unlines ["$DECL {"
@ -128,7 +128,7 @@ templatePointerWidth = defineTemplate
templatePointerToLong = defineTemplate
(SymPath ["Pointer"] "to-long")
(FuncTy [PointerTy (VarTy "p")] LongTy)
(FuncTy StaticLifetimeTy [PointerTy (VarTy "p")] LongTy)
"converts a pointer to a long integer."
(toTemplate "long $NAME ($p *p)")
(toTemplate $ unlines ["$DECL {"
@ -138,7 +138,7 @@ templatePointerToLong = defineTemplate
templatePointerFromLong = defineTemplate
(SymPath ["Pointer"] "from-long")
(FuncTy [LongTy] (PointerTy (VarTy "p")))
(FuncTy StaticLifetimeTy [LongTy] (PointerTy (VarTy "p")))
"converts a long integer to a pointer."
(toTemplate "$p* $NAME (long p)")
(toTemplate $ unlines ["$DECL {"