Skip to content

timyates/groovy-logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A miniKanren in Groovy.

Build Status

Basically a port of https://github.com/spariev/mini_kanren to Groovy.

Currently experimental, and could do with some help to make it nicer/faster/more useful.

For a simple example, say you have 2 lists, and you need to find the common members, you could do:

import com.bloidonia.logic.Logic

new Logic().with {
    
    // Create a fresh logic variable `q`
    fresh { q ->
    
        // Find all values for q which are in [ 1,2,3 ] and [ 2,3,4 ]
        assert run( q, membero( q, buildList( [ 1, 2, 3 ] ) ),
                       membero( q, buildList( [ 2, 3, 4 ] ) ) ) == [ 2, 3 ]
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published