29
HiST Programmering som skrivepraksis Ivar Tormod Berg Ørstavik

Programmering som skrivepraksis

  • Upload
    bonita

  • View
    46

  • Download
    0

Embed Size (px)

DESCRIPTION

Ivar Tormod Berg Ørstavik. Programmering som skrivepraksis. 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. - PowerPoint PPT Presentation

Citation preview

Page 1: Programmering som skrivepraksis

HiST

Programmering som skrivepraksis

Ivar Tormod Berg Ørstavik

Page 2: Programmering som skrivepraksis

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.

Page 3: Programmering som skrivepraksis

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?

Page 4: Programmering som skrivepraksis

HiST

Page 5: Programmering som skrivepraksis

HiST

5

8

risvollan

lerchendalsamf

dronningen

dragvoll

berg

Page 6: Programmering som skrivepraksis

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).

Page 7: Programmering som skrivepraksis

HiST

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).

bus.pl

...not(G) :- call(G),!,fail.not(_)....member(E,[E|_]).member(E,[_|L]):- member(E,L)....

BasicLibrary.javaline 621-2 and 742-3

Page 8: Programmering som skrivepraksis

HiST

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());}

Parserline 293-299

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).

bus.pl

// variable, atom or numberif (typea == TT_WORD) { char firstChar = svala.charAt(0); // variable if (Character.isUpperCase(firstChar) || '_' == firstChar) return new Token(svala, Token.VARIABLE);

Tokenizerline 178-183

Page 9: Programmering som skrivepraksis

HiST

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());}

Parserline 293-299

// variable, atom or numberif (typea == TT_WORD) { char firstChar = svala.charAt(0); // variable if (Character.isUpperCase(firstChar) || '_' == firstChar) return new Token(svala, Token.VARIABLE);

Tokenizerline 178-183

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).

bus.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 {

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;

Var

public interface List<E> extends Collection<E> { // Query Operations

/** * 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();

/** * Returns <tt>true</tt> if this list contains the specified element. * More formally, returns <tt>true</tt> if and only if this list contains

Listpackage jTrolog.parser;import java.io.Serializable;

/** * This class represents a token read by the prolog term tokenizer */class Token implements Serializable {

// token textual representationString seq;// token type and attributeint type;

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';

Token

public finalclass 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

Character

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;

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 ;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

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 ;

/** * needed to implement Wrapper Objects . Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

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 ;

/** * needed to implement Wrapper Objects . Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

text

Page 10: Programmering som skrivepraksis

HiST

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());}

Parser

// variable, atom or numberif (typea == TT_WORD) { char firstChar = svala.charAt(0); // variable if (Character.isUpperCase(firstChar) || '_' == firstChar) return new Token(svala, Token.VARIABLE);

Tokenizer

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).

bus.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 {

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;

Var

public interface List<E> extends Collection<E> { // Query Operations

/** * 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();

/** * 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

package jTrolog.parser;import java.io.Serializable;

/** * This class represents a token read by the prolog term tokenizer */class Token implements Serializable {

// token textual representationString seq;// token type and attributeint type;

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';

Token

public finalclass 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

Character

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;

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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

text

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 {

Engine

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 {

BindingsTable

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());}

ChoicePoint public interface List<E> extends Collection<E> { // Query Operations

/** * 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();

/** * Returns <tt>true</tt> if this list contains the specified element. * More formally, returns <tt>true</tt> if and only if this list contains

Iterator

public interface List<E> extends Collection<E> { // Query Operations

/** * 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();

/** * Returns <tt>true</tt> if this list contains the specified element. * More formally, returns <tt>true</tt> if and only if this list contains

HashMap

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;

Struct

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;

Term

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 {

LinkTable

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 {

GarbageCan

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

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

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

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

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 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

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

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

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

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

Page 11: Programmering som skrivepraksis

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).

Page 12: Programmering som skrivepraksis

HiST

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 Prolog application

plan_travel(risvollan, dragvoll, [], X, Y).

example query

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).

bus.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 {

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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

real text

public finalclass 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

imagined Java web application

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;

real 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;

/** * 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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

real 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;

/** * needed to implement Wrapper Objects. Do not use to stringToStructList ANY Vars */ Var() { type = Term.VAR;

imagined text

Page 13: Programmering som skrivepraksis

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).

Page 14: Programmering som skrivepraksis

HiST

The generalized other’s texts

This addressee can be an immediate participant-interlocutor 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).

Page 15: Programmering som skrivepraksis

HiST

class Strange { while (…) ... }

class Strange { while (…) ... }

class Strange { while (…) ... }

class OtherE { while (…) ... }

class Thing { while (…) ... }

class Strange { while (…) ... }

class Some { while (…) ... }

class ClassE { while (…) ... }

class ClassB { ClassD d = ClassC.work(); }

class MyClass { ClassA a = ClassB.work(); }

class ClassC { if (…) ... }

class ClassA { ClassC c = ClassE.do(); }

class ClassD { for (…) ... }

class Strange {

while (…)

...

}

class Strange {

while (…)

...

}

class Strange {

while (…)

...

}

class OtherE {

while (…)

...

}

class Thing {

while (…)

...

}class Strange {

while (…)

...

}class Some {

while (…)

...

}

class Strange { while (…)

... }

class Strange { while (…)

... }

class Strange { while (…)

... }

class OtherE { while (…)

... }

class Thing { while (…)

... }

class Strange { while (…)

... }

class Some { while (…)

... }

class ClassB { ClassD d = ClassC.work(); }

class ClassC { if (…) ...

}

class ClassD { for (…) ...

}

Page 16: Programmering som skrivepraksis

HiST

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).

bus.pl

// variable, atom or numberif (typea == TT_WORD) { char firstChar = svala.charAt(0); // variable if (Character.isUpperCase(firstChar) || '_' == firstChar) return new Token(svala, Token.VARIABLE);

Tokenizerline 178-183

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());}

Parserline 293-299

...

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 ina 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 *) } ;

...

ISO Prolog specificationPage 14 and 23

Page 17: Programmering som skrivepraksis

HiST

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).

bus.pl

public finalclass 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

BasicLibrary

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;

text.plpackage 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;

text.pl

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 {

Prolog

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 {

textpackage 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 {

textpackage 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

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.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).jTrolog

public finalclass 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 permittedJLog

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;

SWI

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;

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 {

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 {

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 {

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 {

text

Page 18: Programmering som skrivepraksis

HiST

The generalized other’s texts

This addressee can be an immediate participant-interlocutor 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).

Page 19: Programmering som skrivepraksis

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.

Page 20: Programmering som skrivepraksis

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.”

Page 21: Programmering som skrivepraksis

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.

Page 22: Programmering som skrivepraksis

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.

Page 23: Programmering som skrivepraksis

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)

Page 24: Programmering som skrivepraksis

HiST

Kronotopene i Java vs. Prolog

• Javaint 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’

• PrologVar 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’

Page 25: Programmering som skrivepraksis

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).

Page 26: Programmering som skrivepraksis

HiST

En Einstein kronotop

Page 27: Programmering som skrivepraksis

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?

Page 28: Programmering som skrivepraksis

HiST

Doing program words

• Language is socially constructed.

• ”[Language] is populated with the intentions of others”

• Actions and perceptions as compositions of others’ voices– heteroglossia– ventriloquism

• Social interaction or structuresin motion are seen not only side by side with language, but also as within language itself.

class Strange { while (…) ... }

class Strange { while (…) ... }

class Strange { while (…) ... }

class OtherE { while (…) ... }

class Thing { while (…) ... }

class Strange { while (…) ... }

class Some { while (…) ... }

class ClassE { while (…) ... }

class ClassB { ClassD d = ClassC.work(); }

class MyClass { ClassA a = ClassB.work(); }

class ClassC { if (…) ... }

class ClassA { ClassC c = ClassE.do(); }

class ClassD { for (…) ... }

class Strange {

while (…)

...

}

class Strange {

while (…)

...

}

class Strange {

while (…)

...

}

class OtherE {

while (…)

...

}

class Thing {

while (…)

...

}class Strange {

while (…)

...

}class Some {

while (…)

...

}

class Strange { while (…)

... }

class Strange { while (…)

... }

class Strange { while (…)

... }

class OtherE { while (…)

... }

class Thing { while (…)

... }

class Strange { while (…)

... }

class Some { while (…)

... }

class ClassB { ClassD d = ClassC.work(); }

class ClassC { if (…) ...

}

class ClassD { for (…) ...

}

Page 29: Programmering som skrivepraksis

HiST

“Language exerts hidden power, like a moon on the tides.”

Rita Mae Brown