POV-Ray : Newsgroups : povray.off-topic : Questionable reasoning : Re: Questionable reasoning Server Time
6 Sep 2024 11:20:35 EDT (-0400)
  Re: Questionable reasoning  
From: Orchid XP v8
Date: 15 Jan 2009 17:26:57
Message: <496fb831@news.povray.org>
Darren New wrote:
> Orchid XP v8 wrote:
>> #25. "It pays attention to details." I can't even determine what the 
>> hell he's talking about here...
> 
> I can give you examples of what "paying attention to details" means. 
> Dunno if it's the sort of thing this guy's talking about, but...
> 
> Remember a decade ago, when people were making scripting languages 
> implemented in C?  Lots of those languages had strings that were, 
> internally, null-terminated. But since they were also GCed, you didn't 
> get the memcpy/memset sorts of functions, only the strcpy sorts of 
> functions, so you couldn't actually work with binary data in a string.
> 
> And then they'd have stuff where a string literal starting with a zero 
> is octal. And someone would read a string from a form or the keyboard or 
> whatever that's supposed to be a postal (zip) code, and the user would 
> type 09375, and the program would barf, because 9 isn't a valid octal 
> digit. Using a leading 0 to always mean "octal" only works if you have 
> source code compiled separately from the user input.
> 
> Working around this sort of lamebrainness is necessary if the language 
> designers don't pay attention to detail. (These are both examples from 
> Tcl, incidentally. :-)

Um... ouch! o_O

> Aren't there lots of functions that have the same signature?  I mean, 
> what's it going to write for
>   f :: [a] -> (a -> Bool) -> [a]

Logically speaking, given a function and a list, you can either do any 
of the following:

- Throw an exception. (And function with any type signature can do that!)
- Ignore the arguments and return an empty list.
- Ignore the function and return the input list.
- Rearrange the elements of the list and return that.
- Apply the function to the list in some way to decide which elements to 
return.

Actually, both "filter", "takeWhile" and "dropWhile" have almost exactly 
the type signature above, and they do different jobs. (One filters on 
the condition, the others filter "runs" of elements matching it [or not].)

>> - We didn't invent algebraic datatypes. Those existed for decades 
>> before us. (Although they're fairly rare in real programming languages.)
> 
> Do you actually have algebraic datatypes in Haskell? Kewl.

Um... yes?

   data Either x y = Left x | Right y

There you go. That's a sum type of product types, i.e. an algebraic data 
type. (ADT - not to be confused with *abstract* data type...)

>> - There's no IDE for Haskell, but "I don't think an IDE is really 
>> necessary". Well *sure* you don't. Because you haven't got one yet! :-P
> 
> Heh. Funny how that works, isn't it?

Much like the "Haskell doesn't need a debugger because programs work 
correctly first time". Until we got a debugger... and now it's "hey, we 
have a debugger!"

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.