• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the relation of the function concept to programming?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although this question is not specifically Java related, it is a basic question that I need answering

This might come off as an overly pedantic question, but I am curious about how the mathematical idea of the function became so prevalent in today's programming languages. Although I have a very rudimentary knowledge of how machine code works, I know it's based on "1's and 0's." Given that, let's take Scheme for example. The language is based on Alonzo Church's lambda calculus, a language that describes the mathematical idea of a function in its purest form. Scheme is know to have implemented much of the lambda calculus as a foundation for the language. This begs the question: what does the concept of a mathematical function have to do with programming a machine (which is based on 1's and 0's)? Is it possible to program without the notion of a function? If so, how?
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is absolutely possible to have a programming language without the idea of functions. There are implementation of a Turing Machine that do not have functions. These languages are not terribly practical, which is why most programming languages have the idea of a function or method or subroutine.
 
Miles Davis
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:It is absolutely possible to have a programming language without the idea of functions. There are implementation of a Turing Machine that do not have functions. These languages are not terribly practical, which is why most programming languages have the idea of a function or method or subroutine.



I guess that is true. But when talking about computation in general, it always seems to relate to the concept of a function. For example, the Church-Turing thesis is stated as saying that there is no effective model of computing that can compute more mathematical functions than a Turing machine. Does this mean that when we talk about things being computable, we are really speaking about if a function can be effectively evaluated? Because when I read the literature, especially in the days of Turing, "function" seems to be the central object of computability. My central question, then, is the notion of computability intrinsically related to the evaluation of functions? If not then what is an example of computation that does not involved a function?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question about computing in general not Java specifically. Moving to our General Computing forum.
 
Saloon Keeper
Posts: 15510
363
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is computation? Computation inherently involves transforming input to results. What transforms input to results? Functions. It doesn't matter if you want to call them functions, subroutines, lambdas, actors, categories or transitions; they all relate to the same concept.
 
Miles Davis
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:What is computation? Computation inherently involves transforming input to results. What transforms input to results? Functions. It doesn't matter if you want to call them functions, subroutines, lambdas, actors, categories or transitions; they all relate to the same concept.



That's a great way to put it, and precisely answers what I'm asking. However, what about the so-called "void" type of functions in, say, Java? These can take in inputs, but since they are type void, they return no outputs. Doesn't this stray from the notion of transforming input to results, and thus to computation?
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
take a setter that is type void. You pass in a value, it returns nothing....but something still happens. The state of the "machine" has changed. So I would say that we have " transform[ed] input to results".
 
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Fred. In this case a 'transition' has occurred. You could say that computation not only involves transformation of data, but also the storing of results. After all, results are useless if you have nowhere to put them. Sometimes you put results on the screen. Sometimes you put them in a register. Sometimes you put them in a stack frame. In the case of a void you put them somewhere else in memory.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic