Recent
:: georg
4 hrs ago
:: RetroFOX
7 hrs ago
:: This post is secret Bystroushaak
9 hrs ago
:: This post is secret Bystroushaak
9 hrs ago
:: This post is secret looser
11 hrs ago
:: This post is secret looser
11 hrs ago
:: anonymous
11 hrs ago
:: anonymous
11 hrs ago
:: RIFAS
11 hrs ago
:: RIFAS
11 hrs ago
:: jbeanmoreau777
12 hrs ago
:: anonymous
13 hrs ago
:: anonymous
16 hrs ago
:: anonymous
16 hrs ago
:: anonymous
16 hrs ago
rss 2.0 feed

Make New Post
Posts: 19043

Syntax:       Wrapping:  

   #15365 Posted by david 2009-07-02 02:15:10
This post has description awaillable
Formated by GeSHi
  1.  
  2. ;; Non-deterministic computation
  3.  
  4. (define return-to-the-past
  5. (let/cc (toplevel)
  6. (letrec ((top (lambda (ign)
  7. (display "; NO MORE OPTIONS!")
  8. (newline)
  9. (toplevel top))))
  10. top)))
  11.  
  12. (define-syntax amb*
  13. (syntax-rules ()
  14. ((amb* fail)
  15. (begin
  16. (fail #f)))
  17. ((amb* fail first alt ...)
  18. (let/cc (return)
  19. (let/cc (cont)
  20. (set! return-to-the-past cont)
  21. (return first))
  22. (amb* fail alt ...)))))
  23.  
  24. (define-syntax amb
  25. (syntax-rules ()
  26. ((amb alt ...)
  27. (let ((fail-continuation return-to-the-past))
  28. (amb* fail-continuation alt ...)))))
  29.  
  30. (define (require cond)
  31. (if (not cond)
  32. (amb)))
  33.  
Parsed in 0.01874208 seconds
::  Inline view Inline view ::  Email this post Email  ::  Print Print   

:: Download   Download Text File15365.txt   Download Gziped text File15365.txt.gz   Download HTML File15365.html   Download PDF File15365.pdf
:: Print into    Print into HTML FileHTML document   Print into PDF FilePDF document

:: Make Diff

:: Erase Post

* Code:

To highlight particular lines, prefix each line with @@


Description:


Secret key (for later deletion)
Syntax:     


comments (0)


Copyright © 2006 Openpastebin