Skip to main content
added 18 characters in body
Source Link
Dave Clarke
  • 20.3k
  • 4
  • 68
  • 113

That text describes the following (Python) pseudocode:

subs = a list of string pairs  
As = a list of integers  
Bs = a list of integers
  
def f(state, pc):  
  if pc == N: return (state, pc)  
  if state.find(subs[pc][0]) != -1:  
    return (state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])  
  else:  
    return (state,As[pc])  

The function f is presumably going to be applied repeatedly.

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.

That text describes the following (Python) pseudocode:

subs = a list of string pairs
As = a list of integers
Bs = a list of integers

def f(state, pc):
  if pc == N: return (state, pc)
  if state.find(subs[pc][0]) != -1:
    return (state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])
  else:
    return (state,As[pc])

The function f is presumably going to be applied repeatedly.

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.

That text describes the following (Python) pseudocode:

subs = a list of string pairs  
As = a list of integers  
Bs = a list of integers
  
def f(state, pc):  
  if pc == N: return (state, pc)  
  if state.find(subs[pc][0]) != -1:  
    return (state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])  
  else:  
    return (state,As[pc])  

The function f is presumably going to be applied repeatedly.

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.

added 82 characters in body
Source Link
rgrig
  • 1.3k
  • 1
  • 11
  • 15

That text describes the following (Python) pseudocode:

subs = a list of string pairs
As = a list of integers
Bs = a list of integers

def runf(state, pc):
  if pc == N: return (state, pc)
  if state.find(subs[pc][0]) != -1:
    runreturn (state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])
  else:
    runreturn (state,As[pc])

The function f is presumably going to be applied repeatedly.

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.

That text describes the following (Python) pseudocode:

subs = a list of string pairs
As = a list of integers
Bs = a list of integers

def run(state, pc):
  if pc == N: return
  if state.find(subs[pc][0]) != -1:
    run(state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])
  else:
    run(state,As[pc])

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.

That text describes the following (Python) pseudocode:

subs = a list of string pairs
As = a list of integers
Bs = a list of integers

def f(state, pc):
  if pc == N: return (state, pc)
  if state.find(subs[pc][0]) != -1:
    return (state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])
  else:
    return (state,As[pc])

The function f is presumably going to be applied repeatedly.

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.

Source Link
rgrig
  • 1.3k
  • 1
  • 11
  • 15

That text describes the following (Python) pseudocode:

subs = a list of string pairs
As = a list of integers
Bs = a list of integers

def run(state, pc):
  if pc == N: return
  if state.find(subs[pc][0]) != -1:
    run(state.replace(subs[pc][0],subs[pc][1],1), Bs[pc])
  else:
    run(state,As[pc])

The last three bullet points is all you really need once you understand the notations. All that comes before is a bit analogous to explaining how Python works before giving the Python code.