Originally posted by AtW
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Functional Programming Languages
Collapse
X
-
-
An "Imminent News Placeholder" - Shirley!Originally posted by TimberWolf View PostWhat are your plans for SKA in 2100?Comment
-
Your whining about XSLT was based on your failure to understand how to use it as a declarative language (along with a failure to grasp that XML requires proper nesting of start and end tags).Originally posted by AtW View PostWhoever named them "functional" is a retard or it's a sick joke - just search for my ranks in Technical, look for XSLT / XPATH keyrods
JavaScript has been in active use as a functional language since 1996, and is one of the most widely-used languages in the world today, so it's a bit late to be talking about them as the next big thing.Comment
-
I don't have problems with JavaScript - it is certainly NOT a functional language of the likes of Lisp/XSLT and thank God for that!Originally posted by NickFitz View PostJavaScript has been in active use as a functional language
XSLT (and anything like it) was designed by people either high up in academia or high on drugs, most likely both - you can't fking use "variable" keyword to define a constant that can't change value, it's not a fking variable!
Comment
-
You will learn about them in the fullness of time.Originally posted by TimberWolf View PostWhat are your plans for SKA in 2100?Comment
-
It's a variable in a mathematical sense. You can change the value of a variable (to be more precise, you can shadow a variable by creating a new binding over a value in the current scope). For example, the following stylesheet:Originally posted by AtW View PostXSLT (and anything like it) was designed by people either high up in academia or high on drugs, most likely both - you can't fking use "variable" keyword to define a constant that can't change value, it's not a fking variable!
given the following input:Code:<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:variable name="currentValue">No value</xsl:variable> <xsl:template match="values"> <xsl:text>Global value of $currentValue is </xsl:text> <xsl:value-of select="$currentValue"/> <xsl:text> </xsl:text> <xsl:apply-templates select="value"/> </xsl:template> <xsl:template match="value"> <xsl:variable name="currentValue" select="text()"/> <xsl:text>Current value of $currentValue is </xsl:text> <xsl:value-of select="$currentValue"/> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>
will produce the following output:Code:<?xml version="1.0" encoding="UTF-8"?> <values> <value>Foo</value> <value>Bar</value> <value>AtW</value> </values>
As I always say to people who struggle because they attempt to apply imperative programming techniques to declarative languages: work with the grain, not against it. It's a different paradigm. Most of the things you know from the world of imperative languages are specific to that world, and won't help you.Code:Global value of $currentValue is No value Current value of $currentValue is Foo Current value of $currentValue is Bar Current value of $currentValue is AtW
Some people even think <xsl:for-each> is a looping construct, FFS
Comment
-
And it isn't?Originally posted by NickFitz View PostSome people even think <xsl:for-each> is a looping construct, FFS

All I wanted to do with this tulipy XSLT is to loop through some data and do some aggregations!
And don't give me that XPath tulip about doing sums in calls - that wasn't working in .NET - the whole thing is a load of tosh!
Comment
-
Originally posted by NickFitz View PostIt's a variable in a mathematical sense.
I don't a problem with some crackpot PhDs wasting their grants on developing some crackpot ideas - that's fine by me. It's also fine by me to have "programming" language of the kind they developed.
What's not ****ing fine is the words they've chosen to describe it, specifically "functional" - I could ****ing do simple tasks with it, just how ****ing functional is that?!?!
Those "variables" also named in such a way that I feel the urge to lodge a complaints to Advertising Standards Authority as I feel been grossly mislead!
Comment
-
But if you want your code to parallelize easily, your going to have to get with the crackpot PhD stuff.
Insanity: repeating the same actions, but expecting different results.
threadeds website, and here's my blog.
Comment
-
Of course not. Looping allows side effects, and side effects cause bugs.Originally posted by AtW View PostAnd it isn't?
All I wanted to do with this tulipy XSLT is to loop through some data and do some aggregations!
And don't give me that XPath tulip about doing sums in calls - that wasn't working in .NET - the whole thing is a load of tosh!
Surely <xsl:value-of select="sum(element/@value)"/> isn't that hard? Look, like this stylesheet:
applied to this input:Code:<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="elements"> <xsl:text>Sum of element values is </xsl:text> <xsl:value-of select="sum(element/@value)"/> </xsl:template> </xsl:stylesheet>
giving this output:Code:<?xml version="1.0" encoding="UTF-8"?> <elements> <element value="1"/> <element value="2"/> <element value="3"/> <element value="4"/> <element value="5"/> <element value="6"/> </elements>
See, it's easyCode:Sum of element values is 21
Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Comment