ProscriptLS Documentation


Reference

This reference documentation is for the aspects of ProscriptLS that differ from ISO Prolog.
  • Using ProscriptLS programs in a web browser:

    There are three parts to using a Prolog predicate in a browser.
    • Load the proscriptls.js library:
      
      <script type="text/javascript" src="PROSCRIPTLS_git/dist/proscriptls.js"> </script>
      This library includes the ProscriptLS compiler.
    • Define ProscriptLS/Prolog program:
      
      <script type="text/prolog">PROLOG_SOURCE</script> 
      or
      
      <script type="text/prolog" src="PATH_TO_PROLOG_SOURCE"</script>
      This PROLOG_SOURCE will be compiled to WAM (Warren Abstract Machine) byte codes when the proscriptls_init function is evaluated. These byte codes are interpreted by the WAM engine in the procriptls.js library.
    • Run proscriptls_init () function:
      
      <body onload="proscriptls_init ();"> BODY </body>
      proscriptls_init () sets up the Prolog state including the core system predicates. Also it finds all of the script elements with type 'text/prolog' and compiles the associated sources.
    There appears to be an order-sensitivity in the layout of the HTML: the prolog script element should be at the end of the body element.
  • Debugger:

    There is a command-line debugger that supports stepping through the evaluation of a ProscriptLS program. This debugger is run from a browser. It uses JQuery.terminal to provide the command line environment.
    The debugger files are in PROSCRIPTLS_git/terminal. The HTML page must be set up as described above with the proscriptls.js library and an invocation of the proscriptls_init () Javascript method.
    There are three more steps specific to setting up the terminal as a ProscriptLS interpreter:
    • Get the JQuery terminal files:
      
      <script src="jquery-3.3.1.js"></script>
      <script src="jquery_terminal.js"></script>
      <link href="jquery_terminal.css" rel="stylesheet"/>
      (These elements may be in the HTML header element.)
    • Get the ProscriptLS interpreter library:
      
      <script type="text/javascript" src="proscriptls_interpreter_terminal.js"></script>
    • Create a DIV element with ID 'proscriptinterpreter'. This element will display the command line console of the interpreter.
      
      <div id="proscriptinterpreter"></div>
  • Javascript and HTML objects

    There are a number of types of Javascript objects that are supported by ProscriptLS. Most of the supported types of objects implement W3C HTML Web API interfaces. In addition there is the Promise object used in supporting asynchronous evaluations.
    The ProscriptLS support for Javascript objects is exposed through a collection of builtin predicates. In addition there is a convenience syntax defined in the object.pl library file to simplify working with objects.

    W3C Web API

    The HTML Web API defined by W3C specifies many interfaces. These interfaces are implemented in Javascript in web browsers as Javascript objects. The primary reference is HTML 5.2. Other references include: W3C DOM4, HTML Canvas 2D Context for the Canvas2DRenderingContext interface, CSS Object Model, Fetch API that defines the semantics for the Javascript window.fetch() method, and FileAPI for accessing files.

    The Web API Interfaces that are implemented as ProscriptLS object types are documented below.

    Each interface has:
    • a corresponding ProscriptLS type that is the lowercase version of the interface name,
    • a link to a World Wide Web Consortium (W3C) standard or the Web Hypertext Application Technology Working Group (WHATWG) standard for that interface (generally this documentation uses the W3C documentation where available in preference to WHATWG),
    • a link to the MDN ("MDN Web Docs" formerly known as "MDN — the Mozilla Developer Network") documentation for that interface,
    • a list of parent interfaces from which the subject interface inherits methods and properties,
    • a list of child interfaces that inherit from the subject interface,
    • a list of the properties defined for the subject interface, and
    • a list of methods defined for the subject interface.

    Each property is defined with the name used to access that property in ProscriptLS and the ProscriptLS data type for that property. If the Javascript method name is different from the ProscriptLS name for the property then that is indicated by the implementation name in parentheses. The ProscriptLS data type of 'object' indicates that the term represents a Javascript object, either one with an interface type defined in this section or a Javascript system object such as Promise.

    Each method is defined with a named used to access that method in ProscriptLS and a parenthesized list of the ProscriptLS data types of the arguments for invoking that method. If the Javascript method used to implement the subject method has a different name then this is indicated by the phrase "Implemented by X" where "X" is the Javascript method name. If the method returns a value then the returned value will be unified with last argument.

    There are two ways to read Web API interface type object attributes, properties, and methods. This can be directly using the dom_element_attribute_value/3, dom_object_property/4, dom_object_method/2, and dom_object_method/3 predicates or indirectly using the objects DSL, particularly the >->/2 operator for evaluating an object attribute, >+>/2 operator for evaluating an object property, and the >*>/2 operator for evaluating an object method.

    The HTML Element innerText property of an element with ID 'foo' can be evaluated by

    dom_element_attribute_value(Element, id, foo), dom_object_property(_, Element, innerText, Text).
    or

    Element >-> id :> foo, Element >+> innerText :> Text.
    or because these two predicates refer to the same object Element, they can be collapsed as

    Element >> [id -:> foo, innerText +:> Text].

    The HTML Element insertAdjacentText method of an element with ID 'foo' can be evaluated by

    dom_element_attribute_value(Element, id, foo), dom_object_method(Element, insertAdjacentText(beforebegin, "some text")).
    or

    Element >-> id :> foo, Element >*> insertAdjacentText(beforebegin, "some text").
    which can be collapsed to

    Element >> [id -:> foo, insertAdjacentText(beforebegin, "some text")].

    Some of the attributes and properties can also be written. This is done in two ways: the set_dom_element_attribute_value/3 and set_dom_object_property/4 predicates or using the <:/2, <:-/2, or <:+/2 operators in the object DSL.

    Adding to the class of an element as an attribute:



    dom_element_attribute_value(Element, id, foo), set_dom_element_attribute_value(Element, class, fancy).
    or

    Element >-> id :> foo, Element >-> class <: fancy.
    which can be collapsed to

    Element >> [id -:> foo, class <:- fancy].
    • BarProp (Standard): barprop
      Properties
      • visible: boolean
      (no methods)
    • Blob (Standard, MDN): blob
      Children
      Properties
      • size: number
      • type: atom
      Methods
      • slice(number, number, string, object) [last arg is result]
    • CanvasGradient (Standard, MDN): canvasgradient
      (no properties)
      Methods
      • addColorStop(number, string)
    • CanvasPattern (Standard, MDN): canvaspattern
      (no properties) (no methods)
    • CanvasRenderingContext2D (Standard, MDN): canvasrenderingcontext2d
      Properties
      • canvas: object
      • fillStyle: [atom,object]
      • font: atom
      • globalAlpha: number
      • globalCompositeOperation: atom
      • imageSmoothingEnabled: atom
      • lineCap: atom
      • lineDashOffset: number
      • lineJoin: atom
      • lineWidth: number
      • miterLimit: number
      • shadowBlur: number
      • shadowColor: atom
      • shadowOffsetX: number
      • shadowOffsetY: number
      • strokeStyle: [atom,object]
      • textAlign: atom
      • textBaseline: atom
      Methods
      • arc(number, number, number, number, number, boolean)
      • arcTo(number, number, number, number, number)
      • beginPath
      • bezierCurveTo(number, number, number, number, number, number)
      • clearRect(number, number, number, number)
      • clip(string)
      • clipPath(object, string) Implemented by clip.
      • closePath
      • createImageData(number, number, object) [last arg is result]
      • createImageDataCopy(object, object) [last arg is result] Implemented by createImageData.
      • createLinearGradient(number, number, number, number, object) [last arg is result]
      • createPattern(object, string, object) [last arg is result]
      • createRadialGradient(number, number, number, number, number, number, object) [last arg is result]
      • drawFocusIfNeeded(object)
      • drawFocusIfNeededPath(object, object) Implemented by drawFocusIfNeeded.
      • drawImage(object, number, number, number, number, number, number, number, number)
      • ellipse(number, number, number, number, number, number, number, boolean)
      • fill(string)
      • fillPath(object, string) Implemented by fill.
      • fillRect(number, number, number, number)
      • fillText(string, number, number, number)
      • getImageData(number, number, number, number, object) [last arg is result]
      • getLineDash(array:number) [last arg is result]
      • isPointInPath(number, number, string, boolean) [last arg is result]
      • isPointInPathX(object, number, number, string, boolean) [last arg is result] Implemented by isPointInPath.
      • isPointInStroke(number, number, boolean) [last arg is result]
      • isPointInStrokePath(object, number, number, boolean) [last arg is result] Implemented by isPointInStroke.
      • lineTo(number, number)
      • measureText(string_codes, object) [last arg is result]
      • moveTo(number, number)
      • putImageData(object, number, number, number, number, number, number)
      • quadraticCurveTo(number, number, number, number)
      • rect(number, number, number, number)
      • restore
      • rotate(number)
      • save
      • scale(number, number)
      • setLineDash(array:number)
      • setTransform(number, number, number, number, number, number)
      • stroke(object)
      • strokeRect(number, number, number, number)
      • strokeText(string, number, number, number)
      • transform(number, number, number, number, number, number)
      • translate(number, number)
    • CSSRule (Standard, MDN): cssrule
      Properties
      • cssText: string
      • parentRule: object
      • parentStyleSheet: object
      • type: number
      (no methods)
    • CSSStyleDeclaration (Standard, MDN): cssstyledeclaration
      Properties
      • cssText: string
      • length: number
      • parentRule: object
      Methods
      • getPropertyPriority(string, string) [last arg is result]
      • getPropertyValue(string, string) [last arg is result]
      • item(integer, atom) [last arg is result]
      • removeProperty(string, string) [last arg is result]
      • setProperty(string, string, string)
    • CustomElementRegistry (Standard, MDN): customelementregistry
      (no properties)
      Methods
      • define(string, object, object)
      • get(string, object) [last arg is result]
      • upgrade(object)
      • whenDefined(string, object) [last arg is result]
    • Document (Standard, MDN): document
      Parents
      Properties
      • URL: string
      • characterSet: atom
      • compatMode: atom
      • contentType: atom
      • docType: object
      • documentElement: object
      • documentURI: string
      • origin: string
      Methods
      • adoptNode(object, object) [last arg is result]
      • createAttribute(string, object) [last arg is result]
      • createAttributeNS(string, string, object) [last arg is result]
      • createCDATASection(string, object) [last arg is result]
      • createComment(string, object) [last arg is result]
      • createDocumentFragment(object) [last arg is result]
      • createElement(string, object, object) [last arg is result]
      • createElementNS(string, string, object, object) [last arg is result]
      • createEvent(string, object) [last arg is result]
      • createNodeIterator(object, number, object, object) [last arg is result]
      • createProcessingInstruction(string, string, object) [last arg is result]
      • createRange(string, object) [last arg is result]
      • createTextNode(string, object) [last arg is result]
      • createTreeWalker(object, number, object, object) [last arg is result]
      • getElementsByTagName(string, object) [last arg is result]
      • getElementsByTagNameNS(string, string, object) [last arg is result]
      • importNode(object, boolean, object) [last arg is result]
    • DocumentFragment (Standard, MDN): documentfragment
      Parents
      Properties
      • is: atom
      (no methods)
    • Element (Standard, MDN): element
      Parents
      Children
      Properties
      • accessKey: atom
      • class: atom
      • clientHeight: number
      • clientLeft: number
      • clientTop: number
      • clientWidth: number
      • id: atom
      • innerHTML: string
      • namespaceURI: string
      • nextElementSibling: object
      • previousElementSibling: object
      • scrollHeight: number
      • scrollLeft: number
      • scrollTop: number
      • scrollWidth: number
      • tag: atom
      Methods
      • getBoundingClientRect(dom_rect) [last arg is result]
      • insertAdjacentElement(position, object)
      • insertAdjacentHTML(position, string_codes)
      • insertAdjacentText(position, string_codes)
      • scrollIntoView([boolean,options])
    • ElementCreationOptions (Standard, MDN): elementcreationoptions
      Properties
      • is: atom
      (no methods)
    • Event (Standard, MDN): event
      Children
      Properties
      • bubbles: boolean
      • cancelBubble: boolean
      • cancelable: boolean
      • composed: boolean
      • currentTarget: object
      • defaultPrevented: boolean
      • eventPhase: number
      • isTrusted: boolean
      • returnValue: boolean
      • target: object
      • timeStamp: number
      • type: string
      Methods
      • composedPath(object) [last arg is result]
      • preventDefault
      • setProperty(string, string, string)
      • stopImmediatePropagation
      • stopPropagation
    • EventTarget (Standard, MDN): eventtarget
      Children
      (no properties)
      Methods
      • addEventListener(string, goal_function)
      • dispatchEvent(event, boolean) [last arg is result]
      • removeEventListener(string, goal_function)
    • File (Standard, MDN): file
      Parents
      Properties
      • lastModified: number
      • name: atom
      (no methods)
    • History (Standard, MDN): history
      Properties
      • length: number
      • scrollRestoration: atom
      • state: atom
      Methods
      • back
      • forward
      • go(number)
      • pushState(string, string, string)
      • replaceState(string, string, string)
    • HTMLCanvasElement (Standard, MDN): htmlcanvaselement
      Parents
      Properties
      • height: number
      • width: number
      Methods
      • getContext(string, object) [last arg is result]
      • removeProperty(string, atom) [last arg is result]
      • setProperty(string, string, string)
      • toBlob(goal_function, string, float)
      • toDataURL(string, float, string_codes) [last arg is result]
    • HTMLElement (Standard, MDN): htmlelement
      Parents
      Children
      Properties
      • contentEditable: atom
      • dir: atom
      • innerText: string
      • lang: atom
      • offsetHeight: number
      • offsetLeft: number
      • offsetParent: object
      • offsetTop: number
      • offsetWidth: number
      • style: object
      • tabIndex: number
      • title: string
      Methods
      • blur
      • click
      • focus
    • HTMLFormElement (Standard, MDN): htmlformelement
      Parents
      (no properties) (no methods)
    • HTMLImageElement (Standard, MDN): htmlimageelement
      Parents
      Properties
      • src: string
      (no methods)
    • HTMLInputElement (Standard, MDN): htmlinputelement
      Parents
      Properties
      • accept: atom
      • alt: string
      • autocomplete: atom
      • autofocus: boolean
      • checked: boolean
      • defaultChecked: boolean
      • defaultValue: atom
      • dirName: atom
      • disabled: boolean
      • files: object
      • form: object
      • formAction: atom
      • formEnctype: atom
      • formMethod: atom
      • formNoValidate: boolean
      • formTarget: atom
      • height: number
      • indeterminate: boolean
      • labels: object
      • max: atom
      • maxLength: number
      • min: atom
      • minLength: number
      • multiple: boolean
      • name: atom
      • pattern: atom
      • placeholder: atom
      • readOnly: boolean
      • required: boolean
      • selectionDirection: atom
      • selectionEnd: number
      • selectionStart: number
      • size: number
      • src: atom
      • step: atom
      • type: atom
      • validationMessage: atom
      • validity: object
      • value: atom
      • valueAsNumber: number
      • width: number
      • willValidate: boolean
      Methods
      • checkValidity(boolean) [last arg is result]
      • reportValidity(boolean) [last arg is result]
      • select
      • setCustomValidity(string)
      • setRangeText(string, number, number, string)
      • setSelectionRange(number, number, string)
      • stepDown(number)
      • stepUp(number)
    • HTMLOptionElement (Standard, MDN): htmloptionelement
      Parents
      Properties
      • defaultSelected: boolean
      • disabled: boolean
      • form: object
      • index: number
      • label: string
      • selected: boolean
      • text: string
      • value: atom
      (no methods)
    • HTMLSelectElement (Standard, MDN): htmlselectelement
      Parents
      Properties
      • autofocus: boolean
      • disabled: boolean
      • form: object
      • labels: object
      • length: number
      • multiple: boolean
      • name: atom
      • options: object
      • required: boolean
      • selectedIndex: number
      • selectedOptions: object
      • size: number
      • type: atom
      • validationMessage: atom
      • validity: object
      • value: atom
      • willValidate: boolean
      Methods
      • add(object, [object,number])
      • checkValidity(boolean) [last arg is result]
      • item(number, object) [last arg is result]
      • namedItem(string, object) [last arg is result]
      • remove(number)
      • reportValidity(boolean) [last arg is result]
      • setCustomValidity(string)
    • HTMLTextAreaElement (Standard, MDN): htmltextareaelement
      Parents
      Properties
      • autofocus: boolean
      • cols: number
      • defaultValue: atom
      • dirName: atom
      • disabled: boolean
      • form: object
      • labels: object
      • maxLength: number
      • minLength: number
      • name: atom
      • placeholder: atom
      • readOnly: boolean
      • required: boolean
      • rows: number
      • selectionDirection: atom
      • selectionEnd: number
      • selectionStart: number
      • textLength: number
      • type: atom
      • validationMessage: atom
      • validity: object
      • value: atom
      • willValidate: boolean
      • wrap: atom
      Methods
      • checkValidity(boolean) [last arg is result]
      • reportValidity(boolean) [last arg is result]
      • select
      • setCustomValidity(string)
      • setRangeText(string, number, number, string)
      • setSelectionRange(number, number, string)
    • HTMLUnknownElement (Standard, MDN): htmlunknownelement
      Parents
      (no properties) (no methods)
    • ImageData (Standard, MDN): imagedata
      Properties
      • data: object
      (no methods)
    • Location (Standard, MDN): location
      Properties
      • hash: atom
      • host: atom
      • hostname: atom
      • href: atom
      • origin: atom
      • pathname: atom
      • port: atom
      • protocol: atom
      • search: atom
      Methods
      • assign(string)
      • reload
      • replace(string)
    • MouseEvent (Standard, MDN): mouseevent
      Parents
      Properties
      • altKey: boolean
      • button: number
      • buttons: number
      • clientX: number
      • clientY: number
      • ctrlKey: boolean
      • metaKey: boolean
      • movementX: number
      • movementY: number
      • mozInputSource: atom
      • offsetX: number
      • offsetY: number
      • pageX: number
      • pageY: number
      • region: atom
      • relatedTarget: object
      • screenX: number
      • screenY: number
      • shiftKey: boolean
      Methods
      • getModifierState(string, boolean) [last arg is result]
    • Navigator (Standard, MDN): navigator
      Parents
      (no properties) (no methods)
    • NavigatorContentUtils (Standard, MDN): navigatorcontentutils
      Children
      (no properties)
      Methods
      • registerProtocolHandler(string, string, string)
      • unregisterProtocolHandler(string, string)
    • NavigatorCookies (Standard, MDN): navigatorcookies
      Children
      Properties
      • cookieEnabled: boolean
      (no methods)
    • NavigatorID (Standard, MDN): navigatorid
      Children
      Properties
      • userAgent: atom
      (no methods)
    • NavigatorLanguage (Standard, MDN): navigatorlanguage
      Children
      Properties
      • language: atom
      • languages: atom
      (no methods)
    • NavigatorOnLine (Standard, MDN): navigatoronline
      Children
      Properties
      • onLine: boolean
      (no methods)
    • Node (Standard, MDN): node
      Parents
      Children
      Properties
      • childNode: object
      • firstChild: object
      • lastChild: object
      • nextSibling: object
      • nodeName: atom
      • nodeType: number
      • nodeValue: string
      • ownerDocument: object
      • parentElement: object
      • parentNode: object
      • previousSibling: object
      • textContent: string
      Methods
      • cloneNode(boolean, object) [last arg is result]
      • compareDocumentPosition(object, number) [last arg is result]
      • contains(object, boolean) [last arg is result]
      • isEqualNode(object, boolean) [last arg is result]
      • normalize
      • removeChild(object)
    • ParentNode (Standard, MDN): parentnode
      Children
      Properties
      • child: object
      • childElementCount: number
      • firstElementChild: object
      • lastElementChild: object
      Methods
      • append(array:object,string)
      • prepend(array:object,string)
      • querySelector(string, object) [last arg is result]
      • querySelectorAll(string, object) [last arg is result]
    • Path2D (Standard, MDN): path2d
      (no properties)
      Methods
      • arc(number, number, number, number, number, boolean)
      • ellipse(number, number, number, number, number, number, number, boolean)
    • Storage (Standard, MDN): storage
      Properties
      • length: number
      Methods
      • clear
      • getItem(string, atom) [last arg is result]
      • key(number, atom) [last arg is result]
      • removeItem(string)
      • setItem(string, string)
    • TextMetrics (Standard, MDN): textmetrics
      Properties
      • actualBoundingBoxLeft: number
      • actualBoundingBoxRight: number
      • width: number
      (no methods)
    • UIEvent (Standard, MDN): uievent
      Parents
      Children
      (no properties) (no methods)
    • Uint8ClampedArray (Standard, MDN): uint8clampedarray
      Properties
      • length: integer
      Methods
      • set(array:integer, integer)
    • ValidityState (Standard, MDN): validitystate
      Properties
      • badInput: boolean
      • customError: boolean
      • patternMismatch: boolean
      • rangeOverflow: boolean
      • rangeUnderflow: boolean
      • stepMismatch: boolean
      • tooLong: boolean
      • tooShort: boolean
      • typeMismatch: boolean
      • valid: boolean
      • valueMissing: boolean
      (no methods)
    • Window (Standard, MDN): window
      Parents
      Properties
      • applicationCache: object
      • closed: boolean
      • customElements: object
      • document: object
      • frameElement: object
      • history: object
      • length: number
      • location: object
      • locationbar: object
      • menubar: object
      • name: atom
      • navigator: object
      • personalbar: object
      • scrollbars: object
      • status: atom
      • statusbar: object
      • toolbar: object
      Methods
      • alert(string)
      • blur
      • close
      • confirm(string, boolean) [last arg is result]
      • focus
      • open(string, string, string, object) [last arg is result]
      • postMessage(string, object)
      • postMessageOrigin(string, string, array:object) Implemented by postMessage.
      • print
      • prompt(string, string) [last arg is result]
      • stop
    • WindowLocalStorage (Standard, MDN): windowlocalstorage
      Children
      Properties
      • localStorage: object
      (no methods)
    • windowOrWorkerGlobalScope (Standard, MDN): windoworworkerglobalscope
      Children
      Properties
      • caches: object
      • crossOriginIsolated: boolean
      • indexedDB: object
      • isSecureContext: boolean
      • origin: atom
      Methods
      • atob(string, string) [last arg is result]
      • btoa(string, string) [last arg is result]
      • clearInterval(number)
      • fetch([string,object], object, object) [last arg is result]
      • queueMicrotask(goal_function)
      • setInterval(goal_function, number, number) [last arg is result]
      • setTimeout(goal_function, number, number) [last arg is result]
    • WindowSessionStorage (Standard, MDN): windowsessionstorage
      Children
      Properties
      • sessionStorage: object
      (no methods)

    Object Language

    The ProscriptLS object language provides a concise way to access object properties, methods and Element object attributes. There are operators for accessing these things individually and for accessing sequences of these things. Some attributes, properties, and methods return an object value. Object expressions may be put together in a sequence where an object expression result is the object to which the expression to its right is applied: Example: dom_window(W), W >+> localStorage :> S >*> getItem(foo) :> Item. In this example the localStorage object is unified with 'S' and getItem(foo) is evaluated against 'S' and the 'foo' item is unified with 'Item'.
    • >->/2 applies an attribute operation to an object:
      • Obj >-> A :> V gets value V for attribute A of object Obj.
      • Obj >-> A <: V sets value V for attribute A of object Obj.
      • Obj >-> [X1, ..., Xn] applies Xi attribute operation in order to Obj. Each Xi is either (A :> V) or (A <: V). E.g. Obj >-> [a :> AV, b <: 1, c:> CV].
    • >+>/2 applies a property operation to an object:
      • Obj >+> P :> V gets value V for property P of object Obj.
      • Obj >+> P <: V sets value V for property P of object Obj.
      • Obj >+> [X1, ..., Xn] applies Xi property operation in order to Obj. Each Xi is either (P :> V) or (P <: V). E.g. Obj >+> [a :> AV, b <: 1, c:> CV].
    • >*>/2 applies a method operation to an object:
      • Obj >*> M :> V gets value V for method M of object Obj.
      • Obj >*> M evaluates method M of object Obj. There is no result value.
      • Obj >*> [X1, ..., Xn] applies Xi method operation in order to Obj. Each Xi is either (M :> V) or (M). E.g. Obj >*> [a :> AV, b(1, 2) :> BV, c].
      • A method may be a single atom such as 'beginPath' or a structure such as 'moveTo(200, 20)'.
    • >@>/2 applies a Prolog goal to an object where the last argument to the goal is the object:
      • Obj >@> G invokes call(G, Obj)
      • Obj >@> [X1, ..., Xn] applies Xi goal in order to Obj. E.g. Obj >@> [a, b(1, 2)].
      A goal may be a single atom such as 'foo' or a structure such as 'bar(200, 20)'. These are evaluated using call/2: call(foo, Obj) or call(bar(200, 20), Obj). These calls are the same as evaluating foo(Obj) or bar(200, 20, Obj).
    • >>/2 applies any combination of attribute get/set, property get/set, and method operations.
      • Obj >> * M applies method(s) M to Obj.
      • Obj >> - AV applies attribute operation(s) AV to Obj. AV is either (A :> V) or (A <: V).
      • Obj >> + PV applies property operation(s) PV to Obj. PV is either (P :> V) or (P <: V).
      • Obj >> @ G applies goal(s) G to Obj.
      • Obj >> A -:> V applies attribute operation (A :> V) to Obj.
      • Obj >> A <:- V applies attribute operation (A <: V) to Obj.
      • Obj >> P +:> V applies property operation (P :> V) to Obj.
      • Obj >> P <:+ V applies property operation (P <: V) to Obj.
      • Obj >> M *:> V applies method operation (M :> V) to Obj.
      • Obj >> M (where M is none of the above, is not = (_ :> _), and is not a list) applies method Operation M to Obj.
      • Obj >> [X1, X2,...] applies X1 to Obj, then X2 to Obj, and so on. If the X1 operation is an attribute value specification that identifies an object (such as (id -:> canvas)), then Obj may be unbound initially. It will be bound by X1, and the bound Obj will be used for subsequent applications of Xi. The Xi may be any of the above forms: * M, - AV, + PV, @ G, A -:> V, A <:- V, P +:> V, P <:+ V, and M *:> V. Xi may also be a list.
    An example:
    
    on_click :-
        _ >> [id -:> select, selectedIndex +:> Index, item(Index) *:> Option],
        Option >+> value :> Name,
        show_likes(Name). 
    The use of '>>' finds an object with id = 'select', then gets the selectedIndex property of this object as Index, and finally gets the item at Index of this object as Option.
  • Library:

    there is a collection of ProscriptLS source files that provide a library of programs. These are in PROSCRIPTLS_git/library. Some of these files are from the Edinburgh DEC-10 Prolog as found at http://www.j-paine.org/prolog/library.html
    • between.pl: From Edinburgh DEC-10 library.
      • between(+L, +U, ?N): True for all integers N between L (lower) and U (upper). If N is unbound on evaluation then it is generated in order from L to U (repeating on failure).
      • gen_arg(?N, +Term, ?Arg): is exactly like arg(N, Term, Arg), except that it will generate solutions for N by backtracking (will work when N is a variable).
      • gen_nat/1, gen_nat/2, gen_int/1: generate integers. Originally by R O'Keefe.
        • gen_nat(+X): True if X is a natural number, false otherwise
        • gen_nat(-X): Instantiates X to 0, then 1, 2, 3, 4...
        • gen_nat(+L,-N): Instantiates N to L, then L+1, L+2...
        • gen_nat(+L,+N): True if N >= L
        • gen_nat(-L,+N): ** Succeeds with L = N , then LOOPS **
        • gen_int(-X) Instantiates X to 0, then 1, -1, 2, -2, 3, -3...
    • data_predicate.pl: The data predicate system supports storing instances of a type of data where each instance has a collection of attributes. The data is stored as assertions of the form <type>_<attribute>(ID, Value). The data_predicate file contains predicates to manage creating these dynamic predicates from a specification and predicates to add an instance with attribute values to a defined type.
    • dom.pl:
      • set_dom_name_path_value/2: set the value associated with HTML nodes that satisfy the given node name path. A path is a list of names where each name is a list of character codes. The nodes on the path may not be sequential (i.e. have a direct parent-child relationship).
    • listut.pl: From Edinburgh DEC-10 library.
      • correspond/4
      • delete/3
      • last/2
      • nextto/3
      • nmember/3
      • nmembers/3
      • nth0/3
      • nth0/4
      • nth1/3
      • nth1/4
      • numlist/3
      • perm/2
      • perm2/4
      • remove_dups/2
      • rev/2
      • reverse/2
      • same_length/2
      • select/4
      • shorter_list/2
      • subseq/3
      • subseq0/2
      • subseq1/2
      • sumlist/2
    • listut2.pl: Additional list utility predicates created for ProscriptLS.
      • append_lists/2
      • select_list/4
      • contains_list/2
      • split_list/4
      • lowercase/2
      • uppercase/2
    • object.pl: This specifies the 'object' module. It defines a simple syntax for working with the DOM Web API interfaces. The main operator is '>>'. The first argument is an object and the second argument is a list of property get/set operations, methods, or goals to apply to that object. For instance to reference the HTMLCanvasElement with id 'canvas' and get the 2D context for that element:
      
      Canvas >> [id -:> canvas, getContext('2d') *:> Ctx]. 
    • setutl.pl From Edinburgh DEC-10 library.
      • add_element/3
      • del_element/3
      • disjoint/1
      • disjoint/2
      • intersect/2
      • intersect/3
      • listtoset/2
      • memberchk/2
      • nonmember/2
      • pairfrom/4
      • select/3
      • seteq/2
      • subset/2
      • subtract/3
      • symdiff/3
      • union/3
  • Compilation:

    When a web page loads a Prolog program it compiles that program. The program can be compiled into a 'state' file that combines the standard proscriptls_state.js file and the compiled form of the program and the web page can load that state file instead of the standard proscriptls_state.js or the program source.
    This compilation can substantially improve performance of a web page that uses a long Prolog script.
    Compiling a program MYPROGRAM is done by node node_compile.js MYPROGRAM.pl MYSTATE.js where node_compile.js is in /node_tools and proscriptls_for_compile.js is in /dist. MYSTATE.js is the output from the compilation. It is used in conjunction with /dist/proscriptls_engine.js.

    An example of the use of compilation is /examples/tiles.pl and /examples/tiles.html. tiles.pl is compiled by the proscriptls_state_tiles.js target of /examples/Makefile:
    
    cd proscriptls/examples;
    node ../node_tools/node_compile.js `pwd`/tiles.pl `pwd`/proscriptls_state_tiles.js
    
    The state Javascript file created by compilation (e.g. proscriptls_state_tiles.js in the above example) can be checked that it loads cleanly by:
    
    cd proscriptls/examples;
    node ../node_tools/node_compile.js `pwd`/tiles.pl `pwd`/proscriptls_state_tiles.js
    node ../node_tools/node_goal.js `pwd`/proscriptls_state_tiles.js true
    
    The node_goal command loads proscriptls_state_tiles.js, initializes the environment by running proscriptls_init(), and evaluats the trivial query 'true'. proscriptls_init() also runs danglingPredicates() to identify any defined predicates that are called but not defined.
    The tiles.html web page uses the result of the compilation by loading the engine and state Javascript files:
    
    <script type="text/javascript" src="../dist/proscriptls_engine.js"><</script>
    <script type="text/javascript" src="proscriptls_state_tiles.js"><</script>
    
  • Syntax:

    The syntax of a ProscriptLS source file is approximately the same as ISO Prolog.

    Coding Style

    ProscriptLS reports on two coding style issues: singleton variables and predicate references.
    Singleton
    A variable that is only mentioned once in a Prolog clause is a singleton. If it is an anonymous variable, '_', or an anonymized variable, '_X' where X is an proper variable name starting with an uppercase letter, then this is not reported.
    Undefined and Unused Predicates
    A predicate that is used as a goal but is not defined is reported as an undefined predicate. A predicate that has at least one clause defined but is not used as a goal, is not used in a retract/1 goal, and is not specified as an export of its containing module is reported as an unused predicate.

    Modules

    Modules in ProscriptLS are a subset of the SWI-Prolog module feature. Programs may be written without any reference to modules, in which case all of the predicates are in the default 'user' module. All of the builtin predicates are available to the 'user' module.

    The module mechanism provides a convenient way to manage a complex program by dividing the source into components ('modules') where each component has a defined interface (the 'exported' predicates) and an explicit dependency on other components (by the 'use_module' relationship). Only the predicates that a module/source file X exports are 'visible' to another module Y that imports/uses X - i.e. Y can reference predicates of X without qualifying the reference. (The ProscriptLS module mechanism provides an explicit qualification mechanism that allows any module to reference any predicate of another module - this should be used sparingly as it undermines the value of the the component interface definition provided by the 'export' mechanism.)

    Metaprogramming in ProscriptLS requires an additional mechanism for modules, the meta_predicate directive. A meta-predicate is a predicate that uses a parameter as a predicate (e.g. setof/3, call/N). The complication this introduces is that the module qualification for the argument of that parameter is usually different from the module in which the predicate is defined. The meta_predicate directive alerts the compiler to this allowing the compiler to provide the appropriate module qualification for that argument.

    Modules are defined by directives: module/2, use_module/1, and meta_predicate/1. The default module is 'user'. If a file defines a module then its first source line must be a module directive:
    
    :- module(foo, [bar/1]).
    
    This directive defines a module named 'foo' and a single exported predicate 'bar/1'. The module name must be the same as the file name (minus the '.pl' suffix). For the example above, the file pathname could be '/a/file/path/foo.pl'.
    By default all modules import the 'system' module. This module defines and exports all of the builtin predicates of ProscriptLS. A module may import predicates from other modules. This is specified by the use_module/1 directive.
    
    :- use_module('/some/path/baz.pl').
    
    The above example directive imports the 'baz' module. The argument to use_module specifies the pathname of the file defining the module.
    The meta_predicate directive must be the next source line after the module directive, followed by the use_module directives.

    The meta-predicates defined in a module are all declared in a single use of the meta_predicate directive.
    
    :- meta_predicate((p(?,0), q(:,?,?), r(?,^,?))).
    
    The above directive defines three meta-predicates: p/2, q/3, and r/3. The arguments specify the types of the respective parameters:
    • ? - regular Prolog term,
    • 0..9 - callable predicate term that will be provided with N additional arguments,
    • ^ - callable term with variable annotation (such as is used for setof/3: 'X ^ foo(X, Y)'), and
    • : - term that must be decorated with the calling module name (e.g. foo becomes 'mod_a : foo' when the calling module is 'mod_a').
    Assume these meta-predicates are defined in module 'foo'and that 'foo' exports [p/2, q/3, r/3]:
    
    :- module(foo, [p/2, q/3, r/3]).
    :- meta_predicate((p(?,0), q(:,?,?), r(?,^,?)).
    
    p(X, Y) :- call(Y).
    
    q(Module : X, Y, Z) :- G =.. [X, Y, Z], call(Module : G).
    
    r(X, Y, Z) :- setof(X, Y, Z).
    
    Module bar can use module foo. A program in 'bar' can call p/2, q/3, or r/3 and pass in a reference to a predicate local to 'bar'. This reference will be given the 'bar' module qualification due to the meta-predicate declaration.
    
    :- module(bar, [s/1]).
    :- use_module(foo).
    
    s(G) :- p(B, t(B)), q(B, 4, 5), r(E, F ^ u(E, F), G).
    
    t(v).
    
    u(2, a).
    u(3, b).
    
    v(4, 5).
    
    Querying s(X):
    
    ?- s(X).
    X = [2,3]
    

    Directives:

    The directives supported by ProscriptLS include:
    • :- if(Goal).
      :- else.
      :- elif(Goal).
      :- endif.
      These directives are used to optionally include or suppress compilation of clauses. If 'Goal' of :- if(Goal). evaluates to true then the clauses following the 'if' directive up to the next 'else', 'elif', or 'endif' directive are compiled and the other clauses up to the next 'endif' are suppressed. If 'Goal' of :- if(Goal). evaluates to false then the clauses up to the next 'else', 'elif', or 'endif' directive are suppressed. If the next macro directive is 'else' then the clauses following it (up to :- endif.) are compiled (and there must not be an 'elif' directive). An 'elif(GoalEI)' directive must follow an 'if(Goal)' or 'elif(GoalEI1)' directive. If previous macro directive goals have failed and GoalEI succeeds then the clauses following this directive up to the next elif, else, or endif directive are compiled with subsequent clauses being suppressed up to the next endif directive.
      Uses of the if/elif/else/endif directives may be nested.
      Example:
      
      some_predicate(before).
      :- if(false).
      some_predicate(if).
      :- elif(true).
      some_predicate(elif).
      :- else.
      some_predicate(else).
      :- endif.
      some_predicate(after).
      
      This program source fragment has the same effect as:
      
      some_predicate(before).
      some_predicate(elif).
      some_predicate(after).
      
    • :- ensure_loaded(Spec).
      The ensure_loaded/1 directive ensures that the ProscriptLS source identified by Spec is loaded/compiled once. If it has already been compiled when this directive is evaluated then it is not compiled again.
    • :- op(Precedence, Associativity, Atom).
      The op/3 directive defines an operator Atom with Precedence (between 0 and 1200) and Associativity determining whether the operator appears in prefix, infix, or suffix position and how multiple uses of the operator in a sequence associate. There are many operators predefined for ProscriptLS, e.g. infix + and prefix -.
      Example: :- op(200, fx, *).
    • :- dynamic(PredicateIndicator).
      The dynamic/1 directive identifies PredicateIndicator predicate as dynamic: it can be the subject of assert and retract goals. The PredicateIndicator is of the form 'Name/Arity'.
      :- dynamic(Module : (PredicateIndicator)).
      This form defines PredicateIndicator in a specific module different than the source file module using the ':' operator:
      :- dynamic((PI1, PI2, ...)).
      This form defines a sequence of predicate indicators, PI1, PI2, etc., in the current module. Because dynamic is defined as a prefix operator this can also be written: :- dynamic (PI1, PI2, ...). (Notice the space between 'dynamic' and '('.)
      :- dynamic([PI1, PI2, ...]).
      This form defines a list of predicate indicators, PI1, PI2, etc., in the current module.
      :- dynamic(Module: [PI1, PI2, ...]).
      This form defines a list of predicate indicators, PI1, PI2, etc., in Module.
      Example: :- dynamic(special_things/3).
      This defines a dynamic 'special_things' predicate with three arguments. This can also be written as
      :- dynamic special_things/3.
    • :- initialization(Goal).
      The initialization/1 directive specifies a 'Goal' that is to be evaluated after the compiled program is loaded. There may be several initialization directives in a single source - they are evaluated in the order defined.
      Example: :- initialization(writeln('Loaded.')).
      This defines writeln('Loaded.') as a goal to evaluate after the compiled program has been loaded. Once the program is loaded then 'Loaded.' followed by a newline will be written to user-output.
    • :- module(A, B).
      Define module named A with exports as specified by the list B. The module name must be the same as the file name (minus the .pl suffix).
    • :- use_module(A).
      Use the module A in the current module. This imports all of the exported predicates of A so that they can be referenced without qualification.
    • :- meta_predicate(A).
      Define specified predicates with one or more arguments as meta arguments. 'A' is either a single structure term (e.g. 'foo(?, 0, ?)'') or a comma-list (e.g. '((foo(?, 0, ?), bar(: , ?, ^))'). The arguments indicate the meta-predicate type of that argument: ? - regular Prolog term, 0..9 - callable predicate that will be provided with N additional arguments, ^ - callable term with variable annotation (such as is used for setof/3: 'X ^ foo(X, Y)'), and : - term that must be decorated with the calling module name (e.g. foo becomes 'mod_a : foo' when the calling module is 'mod_a'.
    • :- include(A).
      This directive has no effect. It is allowed in ProscriptLS source but are otherwise ignored.
  • Predicates:

    There are many builin-in predicates defined for ProscriptLS. These include standard ISO Prolog predicates and predicates unique to ProscriptLS. The unique predicates include several predicates for working with HTML documents and Javascript.

    arithmetic

    • (<)/2

      <(+Left:term,+Right:term) is det

      The value of the arithmetic expression Left is less than the value of the arithmetic expression Right.

      arg: Left. an arithmetic expression term.
      arg: Right. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.
    • (=:=)/2

      =:=(+Left:term,+Right:term) is det

      The value of the arithmetic expression Left is equal to the value of the arithmetic expression Right.

      arg: Left. an arithmetic expression term.
      arg: Right. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.
    • (=<)/2

      =<(+Left:term,+Right:term) is det

      The value of the arithmetic expression Left is equal to or less than the value of the arithmetic expression Right.

      arg: Left. an arithmetic expression term.
      arg: Right. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.
    • (=\=)/2

      =\=(+Left:term,+Right:term) is det

      The value of the arithmetic expression Left is not equal to the value of the arithmetic expression Right.

      arg: Left. an arithmetic expression term.
      arg: Right. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.
    • (>)/2

      >(+Left:term,+Right:term) is det

      The value of the arithmetic expression Left is greater than the value of the arithmetic expression Right.

      arg: Left. an arithmetic expression term.
      arg: Right. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.
    • (>=)/2

      >=(+Left:term,+Right:term) is det

      The value of the arithmetic expression Left is greater than or equal to the value of the arithmetic expression Right.

      arg: Left. an arithmetic expression term.
      arg: Right. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.
    • (is)/2

      is(?Result:number,+Expression:term) is det

      Result is the value of evaluating the arithmetic Expression.

      arg: Result. a number.
      arg: Expression. an arithmetic expression term.
      compat: iso.
      cat: arithmetic.

    atomic_term_processing

    • atom_chars/2

      atom_chars(?Atom:atom,?Chars:list(atom)) is det

      The name of Atom is the list of character atoms in Chars.

      arg: Atom. an atom.
      arg: Chars. a list of atoms.
      compat: iso.
      cat: atomic_term_processing.
    • atom_codes/2

      atom_codes(?Atom:atom,?Codes:list(integer)) is det

      The name of Atom is the list of character integers in Codes.

      arg: Atom. an atom.
      arg: Codes. a list of integers.
      compat: iso.
      cat: atomic_term_processing.
    • atom_concat/3

      atom_concat(+Atom1:atom,+Atom2:atom,?Concatenation:atom) is det

      The names of Atom1 and Atom2 are concatenated to create Concatenation.

      arg: Atom1. an atom.
      arg: Atom2. an atom.
      arg: Concatenation. an atom.
      compat: iso.
      cat: atomic_term_processing.
    • atom_length/2

      atom_length(+Atom:atom,?Length:integer) is det

      Length is the number of characters in the name of Atom.

      arg: Atom. an atom.
      arg: Length. an integer.
      compat: iso.
      cat: atomic_term_processing.
    • char_code/2

      char_code(?Atom:atom,?Code:integer) is det

      The name of Atom is a single character with integer character Code.

      arg: Atom. an atom.
      arg: Code. an integer.
      compat: iso.
      cat: atomic_term_processing.
    • gensym/2

      gensym(+Root:atom,?NewAtom:atom)

      NewAtom is the concatenation of Root and increment of per-Root counter, starting at 0. Each use of gensym/2 with the same Root increments this counter.

      arg: Root. an atom.
      arg: NewAtom. an atom.
      compat: proscriptls.
      cat: atomic_term_processing.
    • number_chars/2

      number_chars(?Number:number,?Chars:list(atom)) is det

      The name of Number is the list of character atoms in Chars.

      arg: Number. a number.
      arg: Chars. a list of atoms.
      compat: iso.
      cat: atomic_term_processing.
    • number_codes/2

      number_codes(?Number:number,?Codes:list(integer)) is det

      The name of Number is the list of character integers in Codes.

      arg: Number. a number.
      arg: Codes. a list of integers.
      compat: iso.
      cat: atomic_term_processing.
    • sub_atom/5

      sub_atom(+Source:atom,+Start:integer,-Length:integer,+Remaining:integer,?Subatom:atom) is det
      sub_atom(+Source:atom,-Start:integer,+Length:integer,+Remaining:integer,?Subatom:atom) is det
      sub_atom(+Source:atom,+Start:integer,+Length:integer,?Remaining:integer,?Subatom:atom) is det
      sub_atom(+Source:atom,+Start:integer,-Length:integer,-Remaining:integer,-Subatom:atom) is nondet
      sub_atom(+Source:atom,-Start:integer,+Length:integer,-Remaining:integer,?Subatom:atom) is nondet
      sub_atom(+Source:atom,-Start:integer,-Length:integer,+Remaining:integer,?Subatom:atom) is nondet

      The name of Subatom is a part of the name of Source that begins at position Start and has Length characters and there are Remaining characters in Source after Subatom.

      arg: Source. an atom.
      arg: Start. an integer.
      arg: Length. an integer.
      arg: Remaining. an integer.
      arg: Subatom. an atom.
      compat: proscriptls.
      cat: atomic_term_processing.

    byte_io

    • get_byte/2

      get_byte(+Stream:term,?Byte:integer)

      Get next byte from Stream as Byte.

      arg: Stream. a stream term.
      arg: Byte. an integer.
      compat: iso.
      cat: byte_io.
    • peek_byte/2

      peek_byte(+Stream:term,?Byte:atom)

      Peek at next byte in Stream as Byte. Do not advance stream position.

      arg: Stream. a stream term.
      arg: Byte. an integer.
      compat: iso.
      cat: byte_io.
    • put_byte/2

      put_byte(+Stream:term,?Byte:integer)

      Put Byte in Stream.

      arg: Stream. a stream term.
      arg: Byte. an integer.
      compat: iso.
      cat: byte_io.

    character_io

    • get_char/1

      get_char(?Char:atom)

      Get next character from current input stream as Char.

      arg: Char. an atom.
      compat: iso.
      cat: character_io.
    • get_char/2

      get_char(+Stream:term,?Char:atom)

      Get next character from Stream as Char.

      arg: Stream. a stream term.
      arg: Char. an atom.
      compat: iso.
      cat: character_io.
    • get_code/1

      get_code(?Code:integer)

      Get next character code from current input stream as Code.

      arg: Code. an integer.
      compat: iso.
      cat: character_io.
    • get_code/2

      get_code(+Stream:term,?Code:integer)

      Get next character code from Stream as Code.

      arg: Stream. a stream term.
      arg: Code. an integer.
      compat: iso.
      cat: character_io.
    • peek_char/1

      peek_char(?Char:atom)

      Peek at next character in current inpu stream as Char. Do not advance stream position.

      arg: Char. an atom.
      compat: iso.
      cat: character_io.
    • peek_char/2

      peek_char(+Stream:term,?Char:atom)

      Peek at next character in Stream as Char. Do not advance stream position.

      arg: Stream. a stream term.
      arg: Char. an atom.
      compat: iso.
      cat: character_io.
    • peek_code/1

      peek_code(?Code:atom)

      Peek at next character code in current input stream as Code. Do not advance stream position.

      arg: Char. an integer.
      compat: iso.
      cat: character_io.
    • peek_code/2

      peek_code(+Stream:term,?Code:atom)

      Peek at next character code in Stream as Code. Do not advance stream position.

      arg: Stream. a stream term.
      arg: Char. an integer.
      compat: iso.
      cat: character_io.
    • put_char/1

      put_char(?Char:atom)

      Put Char in current output stream.

      arg: Char. an atom.
      compat: iso.
      cat: character_io.
    • put_char/2

      put_char(+Stream:term,?Char:atom)

      Put Char in Stream.

      arg: Stream. a stream term.
      arg: Char. an atom.
      compat: iso.
      cat: character_io.
    • put_code/1

      put_code(?Code:integer)

      Put character Code in current output stream.

      arg: Code. an integer.
      compat: iso.
      cat: character_io.
    • put_code/2

      put_code(+Stream:term,?Code:integer)

      Put character Code in Stream.

      arg: Stream. a stream term.
      arg: Code. an integer.
      compat: iso.
      cat: character_io.

    clause_creation_and_destruction

    • abolish/1

      abolish(+Indicator:term) is det

      Removes the (dynamic) user defined procedure identified by its predicate indicator, leaving the database in the same state as if this procedure had never existed. (as defined in the ISO standard)

      arg: Indicator. predicate indicator term.
      compat: iso.
      cat: clause_creation_and_destruction.
    • retract/1

      retract(+Clause:term) is nondet

      Retract from the database the clauses which are unifiable with Clause.

      arg: Clause. a clause term.
      compat: iso.
      cat: clause_creation_and_destruction.
    • retract_clause/2

      retract(+Head:term,?Body:term) is nondet

      Retract from the database the clauses which are unifiable with Head and Body.

      arg: Head. a callable term.
      arg: Body. a term.
      compat: iso.
      cat: clause_creation_and_destruction.

    clause_retrieval_and_information

    • clause/2

      clause(+Head:term,?Body:term)

      A public user-defined procedure in the database has Head and Body.

      arg: Head. a callable term.
      arg: Body. a callable term.
      compat: iso.
      cat: clause_retrieval_and_information.

    dom

    • alert/1

      alert(+Term:term)

      Display Term in a browser alert dialog.

      arg: Term. any term.
      cat: dom.
    • append_dom_node_child/2

      append_dom_node_child(+Element:object_id,+Child:object_id)

      Append a DOM node as a child node.

      arg: Element. an object ID structure for an HTML node object.
      arg: Child. an object ID structure for an HTML node object.
      cat: dom.
    • create_dom_element/2

      create_dom_element(+Tag:atom,-Element:object_id)

      Create a DOM element object with tag Tag.

      arg: Tag. an HTML tag name (any case).
      arg: Element. an object ID structure for an HTML element object..
      cat: dom.
    • create_dom_text_node/2

      create_dom_text_node(+Text:character_code_list,-Element:object_id)

      Create a DOM text node object.

      arg: Text. a string (represented as a character code list).
      arg: Element. an object ID structure for an HTML text node object.
      cat: dom.
    • dom_create_object/2

      dom_create_object(+Type:atom,-Object:object_id)

      Same as dom_create_object/3 with Spec = [].

      arg: Type. an atom that specifies the kind of object to create.
      arg: Object. an object ID structure for a Web API (or other Javascript) object.
      cat: dom.
    • dom_create_object/3

      dom_create_object(+Type:atom,-Object:object_id,+Spec:list)

      Create a Javascript object specified by the Type. The Type term is the constructor name and arguments (if any). The type argument may be of the form ModuleName : Type. An argument may be a goal_function type, in which case the ModuleName (inferred or explicit) is needed to determine what module holds the predicate(s) of the goal_functor. Argument types include: object, string, string_codes, integer, number, boolean, position, goal_function, event, and options. Also a type may specify a list or array of items of the same type as 'array_type(Type)', e.g. 'array_type(integer)' for an array/list of integers.

      arg: Type. an atom or structure that specifies the kind of object to create.
      arg: Object. an object ID structure for a Web API (or other Javascript) object.
      arg: Spec. a list specifying the types of the arguments of the Type structure (if any)..
      cat: dom.
    • dom_element_attribute_value/3

      dom_element_attribute_value(+Element:object_id,+Attribute:atom,+Value:atom) is det
      dom_element_attribute_value(+Element:object_id,+Attribute:atom,-Value:atom) is nondet
      dom_element_attribute_value(+Element:object_id,-Attribute:atom,+Value:atom) is nondet
      dom_element_attribute_value(-Element:object_id,+Attribute:atom,+Value:atom) is nondet
      dom_element_attribute_value(+Element:object_id,-Attribute:atom,-Value:atom) is nondet
      dom_element_attribute_value(-Element:object_id,+Attribute:atom,-Value:atom) is nondet
      dom_element_attribute_value(-Element:object_id,-Attribute:atom,+Value:atom) is nondet
      dom_element_attribute_value(-Element:object_id,-Attribute:atom,-Value:atom) is nondet

      There may be any combination of bindings of Element, Attribute, Value, including none bound. If Element is unbound and Attribute and Value are bound then dom_element_attribute_value/3 has two strategies for finding Element: if Attribute and Value are bound and Attribute is 'id', 'name', or 'class' then use specific Javascript document getElementById(Value), getElementsByName(Value), or getElementsByClass(Value) method where Attribute is 'id', 'name', or 'class', respectively; otherwise, get all elements using document.querySelectorAll('*') and check each one using element.getAttribute(Attribute)=Value. If Attribute is unbound then dom_element_attribute_value/3 checks each possible Element using Javascript element.getAttributeNames() to generate all values for Attribute for each Element. For each Attribute and Element value the value is checked/retrieved. As above, 'id', 'name', and 'class' attributes are handled specially; all other attributes are handled using element.getAttribute(Attribute)=Value.

      arg: Element. DOM Element object identifier.
      arg: Attribute. an atom naming an attribute.
      arg: Value. an atom specifying the value to be assigned to the attribute.
      cat: dom.
    • dom_object_method/2

      dom_object_method(+Object:object_id,:MethodStructure:callable_term)

      This predicate is the same as dom_object_method/3 with a SpecTerm = [].

      cat: dom.
    • dom_object_method/3

      dom_object_method(+Object:object_id,:MethodStructure:callable_term,+SpecTerm:list)

      Evaluate a Javascript method applied to a Javascript Web API object. The result of the method (if any) is unified with the last argument of the Method structure. The Method argument may be qualified with a module name or an argument of the Method structure may be qualified. For example: dom_object_method(Element, add_event_listener(click, 'foo:bar'(thing))) or dom_object_method(Element, foo : add_event_listener(click, bar(thing))). In the second case, the 'foo' module name is used in conjunction with the meta-argument type definition for 'add_event_listener' second argument (of '0') to determine that 'bar(thing)' should be qualified as 'foo:bar'(thing). If the foo module had imported bar/1 from the quux module, then this qualification would be 'quux:bar'(thing). The SpecTerm is used to define the method call when it is not already defined. The SpecTerm has the form [MethodName, ArgTypes, ReturnType] or [MethodName, ArgTypes] if no return.

      arg: Object. an object ID structure for a Web API (or other Javascript) object.
      arg: MethodStructure. a term of the form 'methodName(arg1, arg2, ..)'.
      arg: SpecTerm. either [] or the form [MethodName, ArgTypes, ReturnType] or [MethodName, ArgTypes] if no return.
      cat: dom.
    • dom_object_property/4

      dom_object_property(+Type:atom,+Object:object_id,+Property:atom,-Value:term) is nondet
      dom_object_property(+Type:atom,-Object:object_id,+Property:atom,+Value:term) is nondet
      dom_object_property(-Type:atom,+Object:object_id,+Property:atom,+Value:term) is det
      dom_object_property(+Type:atom,+Object:object_id,+Property:atom,+Value:term) is det

      Determine each Value of Property of Object of Type. Property must be a ground value. At least two of Type, Object, and Value must be ground.

      arg: Type. an atom specifying the object type.
      arg: Object. an object ID structure for a Web API (or other Javascript) object.
      arg: Property. an atom naming a defined property for the related object.
      arg: Value. a term specifying the value of the named property of the related object.
      cat: dom.
    • dom_object_type/2

      dom_object_type(+Object:object_id,?Type:atom)

      Relate a Javascript object to its ProscriptLS type. A Web API object that is an instance of HTMLElement has the type 'htmlelement'.

      arg: Object. an object ID structure for a Web API (or other Javascript) object.
      arg: Type. an atom naming the type of the associated object.
      cat: dom.
    • dom_release_object/1

      dom_release_object(+Object:object_id)

      Release internal registration of Javascript structure for Object

      arg: Object. an object ID structure for a Web API (or other Javascript) object.
      cat: dom.
    • dom_select_all_elements/2

      dom_select_all_elements(Query,Element) is nondet

      Select each HTML Element that satisfies the specified Query.

      arg: Query. a string (represented as a character code list).
      arg: Element. an object ID structure for an HTML element object.
      cat: dom.
    • dom_select_element/2

      dom_select_element(+Query:character_code_list,?Element:object_id)

      Select an HTML Element that satisfies the specified Query.

      arg: Query. a string (represented as a character code list).
      arg: Element. an object ID structure for an HTML element object.
      cat: dom.
    • dom_type_method/5

      dom_type_method(?ObjectType:atom,?MethodName:atom,?ImplementationName:atom,?ArgumentTypes:list,?ResultType:atom)

      Find the related values for a WebInterface API object type, a method name implemented for that type, the Javascript Web API function name used to implement that method, the types of arguments for that method, and the result type (possibly undefined).

      arg: ObjectType. an atom naming a Web API interface.
      arg: MethodName. an atom naming a method of a Web API interface.
      arg: ImplementationName. an atom naming Javascript function that implements a method of a Web API interface.
      arg: ArgumentTypes. a list of data type specifications for the inputs of an API method..
      arg: ResultType. an atom specifying the result data type (if any) of an API method.
      cat: dom.
    • dom_type_parent/2

      dom_type_parent(?ObjectType:atom,?ParentType:atom)

      Web API interface ObjectType has parent interface ParentType.

      arg: ObjectType. an atom naming a Web API interface.
      arg: ParentType. an atom naming a Web API interface.
      cat: dom.
    • dom_type_property/4

      dom_type_property(?ObjectType:atom,?PropertyName:atom,?JsName:atom,?ValueType:atom)

      Find the related values for a WebInterface API ObjectType, a PropertyName implemented for that type, the Javascript Web API function JsName used to implement that property, and the ValueType for that property.

      arg: ObjectType. an atom naming a Web API interface.
      arg: PropertyName. an atom naming a property of a Web API interface.
      arg: JsName. an atom naming the Javascript function that implements getting the value of a property of a Web API interface.
      arg: ValueType. an atom specifying the data type returned by a Javascript method.
      cat: dom.
    • dom_type_reference/4

      dom_type_reference(?Type:atom,?Name:atom,?Standard:atom,?Mdn:atom)

      Relates DOM Web API type and name with reference URLs in W3C standards and Mozilla MDN. This predicate is used in generating ProscriptLS documentation.

      arg: Type. an atom that is the ProscriptLS name (all lowercase) of the Web API interface.
      arg: Name. an atom that is the Web API interface name (proper case).
      arg: Standard. an atom that is the URL to a W3C reference for the associated Web API name.
      arg: Mdn. an atom that is the URL to a Mozilla MDN reference for the associated Web API name.
      cat: dom.
    • dom_window/1

      dom_window(?Window:object_id) is det

      Window is the object ID for the Web API interface HTML Window object.

      arg: Window. the object ID for the HTML window object.
      cat: dom.
    • insert_before_dom_node/3

      insert_before_dom_node(+Parent:object_id,+Element:object_id,+Before:object_id)

      Insert child Element before Before element with parent Parent element.

      arg: Parent. an object ID structure for an HTML node object.
      arg: Element. an object ID structure for an HTML node object.
      arg: Before. an object ID structure for an HTML node object.
      cat: dom.
    • remove_dom_element_class/2

      remove_dom_element_class(Element,Class)

      Remove Class from classes defined for Element.

      cat: dom.
    • replace_dom_element_class/2

      replace_dom_element_class(Element,Class)

      Replace Class in classes defined for Element.

      cat: dom.
    • set_dom_element_attribute_value/3

      set_dom_element_attribute_value(+Element:object_id,+Attribute:atom,+Value:atom)

      Set DOM element attribute to value.

      arg: Element. DOM Element object identifier.
      arg: Attribute. an atom naming an attribute.
      arg: Value. an atom specifying the value to be assigned to the attribute.
      cat: dom.
    • set_dom_object_property/3

      set_dom_object_property(Object,Property,Value)

      Set Property of Object to Value. Property must be in a defined Web API interface for ProscriptLS for the interface type for Object or one of its parent types.

      arg: Object. object_id of a Javascript object that is an instance of a Web API interface.
      arg: Property. an atom naming a defined property for the associated object Web API interface.
      arg: Value. a term of a type appropriate to the associated property.
      cat: dom.
    • toggle_dom_element_class/3

      toggle_dom_element_class(Element,Class,Mode)

      Toggle Class in classes defined for Element with Mode of either 'add' or 'remove'.

      cat: dom.

    flag_updates

    • current_prolog_flag/2

      current_prolog_flag(+Flag:term,?Value:term) is det
      current_prolog_flag(-Flag:term,?Value:term) is nondet

      Prolog Flag has Value. The defined flags are: bounded, max_integer, min_integer, integer_rounding_function, char_conversion, debug, max_arity, unknown, double_quotes, and dialect.

      arg: Flag. a defined flag atom.
      arg: Value. a Prolog term.
      compat: iso.
      cat: flag_updates.
    • set_prolog_flag/2

      set_prolog_flag(+Flag:term,?Value:term) is det

      Set Prolog Flag to Value. Only certain flags are settable: char_conversion, debug, unknown, double_quotes, wam_log, and wam_log_size.

      arg: Flag. a defined flag atom.
      arg: Value. a Prolog term.
      compat: iso.
      cat: flag_updates.

    logic_and_control

    • fail/0

      fail is det

      This goal always fails.

      compat: iso.
      cat: logic_and_control.
    • halt/0

      halt is det

      Halt the WAM engine. The engine may be restarted - typically after evaluating the backtrack Javascript function.

      compat: iso.
      cat: logic_and_control.
    • repeat/0

      repeat is nondet

      Always succeeds on initial call and on all redo calls (it backtracks without bound).

      compat: iso.
      cat: logic_and_control.
    • true/0

      true is det

      This goal always succeeds.

      compat: iso.
      cat: logic_and_control.
    • yield/0

      yield is det

      Yield (suspend) the WAM engine to allow any waiting HTML events to be processed. The yield/0 predicate completes after these waiting events have been handled. This can be used to make changes to the current web page and have them rendered immediately instead of when the current top level query completes.

      compat: proscriptls.
      cat: logic_and_control.

    memory_file

    • copy_local_storage_to_memory_file/2

      copy_local_storage_to_memory_file(+Key:atom,+MemoryFile:memory_file_specifier) is det

      Copy from Window.localStorage at the specified key to the memory_file.

      compat: proscriptls.
      cat: memory_file.
    • copy_memory_file_to_local_storage/2

      copy_memory_file_to_local_storage(+MemoryFile:memory_file_specifier,+Key:atom) is det

      Copy from a memory file to Window.localStorage using the specified key.

      compat: proscriptls.
      cat: memory_file.
    • free_memory_file/1

      free_memory_file(+MemoryFile:memory_file_specifier) is det

      Free the internal storage for the memory file.

      compat: proscriptls.
      cat: memory_file.
    • new_memory_file/1

      new_memory_file(-MemoryFile:memory_file_specifier) is det

      Create a memory file. This allocates internal storage that should be freed using free_memory_file/1.

      compat: proscriptls.
      cat: memory_file.
    • open_memory_file/3

      open_memory_file(+MemoryFile:memory_file_specifier,+Mode:stream_mode_atom,-Stream:stream_specifier) is det

      Open a stream to read from , write into, or append to the given memory file.

      compat: proscriptls.
      cat: memory_file.

    runtime

    • statistics/0

      statistics is det

      Display runtime statistics. These include WAM duration, current heap size in words, maximum heap size encountered, and maximum stack size encountered.

      compat: iso.
      cat: runtime.
    • statistics_max_heap/1

      statistics_max_heap(?Value:integer) is det

      Size in words of the maximum storage allocated in the WAM heap since the WAM was initialized

      arg: Value. an integer.
      compat: proscriptls.
      cat: runtime.
    • statistics_max_stack/1

      statistics_max_stack(?Value:integer) is det

      Size in words of the maximum storage allocated in the WAM stack since the WAM was initialized

      arg: Value. an integer.
      compat: proscriptls.
      cat: runtime.
    • wam_duration/1

      wam_duration is det

      Milliseconds spent in the WAM since start of the WAM

      arg: Value. an integer.
      compat: proscriptls.
      cat: runtime.

    stream_selection_and_control

    • at_end_of_stream/1

      at_end_of_stream(+Stream:term)

      Stream position is at its end.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • close/1

      close(+Stream:term)

      Close Stream.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • current_input/1

      set_input(+Stream:term)

      Current input stream is Stream.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • current_output/1

      set_output(+Stream:term)

      Current output stream is Stream.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • flush_output/1

      flush_output(+Stream:term)

      Flush output Stream.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • open/3

      open(+SourceSink:term,+Mode:atom,-Stream:term) is det

      Open a text file source or sink with default options, creating a Stream term by which to access that source or sink.

      arg: SourceSink. a term.
      arg: Mode. a stream mode atom: 'read', 'write', 'append'.
      compat: iso.
      cat: stream_selection_and_control.
    • open/4

      open(+SourceSink:term,+Mode:atom,-Stream:term,+Options:list) is det

      Open a source or sink, creating a Stream term by which to access that source or sink.

      arg: SourceSink. a term.
      arg: Mode. a stream mode atom: 'read', 'write', 'append'.
      arg: Options. a list of stream options.
      compat: iso.
      cat: stream_selection_and_control.
    • set_input/1

      set_input(+Stream:term)

      Sets current input stream to Stream.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • set_output/1

      set_output(+Stream:term)

      Sets current output stream to Stream.

      arg: Stream. a stream term.
      compat: iso.
      cat: stream_selection_and_control.
    • set_stream_position/2

      set_stream_position(+Stream:term,+Position:integer)

      Set Stream position to Position.

      arg: Stream. a stream term.
      arg: Position. an integer.
      compat: iso.
      cat: stream_selection_and_control.
    • stream_property/2

      stream_property(?Stream:term,?Property:term)

      Enumerates all the pairs of open streams together with their properties.

      arg: Stream. a stream term.
      arg: Property. a property term.
      compat: iso.
      cat: stream_selection_and_control.

    term_comparison

    • (==)/2

      ==(?Term1:term,?Term2:term) is det

      Term1 matches Term2. Two terms match if they are equal without binding any variables.

      arg: Term1. any Prolog term.
      arg: Term2. any Prolog term.
      compat: iso.
      cat: term_comparison.
    • (@<)/2

      @<(?Term1:term,?Term2:term) is det

      Term1 is less than Term2. This predicate can be used as an infix operator.

      arg: Term1. a Prolog term.
      arg: Term2. a Prolog term.
      compat: iso.
      cat: term_comparison.
    • (@=<)/2

      @=<(?Term1:term,?Term2:term) is det

      Term1 is less than or equal to Term2. This predicate can be used as an infix operator.

      arg: Term1. a Prolog term.
      arg: Term2. a Prolog term.
      compat: iso.
      cat: term_comparison.
    • (@>)/2

      @>(?Term1:term,?Term2:term) is det

      Term1 is greater than Term2. This predicate can be used as an infix operator.

      arg: Term1. a Prolog term.
      arg: Term2. a Prolog term.
      compat: iso.
      cat: term_comparison.
    • (@>=)/2

      @>=(?Term1:term,?Term2:term) is det

      Term1 is greater than or equal to Term2. This predicate can be used as an infix operator.

      arg: Term1. a Prolog term.
      arg: Term2. a Prolog term.
      compat: iso.
      cat: term_comparison.
    • compare/3

      compare(?Comparison:atom,?Term1:term,?Term2:term) is det

      Comparison is the term-ordering between Term1 and Term2: < if Term1 @< Term2, = if Term1 == Term2, and > if Term1 @> Term2.

      arg: Comparison. <, =, or >.
      arg: Term1. a Prolog term.
      arg: Term2. a Prolog term.
      compat: swi.
      cat: term_comparison.
    • subsumes_term/2

      subsumes_term(?Term1:term,?Term2:term) is det

      Term1 subsumes Term2.

      arg: Term1. any Prolog term.
      arg: Term2. any Prolog term.
      compat: iso.
      cat: term_comparison.

    term_creation_and_decomposition

    • (=..)/2

      =..(?Term:term,?List:list) is det

      Term univ List. List is a list [Functor|Args] where functor(Term, Functor, Arity) and Args are the arguments of Term (if any): forall(between(1, Arity, N), (arg(N, Term, Arg), nth1(N, Args, Arg))). If Args is null then Term is atomic (either an atom or a number) and is equal to Functor.

      arg: Term. any Prolog term.
      arg: List. a list.
      compat: iso.
      cat: term_creation_and_decomposition.
    • arg/3

      arg(+Position:integer,+Term:term,?Arg:term) is det

      Argument at Position of Term is Arg.

      arg: Position. an integer.
      arg: Term. a term.
      arg: Arg. a term.
      compat: iso.
      cat: term_creation_and_decomposition.
    • atom_to_term/3

      atom_to_term(+Atom:atom,?Term:term,?Bindings:list) is det

      Term is the result of reading the name of Atom with the ProscriptLS parser. Bindings is a list of terms of the form 'name = variable' where 'name' is the name of each variable found in Atom and 'variable' is the ProscriptLS variable to which that named variable is converted in Term.

      arg: Atom. an atom.
      arg: Term. a term.
      arg: Bindings. a list of (Name = Variable) terms.
      compat: proscriptls.
      cat: term_creation_and_decomposition.
    • copy_term/2

      copy_term(?Term1:term,?Term2:term) is det

      Term2 is the same as Term1 but with distinct variables such that Term1 and Term2 subsume each other and the variables of Term2 have not appeared in the proof tree before evaluating this predicate.

      arg: Term1. a Prolog term.
      arg: Term2. a Prolog term.
      compat: iso.
      cat: term_creation_and_decomposition.
    • functor/3

      functor(+Term:integer,?Name:term,?Arity:term) is det
      functor(-Term:integer,+Name:term,+Arity:term) is det

      Term has functor Name and Arity arguments.

      arg: Term. any Prolog term.
      arg: Name. an atom.
      arg: Arity. an integer.
      compat: iso.
      cat: term_creation_and_decomposition.
    • term_variables/2

      term_variables(?Term:term,?Variables:list) is det

      Variables are the variables in Term.

      arg: Term. a term.
      arg: Variables. a list of one term (variable) for each variable in Term.
      compat: proscriptls.
      cat: term_creation_and_decomposition.

    term_io

    • char_conversion/2

      char_conversion(+InChar:atom,+OutChar:atom) is det

      Add conversion of InChar to OutChar to the character conversion table. (This should be a directive.)

      arg: InChar. a single-character atom.
      arg: OutChar. a single-character atom.
      compat: iso.
      cat: term_io.
    • current_char_conversion/2

      current_char_conversion(-InChar:atom,-OutChar:atom) is nondet
      current_char_conversion(+InChar:atom,-OutChar:atom) is det
      current_char_conversion(-InChar:atom,+OutChar:atom) is det
      current_char_conversion(+InChar:atom,+OutChar:atom) is det

      Character conversion table specifies that InChar is converted to OutChar when reading streams.

      arg: InChar. a single-character atom.
      arg: OutChar. a single-character atom.
      compat: iso.
      cat: term_io.
    • current_op/3

      current_op(?Priority:integer,?Specifier:atom,?Operator:atom)

      Operator is currently defined with Priority and Specifier for reading and writing terms.

      arg: Priority. an integer.
      arg: Specifier. an atom: fx, fy, xfx, xfy, yfx, yf, xf.
      arg: Operator. an atom.
      compat: iso.
      cat: term_io.
    • op/3

      op(?Priority:integer,?Specifier:atom,?Operator:atom)

      Update the operator table with Operator as defined with Priority and Specifier for reading and writing terms.

      arg: Priority. an integer.
      arg: Specifier. an atom: fx, fy, xfx, xfy, yfx, yf, xf.
      arg: Operator. an atom.
      compat: iso.
      cat: term_io.
    • read_term/2

      read_term(?Term:term,+Options:list)

      Reads from the current input stream a single Term and instantiates accordingly the read Options list. (as described by ISO standard)

      arg: Term. a term.
      arg: Options. a read options list.
      compat: iso.
      cat: term_io.
    • read_term/3

      read_term(+Stream:stream_term,?Term:term,+Options:list)

      Reads from Stream a single Term and instantiates accordingly the read Options list.

      arg: Stream. a stream term.
      arg: Term. a term.
      arg: Options. a read options list.
      compat: iso.
      cat: term_io.
    • write_term/3

      write_term(+Stream:term,+Term:term,+Options:list(write_option_term))

      Write Term to Stream in a form determined by Options.

      arg: Stream. a stream term.
      arg: Term. a term.
      arg: Options. a list of write_term option terms - quoted(true/false), numbervars(true/false), ignore_ops(true/false), max_depth(N).
      compat: iso.
      cat: term_io.
    • writeln/1

      writeln(+Term:term)

      Write Term followed by a newline to the current output stream.

      arg: Term. a term.
      compat: proscriptls.
      cat: term_io.

    term_unification

    • (=)/2

      =(?Term1:term,?Term2:term) is det

      Term1 unifies with Term2.

      arg: Term1. any Prolog term.
      arg: Term2. any Prolog term.
      compat: iso.
      cat: term_unification.
    • (\=)/2

      \=(?Term1:term,?Term2:term) is det

      Term1 does not unify with Term2.

      arg: Term1. any Prolog term.
      arg: Term2. any Prolog term.
      compat: iso.
      cat: term_unification.

    type_testing

    • acyclic_term/1

      acyclic_term(?Term:term) is det

      Term is a acyclic.

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.
    • atom/1

      atom(?Term:term) is det

      Term is an atom.

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.
    • compound/1

      compound(?Term:term) is det

      Term is compound - either a structure or a list.

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.
    • float/1

      float(?Term:term) is det

      Term is a float (i.e. a number represented with a decimal point).

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.
    • ground/1

      ground(?Term:term) is det

      Term is ground - is not a variable nor is it a compound containing a variable.

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.
    • integer/1

      integer(?Term:term) is det

      Term is an integer.

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.
    • var/1

      var(?Term:term) is det

      Term is a variable.

      arg: Term. any Prolog term.
      compat: iso.
      cat: type_testing.

Examples

These examples show uses of the ProscriptLS language. In each case the HTML source consults (compiles) ProscriptLS source and uses the ProscriptlS predicates. The only major uses of Javascript are the JQuery.Terminal library (used to present the ProscriptLS interpreter in some examples) and a custom Prolog interpreter.
  • A simple calculator. This example demonstrates the use of events in ProscriptLS.
    The original implementation of the calculator in regular Javascript is here.

    The ProscriptLS source used in this example is here.

  • Toggle custom ProscriptLS interpreter console. A page that presents a single button which toggles the presence of a ProscriptLS interpreter. The ProscriptLS interpreter console is implemented using a custom 'test.js' file instead of the full JQuery.terminal library.

    The source used in this example is here.

  • Display 'hello world' alert dialog. Clicking on a button causes 'hello world' to be displayed in an alert dialog.

    The source used in this example is here.

  • Querying a 'likes' predicate. Some interactive elements support a user interface for displaying what a person likes from an editable definition of a likes/2 predicate. (This is adapted from the tau-prolog 'likes' example.)

    The source used in this example is here.

  • Custom Prolog interpreter and text area for Prolog source. The Prolog text area is consulted when the 'consult' button is clicked. The predicates defined in the Prolog text area can be queried in the custom interpreter.

    The source used in this example is here.

  • Display a collection of selectable game tiles. Displays a collection of 16 square tiles. 8 of these tiles are selectable.

    The source used in this example is here.