Hello,
hope you all had a great christmas time.
For a speech about C# and the functional Style of Linq, I would like to start with a little bit of the funktional programming history and - of course - about Lisp. And that is my problem. I'm not handy with lisp. Could anyone write a little piece of code according to this functions:
That would help me so much. Thank you in advance!
Example sourcecode for a speech
Re: Example sourcecode for a speech
If you're giving a speech on functional programming, why don't you present examples of functional code?
--Dan B.
-
- Posts: 3
- Joined: Tue Dec 27, 2011 7:36 am
Re: Example sourcecode for a speech
Hi Dan,
The speech is about .NET Development and especially Linq. Linq itself was influenced by functional languages and I will only show a little bit example code of a full functional language.
The speech is about .NET Development and especially Linq. Linq itself was influenced by functional languages and I will only show a little bit example code of a full functional language.
-
- Posts: 3
- Joined: Tue Dec 27, 2011 7:36 am
Re: Example sourcecode for a speech
Is there anyone who can help me?
Re: Example sourcecode for a speech
Side note: Please type the expression in here next time. Much preferable to an image hosted (temporarily) on another site...
I can't even understand what you're asking for. The image contains three rows, all of the form "DEF area X" where X is a mathematical expression. Is the first row supposed to be "DEF a = \frac{a^2}{4}\sqrt{3}"?
If so, these might be your lisp expressions.
I have no idea how these show any useful attributes of a functional language or of lisp. They don't use first-class functions, macros, etc. Most people aren't drawn to the appearance of the consistent prefix notation; but many are sold on how it simplifies macros (functions that manipulate other code).
I can't even understand what you're asking for. The image contains three rows, all of the form "DEF area X" where X is a mathematical expression. Is the first row supposed to be "DEF a = \frac{a^2}{4}\sqrt{3}"?
If so, these might be your lisp expressions.
Code: Select all
(defun area-1 (a)
(/ (* a a (sqrt 3)
4))
(defun area-2 (a b)
(/ (* a b) 2))
(defun area-3 (a b c)
(let ((s (/ (+ a b c) 2)))
(sqrt (* s (- s a) (- s b) (- s c)))))