Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. Cell C(Noun h, Noun t){ return new Cell(h,t); }
  2. Atom A(int i){ return new Atom(i); }
  3. Cell C(int h, Noun t){ return C(A(h),t) }
  4. Cell C(int h, Noun t){ return C(h,A(t)) }
  5. Cell C(int h, int t){ return C(A(h),A(t)) }
  6.  
  7. Noun expand7(Noun b, Noun C){
  8.   // [7 c 2 [0 1] 0 b]
  9.   // [7 [c [2 [[0 1] [0 b]]]]]
  10.   return C(7, C(c, C(2, C(C(0, 1), C(0, b)))));
  11. }
  12.  
  13. // For bonus points, with perhaps diminishing returns
  14.  
  15. Cell C( Noun h, Noun ht, Noun tt ){ return C(h,C(ht,tt)); }
  16. Cell C( Noun h, Noun ht, Noun tt ){ return C(h,ht,tt) }
  17. Cell C( Noun h, int ht,  Noun tt ){ return C(h,A(ht),tt) }
  18. Cell C( Noun h, int ht,  Noun tt ){ return C(h,ht,A(tt)) }
  19. Cell C( Noun h, int ht,  int tt  ){ return C(h,A(ht),A(tt)) }
  20. Cell C( int h,  Noun ht, Noun tt ){ return C(A(h),ht,tt) }
  21. Cell C( int h,  int ht,  Noun tt ){ return C(A(h),A(ht),tt) }
  22. Cell C( int h,  int ht,  Noun tt ){ return C(A(h),ht,A(tt)) }
  23. Cell C( int h,  int ht,  int tt  ){ return C(A(h),A(ht),A(tt)) }
  24.  
  25.  
  26. Noun expand7_b(Noun b, Noun C){
  27.   // [7 c 2 [0 1] 0 b]
  28.   // [7 c [2 [0 1] [0 b]]]
  29.   return C(7, c, C(2, C(0, 1), C(0, b)))
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement