https://github.com/begriffs/philosoraptor
Logic programming in JavaScript
https://github.com/begriffs/philosoraptor
Last synced: about 1 month ago
JSON representation
Logic programming in JavaScript
- Host: GitHub
- URL: https://github.com/begriffs/philosoraptor
- Owner: begriffs
- Created: 2012-01-22T00:38:22.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2012-01-22T06:32:07.000Z (about 14 years ago)
- Last Synced: 2025-09-15T12:02:42.842Z (6 months ago)
- Homepage:
- Size: 85.9 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
JavaScript cogitat, ergo est.
Example interaction in Node.js:
> r = table(['a','b'], ['a','c']) // r relates a,b and a,c
{ [Function] domain: { a: true, b: true, c: true } }
> r('a','c') // are a and c related?
true
> r('a','d') // how about a and d?
false
> r = or(r, rel('a','d')) // add an extra relation to r
{ [Function] domain: { a: true, b: true, c: true, d: true } }
> r('a','d') // see, it was added
true
> s = charg(r, lconst('a')) // new unary relation based on r
{ [Function] domain: { a: true, b: true, c: true, d: true } }
> s('b') // lconst('a') maps 'b' -> ['a','b']
true
> exists(s) // does r('a',x) for some x?
true
> all(s) // how about for all x?
false
> all( charg(or(r, rel('a','a')), lconst('a')) ) // but true when r relates a to itself as well
true
> exists( charg(r, dbl) ) // does r(x,x) for some x?
false
> // you get the idea...