Functional programming ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Functional programming ?
Hi,
While I understand that Livecode does not provide "Functional Programming" commands I am hoping that one of the forum experts might be able to explain what it is and why it is seen by some programmers as an advantage.
My own googling suggests that it is a way of processing items contained in lists where the call to the routine includes the list and the "operation" that is to be performed on each item in the list with the result being passed back as a second list.
I found this paper on the Livecode site https://livecode.com/functional-feature ... t-a-dream/ but I am uncertain if and why the techniques are significant.
It is probably best if any explanations are kept to about the same level of complexity as you would use why speaking to your pet dog.
best wishes
Simon
While I understand that Livecode does not provide "Functional Programming" commands I am hoping that one of the forum experts might be able to explain what it is and why it is seen by some programmers as an advantage.
My own googling suggests that it is a way of processing items contained in lists where the call to the routine includes the list and the "operation" that is to be performed on each item in the list with the result being passed back as a second list.
I found this paper on the Livecode site https://livecode.com/functional-feature ... t-a-dream/ but I am uncertain if and why the techniques are significant.
It is probably best if any explanations are kept to about the same level of complexity as you would use why speaking to your pet dog.
best wishes
Simon
best wishes
Skids
Skids
Re: Functional programming ?
Very good question Skids - after googling this i came away more confused...
I suspect the reality is probably that LC has some features of 'functional programming' or that it may be possible to emulate structures from other languages that are classed as such.
But at the end of the day this differentiation may be completely abstract and academic. Each language has a natural flow and trying to bend one language into the flow of another may not make for a happy future. Maybe.
Or i might be completely wrong
Out of curiosity, was there a specific issue you were trying to solve, or is this a thought experiment?
I suspect the reality is probably that LC has some features of 'functional programming' or that it may be possible to emulate structures from other languages that are classed as such.
But at the end of the day this differentiation may be completely abstract and academic. Each language has a natural flow and trying to bend one language into the flow of another may not make for a happy future. Maybe.
Or i might be completely wrong
Out of curiosity, was there a specific issue you were trying to solve, or is this a thought experiment?
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Functional programming ?
If one were really bloody-minded one could write a routine in LiveCode that would read its
way through a truckload of code in a different programming language (say, in a field in a stack)
and convert it into LiveCode.
This would take a very long time and a large amount of effort which would probably involve learning the other
language as well; so hardly justifiable.
way through a truckload of code in a different programming language (say, in a field in a stack)
and convert it into LiveCode.
This would take a very long time and a large amount of effort which would probably involve learning the other
language as well; so hardly justifiable.
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Functional programming ?
I just read a little about Functional Programming as well, and I think that LC is flexible enough to emulate that style. It seems that the main strength of functional programs is the ability to embed functions and parameters into other "parent" functions in compact ways. It would be interesting to take a simple problem (an example I read about was to take a list of names and return only the first names) and see how these compare.
I note that the above task in LC would take about six lines.
Craig
I note that the above task in LC would take about six lines.
Craig
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Functional programming ?
#Stam. Just a thought experiment. Last night I watched a Youtube video about designing the worlds worst programming language (Its named BS by the way) https://www.youtube.com/watch?v=hCvHTrUh4os , its worth a watch. Anyway when it finished the next video was about what makes programming languages successful and the speaker describes himself as a Functional Programmer, https://www.youtube.com/watch?v=QyJZzq0v7Z4 .
I googled Functional Programming and came up with Lambda functions, Map and Filter commands and finally the paper I linked to above. It seemed to me that the use of Functional Programming is used to overcome some limitations of the language, Python I think, overall I was left thinking so what? I also suspect that the popularity may have something to do with brevity. So taking Dunbarx's example I guess the advantage is that the whole definition and call was in one single line, whereas in LC we have to define a function which is called from elsewhere.
I'm hoping that someone who has used a Functional Programming language may chime in and explain what the advantages are.
Simon
I googled Functional Programming and came up with Lambda functions, Map and Filter commands and finally the paper I linked to above. It seemed to me that the use of Functional Programming is used to overcome some limitations of the language, Python I think, overall I was left thinking so what? I also suspect that the popularity may have something to do with brevity. So taking Dunbarx's example I guess the advantage is that the whole definition and call was in one single line, whereas in LC we have to define a function which is called from elsewhere.
I'm hoping that someone who has used a Functional Programming language may chime in and explain what the advantages are.
Simon
best wishes
Skids
Skids
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Functional programming ?
https://en.wikipedia.org/wiki/Functional_programming
Functional programming languages are typically less efficient in their use of CPU and memory than imperative languages such as C and Pascal/quote]
Re: Functional programming ?
I read the german Wikipedia entry for this and now:
-
- VIP Livecode Opensource Backer
- Posts: 9840
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Functional programming ?
Which is best?:
a) Model-View-Controller
b) Model-View-Presenter
c) Shipping an app
#ThingsTheoristsDebateOnTheInternet
a) Model-View-Controller
b) Model-View-Presenter
c) Shipping an app
#ThingsTheoristsDebateOnTheInternet
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Functional programming ?
I believe what is best is what a programmer is comfortable with
and which delivers what the programmer wants to deliver.
So whether Functional programming or non-Functional programming is best is
a bit like whether you prefer blue cheese or stinky tofu for breakfast.
and which delivers what the programmer wants to deliver.
So whether Functional programming or non-Functional programming is best is
a bit like whether you prefer blue cheese or stinky tofu for breakfast.
Re: Functional programming ?
Yes! Definitively!FourthWorld wrote: ↑Thu Nov 18, 2021 7:35 pmWhich is best?:
a) Model-View-Controller
b) Model-View-Presenter
c) Shipping an app
Re: Functional programming ?
Which is best?:
a) Model-View-Controller
b) Model-View-Presenter
c) Shipping an app
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Functional programming ?
a) Model-View-Controller
b) Model-View-Presenter
Two people who work for a TV show about Airfix perhaps
best wishes
Skids
Skids