Skip to content

NoahStoryM/amb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

113 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amb: Ambiguous Operator

Table of Contents

Introduction

John McCarthy’s ambiguous operator for Racket, implemented via delimited continuations.

This repository contains two packages:

  • amb — the core library
  • typed-amb — Typed Racket interface

Quick Start

(require amb)

(for/list ([x (in-amb (amb 1 2 3))])
  x)
;; => '(1 2 3)

(for/list ([t (in-amb (let ([a (for/amb ([i (in-range 1 20)]) i)]
                            [b (for/amb ([i (in-range 1 20)]) i)]
                            [c (for/amb ([i (in-range 1 20)]) i)])
                        (unless (and (<= a b)
                                     (= (+ (* a a) (* b b)) (* c c)))
                          (amb))
                        (list a b c)))])
  t)
;; => '((3 4 5) (5 12 13) (6 8 10) (8 15 17) (9 12 15))

Installation

raco pkg install amb        # untyped
raco pkg install typed-amb  # typed

Documentation

After installation, run:

raco docs amb

Or read the source documentation in pkgs/amb/scribblings/amb.scrbl.

License

MIT. See LICENSE.

About

Ambiguous Operator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages