Page 1 of 1

Example sourcecode for a speech

Posted: Tue Dec 27, 2011 7:42 am
by veloursnebel
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:

Image

That would help me so much. Thank you in advance!

Re: Example sourcecode for a speech

Posted: Tue Dec 27, 2011 4:18 pm
by danb
If you're giving a speech on functional programming, why don't you present examples of functional code?

Re: Example sourcecode for a speech

Posted: Wed Dec 28, 2011 5:01 am
by veloursnebel
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.

Re: Example sourcecode for a speech

Posted: Mon Jan 02, 2012 2:00 pm
by veloursnebel
Is there anyone who can help me?

Re: Example sourcecode for a speech

Posted: Mon Jan 02, 2012 6:26 pm
by nuntius
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.

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)))))
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).