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/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/Generator_Programs.md > ./html/notebooks/Generator_Programs.html
|
||||
(cd ../implementations/Elm/ ; make)
|
||||
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
|
||||
|
||||
Return the absolute value of the argument.
|
||||
Take an integer from the stack and replace it with its absolute value.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
## add
|
||||
|
||||
Add two numbers together: a + b.
|
||||
|
||||
Take two integers from the stack and replace them with their sum.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
## &&
|
||||
## and
|
||||
|
||||
Combinator
|
||||
|
||||
|
|
@ -30,43 +29,24 @@ Short-circuiting Boolean AND
|
|||
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
|
||||
Boolean value) otherwise pop the second program (leaving `false` on the
|
||||
stack.)
|
||||
stack.) The quoted programs are run with [nullary].
|
||||
|
||||
|
||||
[A] [B] &&
|
||||
---------------- true
|
||||
[A] [B] and
|
||||
----------------- A -> true
|
||||
B
|
||||
|
||||
|
||||
[A] [B] &&
|
||||
---------------- false
|
||||
[A] [B] and
|
||||
----------------- A -> false
|
||||
false
|
||||
|
||||
|
||||
### Definition
|
||||
|
||||
nulco [nullary [false]] dip branch
|
||||
|
||||
### Derivation
|
||||
|
||||
TODO: this is derived in one of the notebooks I think, look it up and
|
||||
link to it, or copy the content here.
|
||||
|
||||
### Discussion
|
||||
|
||||
This is seldom useful, I suspect, but this way you have it.
|
||||
|
||||
### Crosslinks
|
||||
|
||||
[||](#section-25)
|
||||
|
||||
|
||||
--------------
|
||||
|
||||
## &
|
||||
|
||||
See [and](#and).
|
||||
|
||||
[or](#or)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -85,27 +65,26 @@ predicate `P`.
|
|||
|
||||
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).
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
## and
|
||||
|
||||
Logical bit-wise AND.
|
||||
|
||||
### Crosslinks
|
||||
|
||||
[or](#or)
|
||||
[xor](#xor)
|
||||
|
||||
|
||||
--------------------
|
||||
|
||||
## app1
|
||||
|
||||
"apply one"
|
||||
|
|
@ -113,7 +92,7 @@ Logical bit-wise AND.
|
|||
Combinator
|
||||
|
||||
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.
|
||||
|
||||
... x [Q] app1
|
||||
|
|
@ -1958,12 +1937,12 @@ Take the item on the top of the stack and [cons] it onto `[nullary]`.
|
|||
|
||||
### Discussion
|
||||
|
||||
Helper function for [\|\|] and [&&].
|
||||
Helper function for [or] and [and].
|
||||
|
||||
### Crosslinks
|
||||
|
||||
[&&]
|
||||
[||]
|
||||
[and]
|
||||
[or]
|
||||
|
||||
|
||||
--------------------
|
||||
|
|
@ -3319,7 +3298,7 @@ stack.)
|
|||
|
||||
### Crosslinks
|
||||
|
||||
[&&](#section-1)
|
||||
[and]
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -44,44 +44,32 @@ for el in used_by.values():
|
|||
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):
|
||||
def foo(to, text, class_='notes'):
|
||||
html = markdown.markdown(text, output_format="html5")
|
||||
html = '<div class="notes">' + html + '</div>'
|
||||
html = f'<div class="{class_}">{html}</div>'
|
||||
try:
|
||||
t = ET.fromstringlist([html])
|
||||
except:
|
||||
print(repr(html))
|
||||
raise
|
||||
#######################print(repr(html))
|
||||
#raise
|
||||
t = text
|
||||
to += t
|
||||
|
||||
|
||||
basis_functions = set('''\
|
||||
i dip branch loop
|
||||
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 = md.split('------------------------------------------------------------------------\n')
|
||||
|
|
@ -105,7 +93,7 @@ def anchor_for(name):
|
|||
|
||||
anchors = {}
|
||||
sections = {}
|
||||
for i, section in enumerate(k):
|
||||
for section in k:
|
||||
for line in section:
|
||||
if line.startswith('## '):
|
||||
name = line[3:].strip()
|
||||
|
|
@ -141,6 +129,38 @@ for name, section in sections.items():
|
|||
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):
|
||||
try:
|
||||
links = crosslinks[name]
|
||||
|
|
@ -168,9 +188,9 @@ def add_discussion(to, name):
|
|||
discussion = discussions[name]
|
||||
except KeyError:
|
||||
return
|
||||
to = to.div(class_='discussion')
|
||||
to = to.div(class_='discussion_wrapper')
|
||||
to.h3('Discussion')
|
||||
to += ('\n'.join(discussion))
|
||||
foo(to, '\n'.join(discussion), class_='discussion')
|
||||
|
||||
|
||||
def add_backlinks(to, name):
|
||||
|
|
@ -188,7 +208,7 @@ def add_backlinks(to, name):
|
|||
first = not first
|
||||
else:
|
||||
to += ' '
|
||||
anchor = anchors.get(link_to, '')
|
||||
anchor = get_anchor(link_to)
|
||||
to.a(link_to, href='#' + anchor, class_='func_name')
|
||||
|
||||
|
||||
|
|
@ -197,7 +217,7 @@ doc = HTML()
|
|||
with doc.head as h:
|
||||
h.meta(charset='utf-8')
|
||||
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')
|
||||
|
||||
with doc.body as b:
|
||||
|
|
@ -226,7 +246,7 @@ with doc.body as b:
|
|||
|
||||
foo(d, '\n'.join(section))
|
||||
|
||||
def_format(d, name)
|
||||
add_definition(d, name)
|
||||
add_discussion(d, name)
|
||||
add_crosslinks(d, name)
|
||||
add_backlinks(d, name)
|
||||
|
|
@ -239,3 +259,7 @@ print(html_string, file=open('../html/FuncRef.html', 'w'))
|
|||
|
||||
##import pprint
|
||||
##pprint.pprint(crosslinks)
|
||||
|
||||
if non:
|
||||
for n in sorted(non):
|
||||
print(n)
|
||||
|
|
|
|||
Loading…
Reference in New Issue