How programming language influence interaction and culture

Download Report

Transcript How programming language influence interaction and culture

Programmering som
skrivepraksis
Ivar Tormod Berg Ørstavik
HiST
Mål for dagen
Dele en annerledes opplevelse av dataprogram.
Dele en glede i å se at "framtidas" skriveteknologi
kanskje ikke er så forskjellig fra "gårsdagens"
likevel.
Vise hva programmeringsfaget kan tilføre
humanistisk forskning på tekst og skriving, og vice
versa.
HiST
Plan for dagen
Analyse av en programtekst i kontekst.
• Hvordan kan programtekster forstås
som komposisjoner som referer til og
er i dialog med andre programtekster?
Kronotop – en meget kort introduksjon
• Hvordan bygger programmeringsspråk
oppunder forskjellige kronotoper?
HiST
HiST
risvollan
8
lerchendal
samf
dronningen
berg
dragvoll
5
HiST
‘addressivity’
Each individual utterance is a link in the chain
of speech communication. [The utterance
reflects] others’ utterances, and, above all,
preceding links in the chain (sometimes close
and sometimes […] very distant). […] The
utterance is addressed not only to its own
object, but also to others’ speech about it.
(Bakhtin 1986: 93f).
HiST
bus.pl
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
plan_travel(Arrive, Arrive, Visited, [], Visited).
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
...
not(G) :- call(G),!,fail.
not(_).
...
member(E,[E|_]).
member(E,[_|L]):- member(E,L).
...
BasicLibrary.java
line 621-2 and 742-3
HiST
Tokenizer
line 178-183
// variable, atom or number
if (typea == TT_WORD) {
char firstChar = svala.charAt(0);
// variable
if (Character.isUpperCase(firstChar) || '_' == firstChar)
return new Token(svala, Token.VARIABLE);
bus.pl
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
plan_travel(Arrive, Arrive, Visited, [], Visited).
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
Parser
line 293-299
if (t1.isType(Token.VARIABLE)){
int pos = variableList.indexOf(t1.seq);
if (pos != -1 && t1.seq != Var.ANY)
return new Var(t1.seq, pos+1);
variableList.add(t1.seq);
return new Var(t1.seq, variableList.size());
}
HiST
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
text
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
text
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
private String name;
public final int nrInStruct;
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
public final static String ANY = "_".intern();
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
text
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
text
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
text
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
public interface List<E> extends Collection<E> {
// Query Operations
List
/**
* Returns the number of elements in this list. If this list contains
* more than <tt>Integer.MAX_VALUE</tt> elements, returns
* <tt>Integer.MAX_VALUE</tt>.
*
* @return the number of elements in this list
*/
int size();
package jTrolog.parser;
import java.io.Serializable;
static final int ATOM = 'A';
static final int SQ_SEQUENCE = 'S';
static final int DQ_SEQUENCE = 'D';
static final int OPERATOR = 'O';
static final int FUNCTOR = 'F';
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
Token
/**
* This class represents a token read by the prolog term tokenizer
*/
class Token implements Serializable {
// token textual representation
String seq;
// token type and attribute
int type;
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
boolean isEmpty();
static final int ATOM_OPERATOR = 'B';
static final int ATOM_FUNCTOR = 'a';
Character
public final
class Character extends Object implements java.io.Serializable,
Comparable<Character> {
/**
* The minimum radix available for conversion to and from strings.
* The constant value of this field is the smallest value permitted
* for the radix argument in radix-conversion methods such as the
* <code>digit</code> method, the <code>forDigit</code>
* method, and the <code>toString</code> method of class
* <code>Integer</code>.
*
* @see
java.lang.Character#digit(char, int)
* @see
java.lang.Character#forDigit(int, int)
* @see
java.lang.Integer#toString(int, int)
* @see
java.lang.Integer#valueOf(java.lang.String)
*/
public static final int MIN_RADIX = 2;
Var
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* The maximum radix available for conversion to and from strings.
* The constant value of this field is the largest value permitted
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
Parser
line 293-299
if (t1.isType(Token.VARIABLE)){
int pos = variableMap.indexOf(t1.seq);
if (pos != -1 && t1.seq != Var.ANY)
return new Var(t1.seq, pos+1);
variableMap.add(t1.seq);
return new Var(t1.seq, variableMap.size());
}
Tokenizer
line 178-183
// variable, atom or number
if (typea == TT_WORD) {
char firstChar = svala.charAt(0);
// variable
if (Character.isUpperCase(firstChar) || '_' == firstChar)
return new Token(svala, Token.VARIABLE);
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
bus.pl
plan_travel(Arrive, Arrive, Visited, [], Visited).
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
HiST
package jTrolog.terms;
text
text
package jTrolog.terms;
package jTrolog.terms;
text
import jTrolog.errors.InvalidTermException;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
text
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
package jTrolog.terms;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
text
ChoicePoint
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
public interface List<E> extends Collection<E> {
// Query Operations
if (t1.isType(Token.VARIABLE)){
int pos = variableMap.indexOf(t1.seq);
if (pos != -1 && t1.seq != Var.ANY)
return new Var(t1.seq, pos+1);
variableMap.add(t1.seq);
return new Var(t1.seq, variableMap.size());
}
Iterator
/**
* Returns the number of elements in this list. If this list contains
* more than <tt>Integer.MAX_VALUE</tt> elements, returns
* <tt>Integer.MAX_VALUE</tt>.
*
* @return the number of elements in this list
*/
int size();
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
boolean isEmpty();
class Engine {
public static final int EVAL = 0;
public static final int RULE = 1;
public static final int BACK = 2;
public static final int TRUE = 3;
public static final int TRUE_ALL = 4;
public static final int FALSE = 5;
Engine
HashMap
/**
* Returns the number of elements in this list. If this list contains
* more than <tt>Integer.MAX_VALUE</tt> elements, returns
* <tt>Integer.MAX_VALUE</tt>.
*
* @return the number of elements in this list
*/
int size();
text
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
private Prolog prolog;
BindingsTable bt;
private int stackPos;
private ChoicePoint[] stack;
public static final int STARTUP_STACK_SIZE = 64;
private int initState;
private ChoicePoint query;
private int stackPos;
private ChoicePoint[] stack;
public static final int STARTUP_STACK_SIZE = 64;
private int initState;
private ChoicePoint query;
Engine(Prolog manager, final Struct[] queryBody) throws Throwable {
Engine(Prolog manager, final Struct[] queryBody) throws Throwable {
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
boolean isEmpty();
class Engine {
public
public
public
public
public
public
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
BindingsTable
static
static
static
static
static
static
final
final
final
final
final
final
int
int
int
int
int
int
EVAL = 0;
RULE = 1;
BACK = 2;
TRUE = 3;
TRUE_ALL = 4;
FALSE = 5;
class Engine {
GarbageCan
public static final int EVAL = 0;
public static final int RULE = 1;
public static final int BACK = 2;
public static final int TRUE = 3;
public static final int TRUE_ALL = 4;
public static final int FALSE = 5;
private Prolog prolog;
BindingsTable bt;
private Prolog prolog;
BindingsTable bt;
private int stackPos;
private ChoicePoint[] stack;
public static final int STARTUP_STACK_SIZE = 64;
private int initState;
private ChoicePoint query;
private int stackPos;
private ChoicePoint[] stack;
public static final int STARTUP_STACK_SIZE = 64;
private int initState;
private ChoicePoint query;
Engine(Prolog manager, final Struct[] queryBody) throws Throwable {
public interface List<E> extends Collection<E> {
// Query Operations
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
public static final int EVAL = 0;
public static final int RULE = 1;
public static final int BACK = 2;
public static final int TRUE = 3;
public static final int TRUE_ALL = 4;
public static final int FALSE = 5;
private Prolog prolog;
BindingsTable bt;
public interface List<E> extends Collection<E> {
// Query Operations
LinkTable
class Engine {
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
List
Engine(Prolog manager, final Struct[] queryBody) throws Throwable {
/**
* Returns the number of elements in this list. If this list contains
* more than <tt>Integer.MAX_VALUE</tt> elements, returns
* <tt>Integer.MAX_VALUE</tt>.
*
* @return the number of elements in this list
*/
int size();
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
boolean isEmpty();
Var
package jTrolog.terms;
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
private String name;
public final int nrInStruct;
package jTrolog.parser;
import java.io.Serializable;
Token
static final int ATOM = 'A';
static final int SQ_SEQUENCE = 'S';
static final int DQ_SEQUENCE = 'D';
static final int OPERATOR = 'O';
static final int FUNCTOR = 'F';
static final int ATOM_OPERATOR = 'B';
static final int ATOM_FUNCTOR = 'a';
package jTrolog.terms;
public final static String ANY = "_".intern();
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* This class represents a token read by the prolog term tokenizer
*/
class Token implements Serializable {
// token textual representation
String seq;
// token type and attribute
int type;
Struct
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
import jTrolog.errors.InvalidTermException;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
public final static String ANY = "_".intern();
text
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
if (t1.isType(Token.VARIABLE)){
int pos = variableMap.indexOf(t1.seq);
if (pos != -1 && t1.seq != Var.ANY)
return new Var(t1.seq, pos+1);
variableMap.add(t1.seq);
return new Var(t1.seq, variableMap.size());
}
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
Term
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
Tokenizer
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
package jTrolog.terms;
text
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
bus.pl
plan_travel(Arrive, Arrive, Visited, [], Visited).
package jTrolog.terms;
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
import jTrolog.errors.InvalidTermException;
text
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
public final static String ANY = "_".intern();
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
package jTrolog.terms;
text
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final
class Character extends Object implements java.io.Serializable,
Comparable<Character> {
/**
* The minimum radix available for conversion to and from strings.
* The constant value of this field is the smallest value permitted
* for the radix argument in radix-conversion methods such as the
* <code>digit</code> method, the <code>forDigit</code>
* method, and the <code>toString</code> method of class
* <code>Integer</code>.
*
* @see
java.lang.Character#digit(char, int)
* @see
java.lang.Character#forDigit(int, int)
* @see
java.lang.Integer#toString(int, int)
* @see
java.lang.Integer#valueOf(java.lang.String)
*/
public static final int MIN_RADIX = 2;
/**
* The maximum radix available for conversion to and from strings.
* The constant value of this field is the largest value permitted
package jTrolog.terms;
private String name;
public final int nrInStruct;
Parser
// variable, atom or number
if (typea == TT_WORD) {
char firstChar = svala.charAt(0);
// variable
if (Character.isUpperCase(firstChar) || '_' == firstChar)
return new Token(svala, Token.VARIABLE);
Character
text
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
private String name;
public final int nrInStruct;
text
import jTrolog.errors.InvalidTermException;
package jTrolog.terms;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
text
import jTrolog.errors.InvalidTermException;
package jTrolog.terms;
text
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
HiST
‘addressivity’
Each individual utterance is a link in the chain
of speech communication. [The utterance
reflects] others’ utterances, and, above all,
preceding links in the chain (sometimes close
and sometimes […] very distant). […] The
utterance is addressed not only to its own
object, but also to others’ speech about it.
(Bakhtin 1986: 93f).
HiST
bus.pl
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
plan_travel(Arrive, Arrive, Visited, [], Visited).
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
example query
plan_travel(risvollan, dragvoll, [], X, Y).
imagined Java
web application
imagined Prolog
application
public final
class Character extends Object implements java.io.Serializable, Comparable<Character> {
/**
* The minimum radix available for conversion to and from strings.
* The constant value of this field is the smallest value permitted
* for the radix argument in radix-conversion methods such as the
* <code>digit</code> method, the <code>forDigit</code>
* method, and the <code>toString</code> method of class
* <code>Integer</code>.
*
* @see
java.lang.Character#digit(char, int)
* @see
java.lang.Character#forDigit(int, int)
* @see
java.lang.Integer#toString(int, int)
* @see
java.lang.Integer#valueOf(java.lang.String)
*/
public static final int MIN_RADIX = 2;
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
plan_travel(Arrive, Arrive, Visited, [], Visited).
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
imagined
text
/**
* The maximum radix available for conversion to and from strings.
* The constant value of this field is the largest value permitted
imagined
text
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
package jTrolog.terms;
real text
package jTrolog.terms;
real text
import jTrolog.errors.InvalidTermException;
public final static String ANY = "_".intern();
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
private String name;
public final int nrInStruct;
import jTrolog.errors.InvalidTermException;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
imagined
text
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
package jTrolog.terms;
real text
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
HiST
Addressing
the past, present, and future
The utterance is related not only to preceding,
but also to subsequent links in the chain of
speech communion. When a speaker is
creating an utterance, of course, these links do
not exist. But from the very beginning, the
utterance is constructed while taking into
account possible responsive reactions, for
whose sake, in essence, it is actually created.
(Bakhtin 1986: 94).
HiST
The generalized other’s texts
This addressee can be an immediate participantinterlocutor in an everyday dialogue, a differentiated
collective of specialists in some particular area of
cultural communication, a more or less differentiated
public, ethnic group, contemporaries, like-minded
people, opponents and enemies, a subordinate, a
superior, someone who is lower, higher, familiar,
foreign, and so fourth. And it can also be an
indefinite, unconcretized other (Bakhtin 1986: 95).
HiST
class Cl
assB {
ClassD
d=
ClassC
.work();
}
}
class
Thin
g{
while
(…) class
Stran
c
class lass... wchlasgse {
}
Strile
Stran Socm
e
ss{(…) ange {
gehla
while w
Str{ilaen ..w. hile
ge(…
)
(…) (…w
{cla
) ss
}
... hile O..th. e
...} (…
rE {
)
} wh
}
ile
...
(…)
}
...
}
}
}
class
Class
C
if (… {
)
...
class
Class
D
for (… {
)
...
cl a ss
Cla
C l a s ssA {
sC c
Clas =
sE.d
}
o ( );
class
T
while hing {
(…)
...
g{
Thin
class (…)
while
...
ge {
Str}an
class (…)
while
g e { s S o me {
ge {
s
S..tr. an
) Stran
class (…) cla hile (…
class{ (…)
w
e e
wh} ile
.trangwhil
..
S
s
...
.
clas
(…) ..
w}hile
}
}
rE { ...
Othe
class (…)
}
while
...
}
class C
lass
ClassD B {
d=
ClassC
.work()
}
;
class
S
while trange {
(…)
class
. ss
Som } c..la
class
Str
e{ w
S wh
hile (…ange {
while trangile
e (…
)
{
)
(… c..la
.
... } ) ss Stran} ...
ge {
while
}
(…)
...
class
}
O
while therE {
(…)
...
}
}
}
class
C
while lassE {
(…)
...
class MyClass {
ClassA a =
ClassB.work();
}
}
class
C
if (… lassC {
)
...
class
C
for (… lassD {
)
...
HiST
bus.pl
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
plan_travel(Arrive, Arrive, Visited, [], Visited).
...
ISO Prolog specification
Page 14 and 23
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
V is a set of variables such that for each
term of variable token (6.4.3):
1) Every occurrence of the same named variable in
a read-term corresponds to the same member of V,
2) Every other named variable corresponds to
a different member of V, and
3) Every anonymous variable corresponds to
a different member of V.
...
named variable (* 6.4.3 *)
= variable indicator char (* 6.4.3 *),
alphanumeric char (* 6.5.2 *),
{ alphanumeric char (* 6.5.2 *) )
| capital letter char (* 6.5.2 *),
{ alphanumeric char (* 6.5.2 *) } ;
Parser
line 293-299
if (t1.isType(Token.VARIABLE)){
int pos = variableMap.indexOf(t1.seq);
if (pos != -1 && t1.seq != Var.ANY)
return new Var(t1.seq, pos+1);
variableMap.add(t1.seq);
return new Var(t1.seq, variableMap.size());
}
...
Tokenizer
line 178-183
// variable, atom or number
if (typea == TT_WORD) {
char firstChar = svala.charAt(0);
// variable
if (Character.isUpperCase(firstChar) || '_' == firstChar)
return new Token(svala, Token.VARIABLE);
HiST
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
text
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
public final
class Character extends Object implements java.io.Serializable,
Comparable<Character> {
/**
* The minimum radix available for conversion to and from strings.
* The constant value of this field is the smallest value permitted
* for the radix argument in radix-conversion methods such as the
* <code>digit</code> method, the <code>forDigit</code>
* method, and the <code>toString</code> method of class
* <code>Integer</code>.
*
java.lang.Character#digit(char, int)
* @see
java.lang.Character#forDigit(int, int)
* @see
java.lang.Integer#toString(int, int)
* @see
java.lang.Integer#valueOf(java.lang.String)
* @see
*/
public static final int MIN_RADIX = 2;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
text
text
package jTrolog.terms;
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
/**
* The maximum radix available for conversion to and from strings.
* The constant value of this field is the largest value permitted
JLog
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final static String ANY = "_".intern();
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
text
SWI
plan_travel(Arrive, Arrive, Visited, [], Visited).
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
jTrolog
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
text
Prolog
class Engine {
public static final int EVAL = 0;
public static final int RULE = 1;
public static final int BACK = 2;
public static final int TRUE = 3;
public static final int TRUE_ALL = 4;
public static final int FALSE = 5;
private Prolog prolog;
BindingsTable bt;
private int stackPos;
private ChoicePoint[] stack;
public static final int STARTUP_STACK_SIZE = 64;
private int initState;
private ChoicePoint query;
Engine(Prolog manager, final Struct[] queryBody) throws Throwable {
text.pl
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
bus(risvollan, nardo, 8).
bus(nardo, lerchendal, 8).
bus(lerchendal, samf, 8).
bus(samf, dronningen, 8).
bus(dronningen, samf, 5).
bus(samf, berg, 5).
bus(berg, moholt, 5).
bus(moholt, dragvoll, 5).
bus.pl
plan_travel(Arrive, Arrive, Visited, [], Visited).
BasicLibrary
package jTrolog.terms;
plan_travel(Depart, Arrive, Visited, [BusLine | RouteN], Route) :bus(Depart, X, BusLine),
not member(X, Visited),
plan_travel(X, Arrive, [X | Visited], RouteN, Route).
import jTrolog.errors.InvalidTermException;
/**
* The maximum radix available for conversion to and from strings.
* The constant value of this field is the largest value permitted
text.pl
package jTrolog.terms;
import jTrolog.errors.InvalidTermException;
public final static String ANY = "_".intern();
public final static String ANY = "_".intern();
private String name;
public final int nrInStruct;
private String name;
public final int nrInStruct;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
/**
* needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars
*/
Var() {
type = Term.VAR;
package jTrolog.terms;
text.pl
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
/**
* This class represents a variable term. Variables are identified by a name
* (which must starts with an upper case letter) or the anonymous ('_') name.
*
* @see Term
*/
public class Var extends Term {
public final
class Character extends Object implements java.io.Serializable,
Comparable<Character> {
/**
* The minimum radix available for conversion to and from strings.
* The constant value of this field is the smallest value permitted
* for the radix argument in radix-conversion methods such as the
* <code>digit</code> method, the <code>forDigit</code>
* method, and the <code>toString</code> method of class
* <code>Integer</code>.
*
java.lang.Character#digit(char, int)
* @see
java.lang.Character#forDigit(int, int)
* @see
java.lang.Integer#toString(int, int)
* @see
java.lang.Integer#valueOf(java.lang.String)
* @see
*/
public static final int MIN_RADIX = 2;
text
import jTrolog.errors.InvalidTermException;
package jTrolog.terms;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
text
import jTrolog.errors.InvalidTermException;
package jTrolog.terms;
text
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
import jTrolog.errors.InvalidTermException;
/**
* This class represents a variable term. Variables are identified by a
name
* (which must starts with an upper case letter) or the anonymous ('_')
name.
*
* @see Term
*/
public class Var extends Term {
HiST
The generalized other’s texts
This addressee can be an immediate participantinterlocutor in an everyday dialogue, a differentiated
collective of specialists in some particular area of
cultural communication, a more or less differentiated
public, ethnic group, contemporaries, like-minded
people, opponents and enemies, a subordinate, a
superior, someone who is lower, higher, familiar,
foreign, and so fourth. And it can also be an
indefinite, unconcretized other (Bakhtin 1986: 95).
HiST
Grammaticalization
[Grammaticalization refers] to the change whereby
lexical items and constructions come in certain
linguistic contexts to serve grammatical functions
and, once grammaticalized, continue to develop new
grammatical functions (Hopper 1993: 18).
The more general the ‘other’ is, the more the other
resembles words and grammar in language. Language
understood as an ultimate(?) generalization.
HiST
Chronotope
• ”The chronotope, functioning as the primary
means for materializing time in space, emerges
as the center for concretizing representation, as
a force giving body to the entire novel. All the
novel’s abstract elements – philosophical and
social generalizations, ideas, analyses of cause
and effect – gravitate towards the chronotope
and through it take on flesh and blood,
permitting the imaging power of art to do its
work.”
HiST
Chronotope
• an analytical category
• “the intrinsic connectedness of temporal and
spatial relationships that are artistically
expressed in literature” (Bakhtin 1981: 84).
• not used to describe the entire fictional worlds
as we imagine them.
• only used to describe the imagined time-space
relationships or systems that are constructed
together with these fictional worlds in order to
sustain them.
HiST
Chronotope
• “The image of man is always intrinsically
chronotopic” (Bakhtin 1981: 85),
• but the chronotope too “is always related to
people“ (Bostad 2004: 173).
• Chronotopes must be viewed in relation to a
person, an ‘image of man’, a participant, a
programme or some other ‘actor(s)’ that can
fill the chronotope with life and meaning.
HiST
Kronotopene for greske helter
• [The heroes] have gone through something,
something that did not, indeed, change them but that
did (in a manner of speaking) affirm what they, and
precisely they, were as individuals, something that did
verify and establish their identity, their durability and
continuity. The hammer of events shatters nothing
and forges nothing – it merely tries the durability of
an already finished product. And the product passes
the test. (Bakhtin 1981: 106-7)
HiST
Kronotopene i Java vs. Prolog
• Java
int var = 2; var = var + 1;
• Variabler kan bindes
flere ganger.
• Skaper flere former for
kohesjon
• Skaper en avhengighet i
tid og dermed tidslinje.
• ’beads on a string’
• Prolog
Var is 2, Var is Var + 1
• Variabler kan bare
bindes en gang.
• Skaper også kohesjon
• Men en langt svakere
avhengighet i tid og
egentlig ingen tidslinje.
• ’beads in a bowl’
HiST
Kronotopene i Java vs. Prolog
•
•
•
•
Java
’beads on a string’
Programmet er ’helten’
Programmet går gjennom
sitt environment run-time.
• Tidslinja skaper et
handlingsforløp.
•
•
•
•
Prolog
’beads in a bowl’
Programmet er ’helten’
Noen Prolog program (f.eks.
bus.pl) går gjennom sitt
environment trinn for trinn
(rekursivt).
• Men noen andre Prolog
program beskriver bare
miljøet trinnløst (synkront).
HiST
En Einstein kronotop
HiST
Skriving + Programmering = ?
• Hva kan være skriving? Hva kan være språk? Hva er det vi
forstår som skriving og språk?
• Programmering er ”polyphony in action”, intertekstualitet++,
kronotopn, et karnevalesk studieobjekt for dialog.
• Og programmering er god, gammeldags kommunikasjon og
dialog og tekst. Hva kan vi ikke anvende i programmering om
det vi har funnet ut om ”vanlig” skriving?
HiST
Doing program words
• Language is socially constructed.
• ”[Language] is populated with the
intentions of others”
• Actions and perceptions as
compositions of others’ voices
}
rk();
}
class
Thin
g{
while
(…) class
Stran
ge {
ass
class class... wcl
}
Shtrile
Stran Soclm
e
a
geh{ass{(…)w nge {
while w
Strile
... hile
cl
) an}ge(…
(…) (…w
{ )ass
... hile O...
therE
...} (…
)
{
} wh
}
ile
...
(…)
}
...
}
– heteroglossia
– ventriloquism
• Social interaction or structures
in motion are seen not only side
by side with language, but also
as within language itself.
class Cla
ssB {
ClassD
d=
ClassC
.wo
}
}
class
Clas
sC
if (… {
)
...
class
Clas
sD
for (… {
)
...
class
Cla
Clas ssA {
sC c
Clas =
sE.d
}
o ( );
class
T
while hing {
(…)
...
g{
Thin
class (…)
while
...
ge {
Str}an
class (…)
while
{
ge {
o me
e{
S...tran
ass S ) Strang
class (…) cl hile (…
class{ (…)
w
wh} ile
ge ile
...tran wh
S
...
class (…) ...
w}hile
}
}
rE { ...
Othe
class (…)
}
while
...
}
class C
lass
ClassD B {
d=
ClassC
.work()
}
;
class
S
while trange {
(…
class
...ass )
Som } cl
class
Stran
e{ w
S wh
ge {
h
ile
while trangile
e (…
(…)
(…)cl
...ass{ )
...
S
... }
while tran}ge {
}
(…)
...
class
}
O
while therE {
(…)
...
}
}
}
class
C
while lassE {
(…)
...
class MyClass {
ClassA a =
ClassB.work();
}
}
class
C
for (… lassD {
)
...
HiST
class
C
if (… lassC {
)
...
“Language exerts hidden power,
like a moon on the tides.”
Rita Mae Brown
HiST