CodingFunctional programming

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  ALL
34064.1 

FP is awesome. C# 3.0 does bits of it really well, but I've downloaded F# to play with as well.

 

There's stuff like, if you've got a function that takes an argument and returns a value, and it takes a while to do it, you can magically create a new function that caches the result for each passed parameter and then returns from the cache where available. Or you can create a class which takes a function as the argument to its constructor, and makes that function execute asynchronously following the new pattern from .NET 3.5.

 

Seriously, it's awesome.


Dance like it hurts; Love like you need the money; Work when people are watching.
0/0
 Reply   Quote More 

 From:  Matt  
 To:  THERE IS NO GOD BUT (RENDLE)     
34064.2 In reply to 34064.1 
AKA Head fuck free threading?

doohicky

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  THERE IS NO GOD BUT (RENDLE)     
34064.3 In reply to 34064.1 
I tried to read some stuff about it but didn't manage to understand properly. :?

Magic caching sounds useful, but doesn't seem groundbreaking.

Don't get what do you mean by the bit "following the new pattern from .NET 3.5."?
0/0
 Reply   Quote More 

 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  Peter (BOUGHTONP)     
34064.4 In reply to 34064.3 

Yeah, the caching's not particularly ground-breaking, but the ease with which you can implement it is, especially when you realise that you don't need to have written the function you want to add caching to. You write one 15-line function, then you call it on any function you want to use caching and that's it. And you can only do that because you can treat functions as a kind of variable/class arrangement.

 

Prior to .NET 3.5, the asynchronous implementations of methods were prepended with Begin and End, so you'd have a Fetch function, plus a BeginFetch and an EndFetch. You got a specific return type from the Begin, then you'd call the End to get the actual return value.

 

In .NET 3.5, you have an implementation of the method ending in Async, plus an event which fires when it finishes executing that passes the return value (or the exception that occurred) in the event arguments. So you'd have FetchAsync and a FetchCompleted event.

 

So I've made a class where you pass in a function delegate (i.e. pointer) to the constructor, and it has a Completed event and an Invoke method and does basically the same thing but on any method.

 

Matt: once you get your mind round the basic concept, it's head-fuck free.


Dance like it hurts; Love like you need the money; Work when people are watching.
0/0
 Reply   Quote More 

 From:  Rowan  
 To:  THERE IS NO GOD BUT (RENDLE)     
34064.5 In reply to 34064.1 
That doesn't really sound like functional programming, really. Just having first-class functions. And delegates didn't seem very far off that anyway. Ho hum. I doubt I'll be allowed to use .NET 3 for anything at work for several few years yet to come anyway.
0/0
 Reply   Quote More 

 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  Rowan     
34064.6 In reply to 34064.5 

It's not proper functional programming in the Haskell or CaML sense, no, because you've got mutable variables and stuff. Mostly it is just having first-class functions, and yes, that's done through delegates and generics which we had in C# 2.0, but the 3.0 compiler has got type inference and lambda syntax and pre-defined Action<T> and Func<T,TReturn> delegate classes and stuff which just make it all much easier to deal with.

 

For example, you use to have to say

 

list.Find(delegate(string s){ return s.StartsWith("A"); }

 

whereas now you can say

 

list.Find(s => s.StartsWith("A"));

 

which is much more readable.

 

Plus, using lambda expressions instead of delegates changes the way you think about them, makes them seem more like variables and things you can throw around the place and store in hash tables and so forth.


Dance like it hurts; Love like you need the money; Work when people are watching.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Mouse     
34064.7 In reply to 34064.6 
What is your opinion on all this?

0/0
 Reply   Quote More 

 From:  Mouse  
 To:  Drew (X3N0PH0N)     
34064.8 In reply to 34064.7 
I enjoy reading these threads and not knowing what is being said in any manner what-so-ever. I have no idea why.

Edit: Sorry, how rude. What's your opinion

Which of the following would you most prefer?
A: a puppy,
B: a pretty flower from your sweety, or
C: a large properly formatted data file?
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Mouse     
34064.9 In reply to 34064.8 

I enjoy them similarly. I have no idea what anyone is on about but like to hear their opinions anyway.

 

Anyway, I wanted you to make up some plausible sounding nonsense.


0/0
 Reply   Quote More 

 From:  Mouse  
 To:  Drew (X3N0PH0N)     
34064.10 In reply to 34064.1 

Well I'm not convinced that the value functioning flops are really worth the VB they are written on.

 

I mean, ffs, if you're going to do class D sector mounting you might as well do it with an argument contructing delimitted F Class module.

 

And what's all this nonsense with C# 3.0 obstructing your quads? You might as well shoot a monkey in a barrel as far as I'm concerned.

 

:?


Which of the following would you most prefer?
A: a puppy,
B: a pretty flower from your sweety, or
C: a large properly formatted data file?
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Mouse     
34064.11 In reply to 34064.10 
Monkey in a barrel is an apt comparison. The practise of de-quantifying 3rd order quasi-infered concave proto-skaves to achieve boydian wholeness in semantic offload is, imo, folly.

0/0
 Reply   Quote More 

 From:  Mouse  
 To:  Drew (X3N0PH0N)     
34064.12 In reply to 34064.11 
You know what they say, 'If you've got a hat on your head, make sure it's not filled with beef''.

Which of the following would you most prefer?
A: a puppy,
B: a pretty flower from your sweety, or
C: a large properly formatted data file?
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Mouse     
34064.13 In reply to 34064.12 
And "don't put bees in your cranium".

0/0
 Reply   Quote More 

 From:  koswix  
 To:  Drew (X3N0PH0N)     
34064.14 In reply to 34064.13 
COVERED IN BEES!


The noises commonly associated with flatulence are caused by the vibration of the anal sphincter, and not by the buttocks. The sound varies depending on the tightness of the sphincter muscle and velocity of the gas being propelled, as well as other factors such as water and body fat. The auditory pitch (sound) of the flatulence outburst can also be affected by the anal embouchure.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  koswix     
34064.15 In reply to 34064.14 
Could not connect to remote server :'S

0/0
 Reply   Quote More 

 From:  koswix  
 To:  Drew (X3N0PH0N)     
34064.16 In reply to 34064.15 
I just clicked the link again and our proxy thing blocked it going "OMEGA SPYWAYREERE!!!""!"ELEVN

:$

COVERED IN BEES (MKII)!


The noises commonly associated with flatulence are caused by the vibration of the anal sphincter, and not by the buttocks. The sound varies depending on the tightness of the sphincter muscle and velocity of the gas being propelled, as well as other factors such as water and body fat. The auditory pitch (sound) of the flatulence outburst can also be affected by the anal embouchure.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  koswix     
34064.17 In reply to 34064.16 

Hahahahaha. Bees transported by truck :')

 

Things you never think about.

 

They should train them to fly there like pigeons.


0/0
 Reply   Quote More 

 From:  koswix  
 To:  Drew (X3N0PH0N)     
34064.18 In reply to 34064.17 

They should let them fly on aeroplanes for long distances. They could go buzzness class :D

 

Also, I love that there just happened to be(e) some bee keepers passing at the time to help out :D



The noises commonly associated with flatulence are caused by the vibration of the anal sphincter, and not by the buttocks. The sound varies depending on the tightness of the sphincter muscle and velocity of the gas being propelled, as well as other factors such as water and body fat. The auditory pitch (sound) of the flatulence outburst can also be affected by the anal embouchure.
0/0
 Reply   Quote More 

 From:  Mouse  
 To:  Drew (X3N0PH0N)     
34064.19 In reply to 34064.17 

If all the bees flew upwards while in a container on the truck it would increase decrease increase the MPG of said truck. /That's/ thinking local, acting global Al Gore.

 

:Y

Edit: :$

Which of the following would you most prefer?
A: a puppy,
B: a pretty flower from your sweety, or
C: a large properly formatted data file?
0/0
 Reply   Quote More 

 From:  koswix  
 To:  ALL
34064.20 

I'm having trouble visualising what 12 million bees would be like.

 

I can't beleive they had chance bee-keepers passing by, but no one had a camera :C



The noises commonly associated with flatulence are caused by the vibration of the anal sphincter, and not by the buttocks. The sound varies depending on the tightness of the sphincter muscle and velocity of the gas being propelled, as well as other factors such as water and body fat. The auditory pitch (sound) of the flatulence outburst can also be affected by the anal embouchure.
0/0
 Reply   Quote More 

Reply to All  
 

1–20  21–30

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats