Minor edits.
This commit is contained in:
parent
7ccfba86fd
commit
d798339f86
|
|
@ -1,7 +1,8 @@
|
||||||
python build_index.py ./source/index.md > ./html/index.html
|
python build_index.py ./source/index.md > ./html/index.html
|
||||||
python build_index.py ./source/Thun.md > html/Thun.html
|
python build_index.py ./source/Thun.md > ./html/Thun.html
|
||||||
python build_index.py ./source/notebooks/BigNums.md > ./html/notebooks/BigInts.html
|
python build_index.py ./source/notebooks/BigNums.md > ./html/notebooks/BigInts.html
|
||||||
python build_index.py ./source/notebooks/Generator_Programs.md > ./html/notebooks/Generator_Programs.html
|
python build_index.py ./source/notebooks/Generator_Programs.md > ./html/notebooks/Generator_Programs.html
|
||||||
(cd ../implementations/Elm/ ; make)
|
(cd ../implementations/Elm/ ; make)
|
||||||
cp -f ../implementations/Elm/demo/Joy.js ./html/Joy.js
|
cp -f ../implementations/Elm/demo/Joy.js ./html/Joy.js
|
||||||
|
(cd ../reference/ ; make)
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -10,18 +10,17 @@ Each function, combinator, or definition should be documented here.
|
||||||
|
|
||||||
## abs
|
## abs
|
||||||
|
|
||||||
Return the absolute value of the argument.
|
Take an integer from the stack and replace it with its absolute value.
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## add
|
## add
|
||||||
|
|
||||||
Add two numbers together: a + b.
|
Take two integers from the stack and replace them with their sum.
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## &&
|
## and
|
||||||
|
|
||||||
Combinator
|
Combinator
|
||||||
|
|
||||||
|
|
@ -30,43 +29,24 @@ Short-circuiting Boolean AND
|
||||||
Accept two quoted programs, run the first and expect a Boolean value, if
|
Accept two quoted programs, run the first and expect a Boolean value, if
|
||||||
it's `true` pop it and run the second program (which should also return a
|
it's `true` pop it and run the second program (which should also return a
|
||||||
Boolean value) otherwise pop the second program (leaving `false` on the
|
Boolean value) otherwise pop the second program (leaving `false` on the
|
||||||
stack.)
|
stack.) The quoted programs are run with [nullary].
|
||||||
|
|
||||||
|
|
||||||
[A] [B] &&
|
[A] [B] and
|
||||||
---------------- true
|
----------------- A -> true
|
||||||
B
|
B
|
||||||
|
|
||||||
|
|
||||||
[A] [B] &&
|
[A] [B] and
|
||||||
---------------- false
|
----------------- A -> false
|
||||||
false
|
false
|
||||||
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
nulco [nullary [false]] dip branch
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
TODO: this is derived in one of the notebooks I think, look it up and
|
TODO: this is derived in one of the notebooks I think, look it up and
|
||||||
link to it, or copy the content here.
|
link to it, or copy the content here.
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
This is seldom useful, I suspect, but this way you have it.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
[||](#section-25)
|
[or](#or)
|
||||||
|
|
||||||
|
|
||||||
--------------
|
|
||||||
|
|
||||||
## &
|
|
||||||
|
|
||||||
See [and](#and).
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -85,27 +65,26 @@ predicate `P`.
|
||||||
|
|
||||||
The `range` function generates a list of the integers from 0 to n - 1:
|
The `range` function generates a list of the integers from 0 to n - 1:
|
||||||
|
|
||||||
> \[0 <=\] \[\-\- dup\] anamorphism
|
[0 <=] [-- dup] anamorphism
|
||||||
|
|
||||||
### Discussion
|
> joy? 5
|
||||||
|
>
|
||||||
|
> 5
|
||||||
|
>
|
||||||
|
> joy? [0 <=] [-- dup]
|
||||||
|
>
|
||||||
|
> 5 [0 <=] [-- dup]
|
||||||
|
>
|
||||||
|
> joy? anamorphism
|
||||||
|
>
|
||||||
|
> [4 3 2 1 0]
|
||||||
|
|
||||||
|
Note that the last value generated (0) is at the bottom of the list.
|
||||||
See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html).
|
See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html).
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## and
|
|
||||||
|
|
||||||
Logical bit-wise AND.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
[or](#or)
|
|
||||||
[xor](#xor)
|
|
||||||
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
## app1
|
## app1
|
||||||
|
|
||||||
"apply one"
|
"apply one"
|
||||||
|
|
@ -113,7 +92,7 @@ Logical bit-wise AND.
|
||||||
Combinator
|
Combinator
|
||||||
|
|
||||||
Given a quoted program on TOS and anything as the second stack item run
|
Given a quoted program on TOS and anything as the second stack item run
|
||||||
the program without disturbing the stack and replace the two args with
|
the program without disturbing the rest of the stack and replace the two args with
|
||||||
the first result of the program.
|
the first result of the program.
|
||||||
|
|
||||||
... x [Q] app1
|
... x [Q] app1
|
||||||
|
|
@ -1958,12 +1937,12 @@ Take the item on the top of the stack and [cons] it onto `[nullary]`.
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Helper function for [\|\|] and [&&].
|
Helper function for [or] and [and].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
[&&]
|
[and]
|
||||||
[||]
|
[or]
|
||||||
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
@ -3319,7 +3298,7 @@ stack.)
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
[&&](#section-1)
|
[and]
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,44 +44,32 @@ for el in used_by.values():
|
||||||
el.sort()
|
el.sort()
|
||||||
|
|
||||||
|
|
||||||
def def_format(to, name):
|
|
||||||
try:
|
|
||||||
defi = definitions[name]
|
|
||||||
except KeyError:
|
|
||||||
return
|
|
||||||
to = to.div(class_='definition')
|
|
||||||
to.h3('Definition')
|
|
||||||
to = to.blockquote
|
|
||||||
start = 0
|
|
||||||
for match in re.finditer('[^ [\]]+', defi):
|
|
||||||
b, e = match.span()
|
|
||||||
if b != start:
|
|
||||||
to += defi[start:b]
|
|
||||||
foo = match.group()
|
|
||||||
anchor = anchors.get(foo, '')
|
|
||||||
to.a(foo, href='#' + anchor)
|
|
||||||
start = e
|
|
||||||
end = defi[start:]
|
|
||||||
if end:
|
|
||||||
to += end
|
|
||||||
|
|
||||||
|
def foo(to, text, class_='notes'):
|
||||||
|
|
||||||
def foo(to, text):
|
|
||||||
html = markdown.markdown(text, output_format="html5")
|
html = markdown.markdown(text, output_format="html5")
|
||||||
html = '<div class="notes">' + html + '</div>'
|
html = f'<div class="{class_}">{html}</div>'
|
||||||
try:
|
try:
|
||||||
t = ET.fromstringlist([html])
|
t = ET.fromstringlist([html])
|
||||||
except:
|
except:
|
||||||
print(repr(html))
|
#######################print(repr(html))
|
||||||
raise
|
#raise
|
||||||
|
t = text
|
||||||
to += t
|
to += t
|
||||||
|
|
||||||
|
|
||||||
basis_functions = set('''\
|
basis_functions = set('''\
|
||||||
i dip branch loop
|
i dip branch loop
|
||||||
cons first rest stack swaack
|
cons first rest stack swaack
|
||||||
dup swap pop clear'''.split())
|
dup swap pop clear
|
||||||
|
add sub mul div rem remainder
|
||||||
|
+ - * / %
|
||||||
|
concat
|
||||||
|
truthy
|
||||||
|
inscribe
|
||||||
|
< > >= <= != <> =
|
||||||
|
gt lt ge le neq eq
|
||||||
|
<< >>
|
||||||
|
lshift rshift'''.split())
|
||||||
|
|
||||||
k = re.split('^-+$', md, flags=re.MULTILINE)
|
k = re.split('^-+$', md, flags=re.MULTILINE)
|
||||||
#k = md.split('------------------------------------------------------------------------\n')
|
#k = md.split('------------------------------------------------------------------------\n')
|
||||||
|
|
@ -105,7 +93,7 @@ def anchor_for(name):
|
||||||
|
|
||||||
anchors = {}
|
anchors = {}
|
||||||
sections = {}
|
sections = {}
|
||||||
for i, section in enumerate(k):
|
for section in k:
|
||||||
for line in section:
|
for line in section:
|
||||||
if line.startswith('## '):
|
if line.startswith('## '):
|
||||||
name = line[3:].strip()
|
name = line[3:].strip()
|
||||||
|
|
@ -141,6 +129,38 @@ for name, section in sections.items():
|
||||||
del section[i:]
|
del section[i:]
|
||||||
|
|
||||||
|
|
||||||
|
def add_definition(to, name):
|
||||||
|
try:
|
||||||
|
defi = definitions[name]
|
||||||
|
except KeyError:
|
||||||
|
return
|
||||||
|
to = to.div(class_='definition_wrapper')
|
||||||
|
to.h3('Definition')
|
||||||
|
to = to.div(class_='definition')
|
||||||
|
start = 0
|
||||||
|
for match in re.finditer('[^ [\]]+', defi):
|
||||||
|
b, e = match.span()
|
||||||
|
if b != start:
|
||||||
|
to += defi[start:b]
|
||||||
|
foo = match.group()
|
||||||
|
if foo.isnumeric() or foo == 'true' or foo == 'false':
|
||||||
|
to += foo
|
||||||
|
else:
|
||||||
|
to.a(foo, href='#' + get_anchor(foo))
|
||||||
|
start = e
|
||||||
|
end = defi[start:]
|
||||||
|
if end:
|
||||||
|
to += end
|
||||||
|
|
||||||
|
|
||||||
|
non = set()
|
||||||
|
def get_anchor(name):
|
||||||
|
if name in anchors:
|
||||||
|
return anchors[name]
|
||||||
|
non.add(name)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def add_crosslinks(to, name):
|
def add_crosslinks(to, name):
|
||||||
try:
|
try:
|
||||||
links = crosslinks[name]
|
links = crosslinks[name]
|
||||||
|
|
@ -168,9 +188,9 @@ def add_discussion(to, name):
|
||||||
discussion = discussions[name]
|
discussion = discussions[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return
|
return
|
||||||
to = to.div(class_='discussion')
|
to = to.div(class_='discussion_wrapper')
|
||||||
to.h3('Discussion')
|
to.h3('Discussion')
|
||||||
to += ('\n'.join(discussion))
|
foo(to, '\n'.join(discussion), class_='discussion')
|
||||||
|
|
||||||
|
|
||||||
def add_backlinks(to, name):
|
def add_backlinks(to, name):
|
||||||
|
|
@ -188,7 +208,7 @@ def add_backlinks(to, name):
|
||||||
first = not first
|
first = not first
|
||||||
else:
|
else:
|
||||||
to += ' '
|
to += ' '
|
||||||
anchor = anchors.get(link_to, '')
|
anchor = get_anchor(link_to)
|
||||||
to.a(link_to, href='#' + anchor, class_='func_name')
|
to.a(link_to, href='#' + anchor, class_='func_name')
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -197,7 +217,7 @@ doc = HTML()
|
||||||
with doc.head as h:
|
with doc.head as h:
|
||||||
h.meta(charset='utf-8')
|
h.meta(charset='utf-8')
|
||||||
h.title(TITLE)
|
h.title(TITLE)
|
||||||
h.link(rel='stylesheet', href='/css/fonts.css')
|
h.link(rel='stylesheet', href='/css/font/fonts.css')
|
||||||
h.link(rel='stylesheet', href='/css/func_ref.css')
|
h.link(rel='stylesheet', href='/css/func_ref.css')
|
||||||
|
|
||||||
with doc.body as b:
|
with doc.body as b:
|
||||||
|
|
@ -226,7 +246,7 @@ with doc.body as b:
|
||||||
|
|
||||||
foo(d, '\n'.join(section))
|
foo(d, '\n'.join(section))
|
||||||
|
|
||||||
def_format(d, name)
|
add_definition(d, name)
|
||||||
add_discussion(d, name)
|
add_discussion(d, name)
|
||||||
add_crosslinks(d, name)
|
add_crosslinks(d, name)
|
||||||
add_backlinks(d, name)
|
add_backlinks(d, name)
|
||||||
|
|
@ -239,3 +259,7 @@ print(html_string, file=open('../html/FuncRef.html', 'w'))
|
||||||
|
|
||||||
##import pprint
|
##import pprint
|
||||||
##pprint.pprint(crosslinks)
|
##pprint.pprint(crosslinks)
|
||||||
|
|
||||||
|
if non:
|
||||||
|
for n in sorted(non):
|
||||||
|
print(n)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue