Functional programming ?

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 661
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Functional programming ?

Post by Simon Knight » Thu Nov 18, 2021 8:48 am

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
best wishes
Skids

stam
Posts: 830
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Functional programming ?

Post by stam » Thu Nov 18, 2021 10:21 am

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?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6477
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Functional programming ?

Post by richmond62 » Thu Nov 18, 2021 10:53 am

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7923
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Functional programming ?

Post by dunbarx » Thu Nov 18, 2021 3:19 pm

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

Simon Knight
Posts: 661
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Functional programming ?

Post by Simon Knight » Thu Nov 18, 2021 5:27 pm

#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
best wishes
Skids

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6477
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Functional programming ?

Post by richmond62 » Thu Nov 18, 2021 5:59 pm

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]

Klaus
Posts: 12591
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Functional programming ?

Post by Klaus » Thu Nov 18, 2021 6:16 pm

I read the german Wikipedia entry for this and now:
monty.jpg

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8901
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Functional programming ?

Post by FourthWorld » Thu Nov 18, 2021 7:35 pm

Which is best?:
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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6477
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Functional programming ?

Post by richmond62 » Thu Nov 18, 2021 7:39 pm

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.

Klaus
Posts: 12591
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Functional programming ?

Post by Klaus » Thu Nov 18, 2021 7:53 pm

FourthWorld wrote:
Thu Nov 18, 2021 7:35 pm
Which is best?:
a) Model-View-Controller
b) Model-View-Presenter
c) Shipping an app
Yes! Definitively! :D

jiml
Posts: 281
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Functional programming ?

Post by jiml » Mon Nov 22, 2021 11:19 pm

Which is best?:
a) Model-View-Controller
b) Model-View-Presenter
c) Shipping an app
😂😂😂😂😂

Simon Knight
Posts: 661
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Functional programming ?

Post by Simon Knight » Tue Nov 23, 2021 8:49 am

a) Model-View-Controller
b) Model-View-Presenter
:?: :?: :shock: :?: :?:

Two people who work for a TV show about Airfix perhaps
best wishes
Skids

Post Reply

Return to “Off-Topic”