Skip to content

Instantly share code, notes, and snippets.

@jayfoad
Created September 16, 2015 16:06
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 jayfoad/5f387ede95e42e99c645 to your computer and use it in GitHub Desktop.
Save jayfoad/5f387ede95e42e99c645 to your computer and use it in GitHub Desktop.
The Snakes and Ladders Jugalbandi from Functional Conf 2015, in APL
config←30(3 5 11 20 17 19 21 27)(22 8 26 29 4 7 9 1)
turn←{s f t←⍺ ⋄ n←⍵+{⍵⊣⎕←'throw ',⍕⍵}?6 ⋄ n>s:⍵ ⋄ (f⍳n)⊃t,n}
{}{⎕←config turn ⍵}⍣{⍺=30}1
@ujjwalt
Copy link

ujjwalt commented Sep 20, 2015

Holy shit!
Damn I missed your talk. Please link to the slides.

@mukundmr
Copy link

gives me an invalid token when I try to run it online using the tryapl.org website.

@shukla2009
Copy link

⎕ is this quad ? or squad ?

@jayfoad
Copy link
Author

jayfoad commented Oct 12, 2015

@mukundmr, @shukla2009: ⎕ is quad, and I'm using it to print some output as the game progresses. Unfortunately tryapl.org does not support this sort of input/output. Sorry! I'll think about a better way of writing it.

@jayfoad
Copy link
Author

jayfoad commented Oct 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment