• R/O
  • SSH

Joypy: Commit

Main interpreter and library.


Commit MetaInfo

Revision9717e6a3a594ddcbe5e3921f786ebe1cd54a86ff (tree)
Time2018-07-18 02:47:50
AuthorSimon Forman <sforman@hush...>
CommiterSimon Forman

Log Message

in the middle, just want to 2ify my indents...

Change Summary

Incremental Difference

diff -r d1d91819cde5 -r 9717e6a3a594 joy/library.py
--- a/joy/library.py Tue Jul 17 10:35:11 2018 -0700
+++ b/joy/library.py Tue Jul 17 10:47:50 2018 -0700
@@ -33,6 +33,26 @@
3333 from .utils.brutal_hackery import rename_code_object
3434
3535 from .utils import generated_library as genlib
36+from .utils.types import (
37+ stack_effect,
38+ AnyJoyType,
39+ BooleanJoyType,
40+ NumberJoyType,
41+ StackJoyType,
42+ FloatJoyType,
43+ IntJoyType,
44+ TextJoyType,
45+ )
46+
47+
48+_R = range(10)
49+A = a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 = map(AnyJoyType, _R)
50+B = b0, b1, b2, b3, b4, b5, b6, b7, b8, b9 = map(BooleanJoyType, _R)
51+N = n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 = map(NumberJoyType, _R)
52+S = s0, s1, s2, s3, s4, s5, s6, s7, s8, s9 = map(StackJoyType, _R)
53+F = f0, f1, f2, f3, f4, f5, f6, f7, f8, f9 = map(FloatJoyType, _R)
54+I = i0, i1, i2, i3, i4, i5, i6, i7, i8, i9 = map(IntJoyType, _R)
55+T = t0, t1, t2, t3, t4, t5, t6, t7, t8, t9 = map(TextJoyType, _R)
3656
3757
3858 _dictionary = {}
@@ -278,9 +298,9 @@
278298 for name, primitive in getmembers(genlib, isfunction):
279299 inscribe(SimpleFunctionWrapper(primitive))
280300
281-
282301 @inscribe
283302 @FunctionWrapper
303+@stack_effect(t1)()
284304 def inscribe_(stack, expression, dictionary):
285305 '''
286306 Create a new Joy function definition in the Joy dictionary. A
diff -r d1d91819cde5 -r 9717e6a3a594 joy/utils/types.py
--- a/joy/utils/types.py Tue Jul 17 10:35:11 2018 -0700
+++ b/joy/utils/types.py Tue Jul 17 10:47:50 2018 -0700
@@ -281,6 +281,16 @@
281281 return stack
282282
283283
284+
285+def stack_effect(*inputs):
286+
287+ def _stack_effect(*outputs):
288+ pass
289+
290+return _stack_effect
291+
292+
293+
284294 _R = range(10)
285295 A = a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 = map(AnyJoyType, _R)
286296 B = b0, b1, b2, b3, b4, b5, b6, b7, b8, b9 = map(BooleanJoyType, _R)
Show on old repository browser