Henning Thielemann wrote:
On Mon, 4 Sep 2006, Brian Hulley wrote:
    -- So related things appear alphabetically together...
   empty? :: Set a -> Bool
   empty :: Set a

I think the separation of alpha-numeric characters and other symbols
simplifies things, and shall be preserved.

In Mathematica 'is' functions are denoted by trailing 'Q' for
'Query'. May this be an option?

Or possibly 'P' for 'Predicate', since the Q suffix is already used by Template Haskell though of course it's possible to use Q Exp instead of ExpQ in that case, and in fact I'm slightly mystified why Template Haskell defines type synonyms like:

   type ExpQ = Q Exp

when all this does is to force the reader of code, on encountering the identifier (ExpQ), to have to look for it's definition, when (Q Exp) would give the definition immediately inline at the "bargain price" of one space character, and the latter would also fit with the preference for writing (IO Int) as opposed to defining a type synonym to get (IntIO).

Though an advantage of 'Q' instead of 'P' for predicates would be that 'P' could then be used to mark partial versions of functions eg:

   viewL :: Monad m => [a] -> m (a, [a])
   viewLP :: [a] -> (a, [a]) -- when we already know the list is non-empty

   head tail        -- funny cartoon-like image of a list

   atL atLs        -- similar to (x:xs)

I may mix atLs up with today's 'init', because it sounds like "many
elements beginning from the left".

I see what you mean. The problem seems to be that the rest of the left view of a list is that portion of the list which lies to the right (!) so there is a conflict between using the 'L' suffix to mean "this operation refers to the left view" versus "this operation returns element(s) which are on the left".

With:

       viewLP :: [a] -> (a, [a])
       viewRP :: [a] -> ([a], a)

we could use (fst . viewLP) which suggests alternatives to head, tail, last, init eg (viewLPL) to mean "the left part of the partially defined left view" ie (head).

I think it is a question of individual psychology whether the name (viewRPL) is more difficult or easier to understand/remember than (init) - it might be a mistake to expect a consensus to emerge here. Maybe both methodical and "folklore" names could exist simultaneously in such cases.

Best regards, Brian.
--
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.

http://www.metamilk.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to