llvm.org GIT mirror
Fix some typos in the Kaleidoscope tutorial (PR28120) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272681 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 3 years ago
3 changed file(s) with 15 addition(s) and 15 deletion(s).
 79 79 information will allow you to set breakpoints in Kaleidoscope 80 80 functions, print out argument variables, and call functions - all 81 81 from within the debugger! 82 - `Chapter #9 8.html>`_: Conclusion and other useful LLVM⏎ 82 - `Chapter #9 9.html>`_: Conclusion and other useful LLVM⏎ 83 83 tidbits - This chapter wraps up the series by talking about 84 84 potential ways to extend the language, but also includes a bunch of 85 85 pointers to info about "special topics" like adding garbage
 545 545 546 546 # Determine whether the specific location diverges. 547 547 # Solve for z = z^2 + c in the complex plane. 548 def mandleconverger(real imag iters creal cimag)⏎ 548 def mandelconverger(real imag iters creal cimag)⏎ 549 549 if iters > 255 | (real*real + imag*imag > 4) then 550 550 iters 551 551 else 552 mandleconverger(real*real - imag*imag + creal,⏎ 552 mandelconverger(real*real - imag*imag + creal,⏎ 553 553 2*real*imag + cimag, 554 554 iters+1, creal, cimag); 555 555 556 556 # Return the number of iterations required for the iteration to escape 557 def mandleconverge(real imag) 558 mandleconverger(real, imag, 0, real, imag);⏎ 557 def mandelconverge(real imag)⏎ 558 mandelconverger(real, imag, 0, real, imag); 559 559 560 560 This "``z = z2 + c``" function is a beautiful little creature that is 561 561 the basis for computation of the `Mandelbrot 569 569 570 570 :: 571 571 572 # Compute and plot the mandlebrot set with the specified 2 dimensional range⏎ 572 # Compute and plot the mandelbrot set with the specified 2 dimensional range⏎ 573 573 # info. 574 574 def mandelhelp(xmin xmax xstep ymin ymax ystep) 575 575 for y = ymin, y < ymax, ystep in ( 576 576 (for x = xmin, x < xmax, xstep in 577 printdensity(mandleconverge(x,y)))⏎ 577 printdensity(mandelconverge(x,y)))⏎ 578 578 : putchard(10) 579 579 ) 580 580 584 584 mandelhelp(realstart, realstart+realmag*78, realmag, 585 585 imagstart, imagstart+imagmag*40, imagmag); 586 586 587 Given this, we can try plotting out the mandlebrot set! Lets try it out:⏎ 587 Given this, we can try plotting out the mandelbrot set! Lets try it out:⏎ 588 588 589 589 :: 590 590
 495 495 496 496 # determine whether the specific location diverges. 497 497 # Solve for z = z^2 + c in the complex plane. 498 def mandleconverger(real imag iters creal cimag)⏎ 498 def mandelconverger(real imag iters creal cimag)⏎ 499 499 if iters > 255 | (real*real + imag*imag > 4) then 500 500 iters 501 501 else 502 mandleconverger(real*real - imag*imag + creal,⏎ 502 mandelconverger(real*real - imag*imag + creal,⏎ 503 503 2*real*imag + cimag, 504 504 iters+1, creal, cimag); 505 505 506 506 # return the number of iterations required for the iteration to escape 507 def mandleconverge(real imag) 508 mandleconverger(real, imag, 0, real, imag);⏎ 507 def mandelconverge(real imag)⏎ 508 mandelconverger(real, imag, 0, real, imag); 509 509 510 510 This "z = z\ :sup:`2`\ + c" function is a beautiful little creature 511 511 that is the basis for computation of the `Mandelbrot 519 519 520 520 :: 521 521 522 # compute and plot the mandlebrot set with the specified 2 dimensional range⏎ 522 # compute and plot the mandelbrot set with the specified 2 dimensional range⏎ 523 523 # info. 524 524 def mandelhelp(xmin xmax xstep ymin ymax ystep) 525 525 for y = ymin, y < ymax, ystep in ( 526 526 (for x = xmin, x < xmax, xstep in 527 printdensity(mandleconverge(x,y)))⏎ 527 printdensity(mandelconverge(x,y)))⏎ 528 528 : putchard(10) 529 529 ) 530 530 534 534 mandelhelp(realstart, realstart+realmag*78, realmag, 535 535 imagstart, imagstart+imagmag*40, imagmag); 536 536 537 Given this, we can try plotting out the mandlebrot set! Lets try it out:⏎ 537 Given this, we can try plotting out the mandelbrot set! Lets try it out:⏎ 538 538 539 539 :: 540 540