| Did you know ... | Search Documentation: | 
|  | Translating JavaScript data to Prolog | 
This section describes how data from JavaScript is translated into Prolog. The interface is primarily designed for passing JavaScript data as typically used to a natural Prolog representation. In addition a number of classes are provided to create Prolog specific data structures such as strings (as opposed to atoms), variables, compound terms, etc.
new Prolog.String(text) 
to create a Prolog string. See below.true or false.undefined.null.$:Typev holds the text. May be 
created using new Prolog.string(text). May be created using new 
Prolog.String(text).n and d 
represent the numerator and denominator. For example, 
to represent 1r3, use {$:"r",
n:1, d:3}. May be created using new 
Prolog.Rational(n, d), where n and d can be 
JavaScript numbers or big integers.point(1,2) is constructed using
{$:"t", point:[1,2]}. May be created using new 
Prolog.Compound(functor, args)v is present this 
identifies the variable. Two variables processed in the same translation 
with the same identifier represent the same Prolog variable. If the v 
key is omitted the variable will be unique. May be created using new 
Prolog.Var(id).Array we only need 
this typed object to create a partial list. The v 
key contains the “normal” elements and the key tail 
contains the tail of the list. May be created using new 
Prolog.List(array, tail).Objectdict. 
Note that JavaScript object keys are always strings and (thus) all dict 
keys are atoms. This, {1:"one"} is translated into
_{'1': one}.ArrayBuffer are translated into a Prolog 
string that consists of characters in the range 0 ... 255.Object<js_Class(id)>. The 
Prolog interface allows for passing the objects back and calling methods 
on them. See section 
13.3.