Skip to content

Instantly share code, notes, and snippets.

@yousefamar
Created May 26, 2015 21:23
Show Gist options
  • Save yousefamar/e5a7a8f9d531915b6298 to your computer and use it in GitHub Desktop.
Save yousefamar/e5a7a8f9d531915b6298 to your computer and use it in GitHub Desktop.
#!/usr/bin/env lsc
w = 0.5
_w = 1 - w
n1 = 50
n2 = 100
mem = 0
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