chemoelectric

Pure and Python embedded in Guile user-init.scm

Jan 16th, 2013
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (import (sortsmillff pure)
  2. (sortsmillff python))
  3.  
  4. (define pure-result
  5. (pure-eval
  6. #«
  7. using system;
  8. fprintf stderr "This is a test\nof embedded Pure code.\n" ();
  9. reverse [1, 2, 3, 4, 5];
  10. »#))
  11.  
  12. (format (current-error-port) "pure-result = ~a\n" pure-result)
  13.  
  14. (format (current-error-port) "1 + 2/3 = ~a\n"
  15. (pure-expr->number
  16. (pure-eval #« using math; 1 + 2%3 »#)))
  17.  
  18. (PyRun_SimpleString
  19. (string->pointer
  20. #«
  21. import sys
  22. print "This is a test\nof embedded Python code."
  23. print globals ()
  24. »#
  25. ))
Advertisement
Add Comment
Please, Sign In to add comment