llvm.org GIT mirror llvm / e09bd44
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). Raw diff Collapse all Expand all
7979 information will allow you to set breakpoints in Kaleidoscope
8080 functions, print out argument variables, and call functions - all
8181 from within the debugger!
82 - `Chapter #9 8.html>`_: Conclusion and other useful LLVM
82 - `Chapter #9 9.html>`_: Conclusion and other useful LLVM
8383 tidbits - This chapter wraps up the series by talking about
8484 potential ways to extend the language, but also includes a bunch of
8585 pointers to info about "special topics" like adding garbage
545545
546546 # Determine whether the specific location diverges.
547547 # 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)
549549 if iters > 255 | (real*real + imag*imag > 4) then
550550 iters
551551 else
552 mandleconverger(real*real - imag*imag + creal,
552 mandelconverger(real*real - imag*imag + creal,
553553 2*real*imag + cimag,
554554 iters+1, creal, cimag);
555555
556556 # 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);
559559
560560 This "``z = z2 + c``" function is a beautiful little creature that is
561561 the basis for computation of the `Mandelbrot
569569
570570 ::
571571
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
573573 # info.
574574 def mandelhelp(xmin xmax xstep ymin ymax ystep)
575575 for y = ymin, y < ymax, ystep in (
576576 (for x = xmin, x < xmax, xstep in
577 printdensity(mandleconverge(x,y)))
577 printdensity(mandelconverge(x,y)))
578578 : putchard(10)
579579 )
580580
584584 mandelhelp(realstart, realstart+realmag*78, realmag,
585585 imagstart, imagstart+imagmag*40, imagmag);
586586
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:
588588
589589 ::
590590
495495
496496 # determine whether the specific location diverges.
497497 # 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)
499499 if iters > 255 | (real*real + imag*imag > 4) then
500500 iters
501501 else
502 mandleconverger(real*real - imag*imag + creal,
502 mandelconverger(real*real - imag*imag + creal,
503503 2*real*imag + cimag,
504504 iters+1, creal, cimag);
505505
506506 # 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);
509509
510510 This "z = z\ :sup:`2`\ + c" function is a beautiful little creature
511511 that is the basis for computation of the `Mandelbrot
519519
520520 ::
521521
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
523523 # info.
524524 def mandelhelp(xmin xmax xstep ymin ymax ystep)
525525 for y = ymin, y < ymax, ystep in (
526526 (for x = xmin, x < xmax, xstep in
527 printdensity(mandleconverge(x,y)))
527 printdensity(mandelconverge(x,y)))
528528 : putchard(10)
529529 )
530530
534534 mandelhelp(realstart, realstart+realmag*78, realmag,
535535 imagstart, imagstart+imagmag*40, imagmag);
536536
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:
538538
539539 ::
540540