OCamel, Oh what?

Started by
122 comments, last by GameDev.net 18 years ago
Quote:Original post by SamLowry
Code can only be compared based on what it actually does, not on what it can potentially do. If you think otherwise, I present you with my own challenge:

(setf fruit '(apples oranges pears bananas))(format T "~{~A~%~}" fruit)

This Common Lisp code prints the names of the fruits, one per line. I ask of you to write me a C++ version of this.

Lisp is truly king :)


Lisp is fundamentally flawed. For example, the compiler fails to pick up on the following type error:

(setf fruit '(apples oranges pears women))


Cheers,
Jon.
Advertisement
Quote:Original post by jdh30
Quote:Original post by SamLowry
Code can only be compared based on what it actually does, not on what it can potentially do. If you think otherwise, I present you with my own challenge:

(setf fruit '(apples oranges pears bananas))(format T "~{~A~%~}" fruit)

This Common Lisp code prints the names of the fruits, one per line. I ask of you to write me a C++ version of this.

Lisp is truly king :)


Lisp is fundamentally flawed. For example, the compiler fails to pick up on the following type error:

(setf fruit '(apples oranges pears women))


Cheers,
Jon.

I disagree. A woman can be the apple of my eye, shaped like a pear or..... well that one I can't say because of the kids [grin]

Beginner in Game Development?  Read here. And read here.

 

Quote:Original post by jdh30
Quote:Original post by SamLowry
Code can only be compared based on what it actually does, not on what it can potentially do. If you think otherwise, I present you with my own challenge:

(setf fruit '(apples oranges pears bananas))(format T "~{~A~%~}" fruit)

This Common Lisp code prints the names of the fruits, one per line. I ask of you to write me a C++ version of this.

Lisp is truly king :)


Lisp is fundamentally flawed. For example, the compiler fails to pick up on the following type error:

(setf fruit '(apples oranges pears women))


Cheers,
Jon.


That's why I have developed this safer version of setf which has saved me countless times already:
(defmacro safe-setf (x y)  (if      (and       (eq 'fruit x)       (member 'women (cadr y)))      (error "Fruity type error! Only ripened ovaries of seed-bearing plants allowed in list")    `(setf ,x ,y)))


Anyway, it was certainly not my intention to start promoting Lisp in this thread (that would be Tron3k's or mr. Baum's job).
Quote:Original post by SamLowry
That's why I have developed this safer version of setf which has saved me countless times already:

(defmacro safe-setf (x y)
(if
(and
(eq 'fruit x)
(member 'women (cadr y)))
(error "Fruity type error! Only ripened ovaries of seed-bearing plants allowed in list")
`(setf ,x ,y)))


Anyway, it was certainly not my intention to start promoting Lisp in this thread (that would be Tron3k's or mr. Baum's job).


It's still no good though. You have no guarantee that your executing program is going to suddenly come across an error and break. Seeing as most popular languages allow you to avoid this case at compile-time, Lisp is at a severe disadvantage.

- Ben

This topic is closed to new replies.

Advertisement