Re: More questions
More questions along the same lines as for n+k: Does == in the pattern match translation refer to == in PreludeCore? Does negate in the translation of -e refer to negate in PreludeCore? All identifiers used in explicit translations refer to those from the Prelude. Kevin
Re: n+k patterns
You are quite right. I'd forgotten about local rebinding, because I feel that all local rebinding should be disallowed. Anyone want to start a movement to eliminate local rebinding? (1/2 :-) Cheers, -- P - Begin Included Message - From [EMAIL PROTECTED] Tue May 18 14:56:37 1993 Date: Tue, 18 May 93 15:55:42 +0200 From: Lennart Augustsson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: n+k patterns Both (=) and (-) belong to classes defined in PreludeCore, and hence cannot be rebound. This was a deliberate decision, made in order to turn your point into a non-problem. It's true that things from PreludeCore cannot be rebound on the top level, but they can be rebound locally. So the problem I state does occur. OK, I think that (=), (-), etc. should refer to those from PreludeCore, but it doesn't say anywhere. Another question along the same lines: What if (+) has been rebound? Are n+k patterns still allowed? -- Lennart - End Included Message -
Re: n+k patterns
I like the capability to redefine syntax. For example, I would like to be able to define syntax that looks like EBNF when writing parsers. I would like to be able to write E = T {(`+`|`-`) T} rather than e = concat1 (t,zeroOrMore (concat2 (alternative (lit '+',lit '-'),t))) Of course infix operators help, but what about nice multiple token symbols like { } ? So, minimally, I am in favor of the local redefinition of symbols like '+' and '=', and think it unfortunate that there is a clash between the redefinition and treatment of n+k patterns. This is a vote for dumping n+k patterns, and a wish for more flexible syntax not hampered by special cases. Ken
n+k patterns
Phil Wadler says: You are quite right. I'd forgotten about local rebinding, because I feel that all local rebinding should be disallowed. Anyone want to start a movement to eliminate local rebinding? (1/2 :-) Cheers, -- P And *I* think we should stop using names altogether and program in terms of SKI combinators! Since these constructs have well-known, unchanging meanings there is little chance that a program will be misunderstood*. I don't know about the rest of the people reading this, but I find the notation S(S(S(KS)K))((S(S(KS)K))(KI)) = (S(S(KS)K))(S(S(KS)K))(KI) to be much more precise than the n+k equivalent, 1 + 1 = 2. The similarity of the latter notation to the informal numerals of everyday life is an open invitation to sloppy reasoning leading to widespread program bugs. Besides, anybody who can't handle needless complexity shouldn't be fooling around with dangerous machines such as computers. -- Dan Rabin ([EMAIL PROTECTED]) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) *in fact, there is little chance that a program will be understood, period.
Re: n+k patterns
Both (=) and (-) belong to classes defined in PreludeCore, and hence cannot be rebound. This was a deliberate decision, made in order to turn your point into a non-problem. Long live (n+k)! -- P - Begin Included Message - From [EMAIL PROTECTED] Mon May 17 21:33:41 1993 From: Lennart Augustsson [EMAIL PROTECTED] Subject: n+k patterns Date: Mon, 17 May 93 22:25:03 +0200 To: [EMAIL PROTECTED] Could those in charge of the formal semantics of Haskell (yes, that's you folks in Glasgow!) tell me what the meaning of n+k patterns are? In the report it says that case e0 of { x+k - e; _ - e' } translates to if e0 = k then { let { x' = e0-k } in e[x'/x] else e' Which = and - does this refer to? What if they have been locally rebound? E.g. let x - y = x ++ f y where f 0 = [] f (n+1) = f n in [] - 0 Does the translated - still refer to the method in PreludeCore or to the - in scope? -- Lennart PS. I'd like to start the "Ban n+k patterns"-movement, any followers? - End Included Message -
Re: n+k patterns
Both (=) and (-) belong to classes defined in PreludeCore, and hence cannot be rebound. This was a deliberate decision, made in order to turn your point into a non-problem. It's true that things from PreludeCore cannot be rebound on the top level, but they can be rebound locally. So the problem I state does occur. OK, I think that (=), (-), etc. should refer to those from PreludeCore, but it doesn't say anywhere. Another question along the same lines: What if (+) has been rebound? Are n+k patterns still allowed? -- Lennart
Re: n+k patterns
|Another question along the same lines: What if (+) has been rebound? |Are n+k patterns still allowed? | |-- Lennart The answer should be that n+k patterns are still allowed, but (+), (-), and (=) from PreludeCore are used in the translation. --Joe