Advertisement
chemoelectric

Pure and Python embedded in Guile user-init.scm

Jan 16th, 2013
275
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. using system;
  7. fprintf stderr "This is a test\nof embedded Pure code.\n" ();
  8. reverse [1, 2, 3, 4, 5];
  9. »#))
  10.  
  11. (format (current-error-port) "pure-result = ~a\n" pure-result)
  12.  
  13. (format (current-error-port) "1 + 2/3 = ~a\n"
  14. (pure-expr->number
  15. (pure-eval #« using math; 1 + 2%3 »#)))
  16.  
  17. (PyRun_SimpleString
  18. (string->pointer
  19. import sys
  20. print "This is a test\nof embedded Python code."
  21. print globals ()
  22. »#
  23. ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement