Skip to content

Instantly share code, notes, and snippets.

@yousefamar
Created May 26, 2015 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yousefamar/551e57e1a1bc89664f09 to your computer and use it in GitHub Desktop.
Save yousefamar/551e57e1a1bc89664f09 to your computer and use it in GitHub Desktop.
#!/usr/bin/env lsc
w = 0.5
_w = 1 - w
n1 = 50
n2 = 100
mem = 200
i = 0
do
prev = mem
mem = _w * mem + w * n2
mem = _w * mem + w * n1
console.log mem
++i
while mem is not prev
console.log "Converged to #mem after #i iterations"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment