2

I guess this is a question about what it means to be Turing complete. Awk is a programming language, and I've heard you can do anything with those, but aren't there physical limitations as well? I mean, you probably can't delete files with a minecraft red-stone computer. Similarly I imagine you can't do graphics with AWK.

What sort of extension would be necessary to AWK for it to be able to do graphics?

Please down-vote me if this question is a foolish waste of time (I'm just not sure).

Thanks!

Ziggy
  • 21,845
  • 28
  • 75
  • 104

3 Answers3

5

The notion of Turing completeness refers to being able to compute any computable function (from natural numbers to natural numbers, or {0,1}* to {0,1}*, or the like). It is a somewhat abstract concept and does not refer to specifics of hardware like graphics (or USB ports or wireless connections or anything of that sort). It does not even talk of the behaviour of "always running" programs like (HTTP/FTP/ssh/etc) servers. It only talks of computations which take some finite input, and

  • Halt and produces a finite output, or
  • Run forever.

So it doesn't really make sense to relate Awk's Turing-completeness with its support for graphics libraries.

Prateek
  • 2,377
  • 17
  • 29
  • 1
    Very nice! Yeah: me and a friend were just joking about using AWK for graphics programming. Then we started thinking more seriously about why AWK might not be able to do that, and about what it means to be Turing Complete. You're right that this judgement doesn't make sense. – Ziggy Dec 08 '11 at 23:32
1

You can use the "system()"-command to call any program from within awk. I have used awk many times in combination with imagemagick, So, in principle you could use awk for graphics programming. But most probably you would prefer Tcl with Tk for these tasks. Awk was intended for text processing long before graphical displays, Tcl with Tk was made for rapid prototyping (with graphics and gui).

HTH Chris

Chris
  • 2,987
  • 2
  • 20
  • 21
0

I have used awk to do Graphics/Image Processing in many answers on StackOverflow. No need to repeat them all but here are a few...

Community
  • 1
  • 1
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432