Functional Programming

Functional Programming

  • Gheorghe Sebestyen added an answer:
    Can we use adaptive fuzzy logic controller to deal with discrete variables?

    adaptive fuzzy logic controller has been selected to solve a prediction problem - the variables are discrete - and contains time - day with other contextual data -

    is it possible to use fuzzy logic controller with discrete variables and can we use it alone?

    Gheorghe Sebestyen · Universitatea Tehnica Cluj-Napoca

    In a computer any variable is discrete, even if it represents real-life continuous (in other words analog) signals or parameters. So, if you implement Fuzzy logic in a computer automatically you have to work with discrete values. The question is how discrete, or how many discrete values represent the variation of a parameter in a given domain. It may go from just two values (a Boolean variable) to a very high granularity where the discrete variable models very well the real-world continuous parameter.

    As a conclusion, yes you can use Fuzzy logic for discrete parameters if the granularity (number of discrete values) of the discrete parameter is enough to model your problem.

  • Gyan Chandra Chauthwani added an answer:
    How do I call the nlconst.m function within other functions using the function handler under MATLAB?

    I am using nlconst.m for constrained minimization of given function. but when i call nlconst() with some points as inputs arguments, i get error "OPTIONS is undefined". What OPTIONS can be used in this? furthermore, what about other input arguments? whether i have to give each and every arg or can i skip any input args?

    Gyan Chandra Chauthwani · Nuclear Power Corporation of India ltd.

    I am using MATLB-R2014a, In which nlconst.m exist and one should use it properly as

    nlconst (funfcn,x,lb,ub,Ain,Bin,Aeq,Beq,confcn,OPTIONS,defaultopt,finDiffFlags,verbosity,flags,initVals,problemInfo,optionFeedback,varargin)

    Actually used for (as quoted in nlconst.m)

    %NLCONST Helper function to find the constrained minimum of a function

    % of several variables. Called by FMINCON, FGOALATTAIN, FSEMINF, and


    No help file exist for nlconst.m

    hope it may help.

  • Lothar Schmitz added an answer:
    Do you know any good publication about recursive algorithms for a functional programming?

    I study functional programming with Scala, but I have a problem with the recursive algorithms because they are difficult to approach.

    Lothar Schmitz · Universität der Bundeswehr München

    Another natural place to look at would be Martin Odersky's Coursera course:
    Martin Odersky of École Polytechnique Fédérale de Lausanne is the inventor of Scala.I have worked through this course and can recommend it very much.

  • Peter Bishop added an answer:
    Does anyone know of real industrial projects which have used formal proofs to show that an application will work?
    I am writing a new computing course and need some examples I can point students to. People talk about using functional programming arguing that it will allow programmers to build formally provable software. That was what I was told about 20 years ago and I was wondering if any real software had been built in a functional language then mathematically proved to be correct? Are there any examples I could point at? Particularly something people would have heard of, if possible.
    Peter Bishop · City University London

    The B method has been used for rail safety systems, see


  • Pavel Velikhov added an answer:
    How can machines learn multiple abstract syntax trees from the same encoded syntax in a polyglot functional programming language?

    A question on the frontiers of poly-normalized programming paradigms !

    Pavel Velikhov · Russian Academy of Sciences

    You need to state your problem a bit more specific. Let me try to rephase:

    Your input are ASTs of your source languages, but in a polyglot system. So in principle each could come from a different language, but you don't know which. Your goal is to label the which AST came from which language? 

  • Lito Perez Cruz added an answer:
    Is there a software engineering methodology for functional programming? What method do you use to craft software using functional languages?
    It is a well established fact that for OO languages there is the Unified Software Development Process/RUP. I am looking for a discipline/method that is appropriate for building software using functional programming.
    Lito Perez Cruz · Monash University (Australia)

    Thanks so much Jan, that is a nice touch on FP.


  • Sushma Singh added an answer:
    Can anyone help with voice operation or function programming in MATLAB or Visual studio?

    Voice tool in MATLAB or in Visual Studio. How to implement voice operation using any of two?

    Sushma Singh · RCEW

    Thank   Ion Laurentiu Tobos  Sir

  • Muhammad Sharif added an answer:
    What are the advantages and disadvantages of functional programming?
    When would you use functional programming? What criteria do you use to decided if functional programming is a better choice?
    Muhammad Sharif · COMSATS Institute of Information Technology
    Advantages include:
    1. Easier to use subprograms. A subprogram's function is completely described by what goes in and what comes out.
    2. Most functional languages provide a nice, protected environment.
    3. FP encourages quick prototyping.
    4. Functional programming enables and encourages a more abstract way of solving a problem.
    5. A more "mathematical" programming way. You build a program as a mathematical abstraction. The result is less prone to error, cleaner, more elegant and more functional.
    6. Compared to imperative programming, in functional programming you have less chance of creating "spaghetti code" programs.

    Disadvantages include:

    1. Generally more difficult to pick up for new coders.
    2. Functional idioms often do lots of laziness which often has a negative impact on debugging.
    3. It doesn't match the hardware as well as most imperative languages.
    4. The main disadvantage is run-time efficiency. For certain problems, there are well-known mutating algorithms that are significantly more efficient than the best known functional algorithm for that problem. Dijkstra's shortest-paths algorithm is a good example.
  • Does anyone know NESL?
    I just came across this library of algorithms: and found the code to be written in NESL, which until then I have never heard of. It turns out, that it is a functional parallel programming language with bindings to MPI. At least that's what the website states (

    The newest version of the interpreter/compiler is from 1995 (sic!). I tried to build it and got the interpreter to work. It is based on lisp (SIC!). I did not get the compiler to work though...

    Does anyone have experience with this language? Any hints on how to use it on modern hardware/software is appreciated.
    Simon Andreas Frimann Lund · University of Copenhagen
    Recent work has been carried about in the context of NESL, have a look at:
  • Do you think that the functional language Erlang should be avoided from the start to be used in a new research project on the distributed systems?
    I have recently proposed, in a competition of research projects, the development of an application in the field of distributed systems using functional Erlang language. Here is what the one of the reviewers said :
    "Unfortunately the innovative character claimed to be the implementation using the Erlang language turns this work into a simple academic exercise targeted at training Erlang programmers. Erlang graphics toolkits are primitive, and reading any non-trivial Erlang code requires a firm understanding of recursion, a kind of abstract thinking that many people find difficult. Erlang is also lacking in libraries compared to other languages; in my experience, for any given task, there is zero, one, or at most two Erlang libraries available for the job."
    You agree in principle with this answer? How do you comment?
  • Sergey I. Salishev added an answer:
    Do you think that it is possible to have a hardware extension to ease the execution processor code for functional languages ​​(such as Erlang)?
    ARM has introduced a set of extensions to the ARM architecture that will allow an ARM processor to directly execute Java bytecode: Jazelle (ARM Architecture Extensions for Java Applications). What do you think of a processor to facilitate code execution for functional languages ​​(such as Erlang)?
    Sergey I. Salishev · Saint Petersburg State University
    I think the problem might be even worse than described by Pierre. Performance of current microprocessor architectures are heavily dependent on data and code caching, prefetching and pipelining of computations. Direct implementation of functional computations breaks all these optimizations. So the tight loop computations should be eager imperative register-machine code to be efficient. On the coarse grain level functional computations just don't need hardware support as JIT and even good static compiler can compile them to efficient register-machine code.

    Java is not exactly functional but it's stack-machine Java Byte Code was initially planned as microprocessor instruction. This idea has proved to be infeasible due to incompatibility with pipelined code execution crippling the potential efficiency of the hardware Java processor. Java Byte Code only works out with a good complex JIT. For example Android Dalvik VM forgo JBC for register machine code to avoid JIT complexity problem.

    Moreover, hardware/software trade-of is a very subtle matter as hardware always has limited flexibility and capacity. So it is usually more efficient to move all complex code analysis tasks to software (compiler/JIT). One example is the removal of hardware x86 emulation from Intel Itanium and replacing it by software binary translation from x86 to IA64.
  • Peter T Breuer added an answer:
    What's the difference between Theta-combinator and Y-combinator?
    Theta-combinator: \Theta \equiv (\lambda xy. y(xxy))(\lambda xy. y(xxy))
    Y-combinator: Y \equiv (\lambda f. (\lambda x. f(xx))(\lambda x. f(xx)))
    What's the difference between them? In what sense do you say Theta combinator is more powerful than the Y combinator?
    In a reduction path, how can I distinguish beta-reduction and beta-equivalence of terms?
    Peter T Breuer · Birmingham City University
    No, Tom, I'm asking you for the next step. There's nothing possible, according to my reasoning above! So it should be easy for you to reply, and/or point out what the flaw in the reasoning is, and all will become clear.

    But you're right:

    theta f = h h f [h x y = y(x x y)]
    -> f(h h f) [substituting two arguments in h]
    -> f((\y. y (h h y)) f) [substituting one argument in h]
    = f(theta f) [modulo alpha equivalence]

    Surely you could trouble to write out the lines above!

    The answer to my own question is that I was wrong: h h f DOES beta reduce to an expression in which what theta is defined to be does appear to the eye. The crucial "trick" is "partial" application to just one argument, and leaving the second abstracted.

    What happens with Y? The parameterization on f tangles things up so it's hard to read in lambda notation, and hard to relate that to the natural notation.
  • Joachim Pimiskern added an answer:
    Is FP really a programming language?
    The language designed by John Backus and described in his famous paper "Can programming be liberated from the von Neumann style?" named FP (Functional Programming). Is it really a programming language or just a model? Is there any good manual about it. I haven't found anything.
  • Rajesh Ahir asked a question:
    Which software is there on which we can implement the ranked tree and unranked tree automata? How do I measure the XQuery evaluation time?
    XQuery is related to XML database.

Topic Followers (815) See all