Guest User

Untitled

a guest
Apr 9th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.70 KB | None | 0 0
  1.  
  2. %first idea: express new, assign and lookup as lamda terms;
  3.  
  4. %sample pseudo code in lam-nb-like notation
  5. %lookup(assign(new(),succ(zero))).
  6.  
  7.  
  8.     %apply deref to a function returning a store, e.g. assign() or new(); (the latter wouldn't succeed, though it is not initialized)
  9.     app(lam(storeName,
  10.         deref(var(storeName))
  11.       ),
  12.      
  13.       %"assign" lambda abstraction,returns store, takes store and value
  14.       app(lam( storeName,
  15.           app(lam(storeValue,
  16.               assign(var(storeName),var(storeValue))
  17.           ), succ(zero) ) %value to assign
  18.         ),
  19.        
  20.         %"store" param for "assign"-abstraction: the new-abstraction
  21.         new
  22.       )
  23.    
  24.     )
  25.     .
Add Comment
Please, Sign In to add comment