Monday, September 29, 2008
We covered some of the basic programming language types today. The imperative type is the most commonly used one. It is characterized by assignments and statements following a sequential order. C and Java are examples of this. The functional type is less common and includes languages such as scheme, lisp, ML, and Haskell. In its purest form the functional language contains no assignments. The entire program is defined by function definitions, and the invocations of those functions. This idea of a language is called lambda calculus. Logic languages seem pretty interesting. The idea of a logic language is that you define logic relations between variables, and then when you implement the program, you can have it solve for any number of variables. The simple example of this we got in class was say you have a function called append. Rather than defining the function like one would in C where you take in two things and spit out the appended result, in a Logic language like Prolog you have the relational function append that has three things as arguments and the function returns true if the three things satisfy the defined requirement of the first two being subsets of the third. If you pass in a variable you want the function to solve for it will do that for you and spit out all of the solutions. For example ?append([1,2],[3,4],X) would spit out [1,2,3,4]. If you give it ?append(X, [3,4], [1,2,3,4]) it would spit out [1,2]. It seems like logic languages could, in theory, simplify programming.