Lambda Calculus
Artifact [599b2da66c]
Not logged in

Artifact 599b2da66cefd0e9135c408b331f132df4b8c8ea:

Wiki page [Notes] by bill 2011-07-16 22:59:44.
D 2011-07-16T22:59:44.454
L Notes
P fb68236f5bba44378825b29fec672f40b8f7e647
U bill
W 1454
<i>Notes</i>
  *  Don't represent "up" and "down" aliens in LC -- it's a display concern


VM

  *  prims: <nowiki>[30 bits][00]</nowiki>
  *  contexts: <nowiki>[30 bits][10] (aligned on 4-byte boundaries, starting at 2)</nowiki>
  *  GC -- <nowiki>[at first, none]</nowiki> try getting VMKit to generate a .bc file for MMTk

<verbatim>
MISC

# compose = (rec \compose rest func if-continue . if-continue (compose (\x . rest (func x))) \x . rest (func x)) identity

# Random number generator taken from "Xorshift RNGs", by George Marsaglia, Florida State University
# Here's where I found it: http://www.jstatsoft.org/v08/i14/paper
# This works on a list of booleans, using this formula for the next step:
#	x ^= x << a
#	x ^= x >> b
#	x ^= x << c
#
#	Some small numbers that work are: a = 1, b = 7, c = 9
#
# so:	if we say xorF = \x f . lxor x (f x), that's kind of like x ^= f(x)
#	rand = xorF (xorF (xorF x 1rshift) 7lshift) 9rshift

map = rec \map op l . l (\h t D . cons (op h) (map op t)) false
map2 = rec \map2 op l1 l2 . l1 (\h1 t1 D . l2 (\h2 t2 D . cons (op h1 h2) (map2 op t1 t2)) t1) l2
lxor = \l1 l2 . map2 xor l1 l2
1rshift = \l . cons false l
7lshift = \l . tail (tail (tail (tail (tail (tail (tail l))))))
3rshift = \l . cons false (cons false (cons false l))
9rshift = \l . 3rshift (3rshift (3rshift l))
xorF = \x f . lxor x (f x)
rand = \x . xorF (xorF (xorF x 1rshift) 7lshift) 9rshift
</verbatim>

Z d60cd6f704c9fa8fd6d2421b69197443