SWP-Ubau-SoSe2014-Haskell / SWPSoSe14

Rail compiler written in Haskell
MIT License
3 stars 1 forks source link

Rail specs: is lambda a string or a list? #164

Closed cpockrandt closed 10 years ago

cpockrandt commented 10 years ago

I have a question regarding the rail specs and the types of stack elements on the stack:

Esolang wiki says:

is_bool(n) ==> is_numeric(n) ==> is_string(n)
is_nil(n) ==> is_list(n)
is_list(n) <==> ~(is_string(n))

And we have a typecheck function ?: Returns 'string' or 'nil' or 'list' or 'lambda', depending on the type of the argument.

Since n is a list if and only if n is not a string, what the hell is lambda? Is it a list or a string? According to the definition it has to be exactly one of them. I'm so confused. Can someone please help me? :)

Tblue commented 10 years ago

lambda is its own type, an anonymous function. It's neither a list nor a string. See http://esolangs.org/wiki/Talk:Rail#Lambda.3F.

cpockrandt commented 10 years ago

That's what I thougt as well. So you agree that there is a contradiction in the specification? Because the specification only allows lists and strings to be on the stack.

Tblue commented 10 years ago

Yes, I would say that the specification is outdated then. Lambdas appear to be a pretty obscure (or new?) feature - they are only explained in detail on the discussion page of the Rail page in the Esolang wiki - so that's probably why the specification contains that contradiction.

On 9. Juli 2014 18:28:02 MESZ, cpockrandt notifications@github.com wrote:

That's what I thougt as well. So you agree that there is a contradiction in the specification? Because the specification only allows lists and strings to be on the stack.


Reply to this email directly or view it on GitHub: https://github.com/SWP-Ubau-SoSe2014-Haskell/SWPSoSe14/issues/164#issuecomment-48498713

lusy commented 10 years ago

I vote, we document this insight in the wiki: https://github.com/SWP-Ubau-SoSe2014-Haskell/SWPSoSe14/wiki/Specs-Rail, close this ticket and open new ones which handle lambdas. We need to be able to have lambdas as stack element, so (anonymous) functions should be allowed as a type. Typechecking should also be able to cope with lambdas. Do you figure, we'd be able to implement all this?