Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1..1000] takes a long time. #857

Closed
kmarekspartz opened this issue Feb 5, 2014 · 6 comments
Closed

[1..1000] takes a long time. #857

kmarekspartz opened this issue Feb 5, 2014 · 6 comments

Comments

@kmarekspartz
Copy link

It looks like using Nats in enumFromTo is slowing things down. Is there a way to speed this up without losing simplicity and reasonability?

@david-christiansen
Copy link
Contributor

It's possible that they are slowing things down. The present implementation
was written with an eye towards making the syntax work in proofs, so it
uses Nats in order to make it obviously total.

Why on earth would you want to write [1..1000] in a strict language though?
This strikes me as a somewhat unimportant use case, but I could be missing
something obvious.

@LeifW
Copy link
Contributor

LeifW commented Feb 6, 2014

And, to be clear: are you talking about the REPL or compiled code here? The repl takes many orders of magnitude longer on stuff like this.

@kmarekspartz
Copy link
Author

Sorry, I was trying out the REPL.

Here's my use case:

sum $ map (\x => x * x) [1..1000]

It shouldn't matter whether it is lazy or strict, as other languages, both lazy and strict handle it fine.

I do understand that it presently makes the proofs work well, and that optimization comes later.

@david-christiansen
Copy link
Contributor

@raichoo just rewrote this to be tail-recursive - it still goes slowly for me, so I imagine that tail recursion isn't a big win in the REPL evaluator.

I'm wondering if this is reasonably solvable in a way other than documentation...

@jfdm
Copy link
Contributor

jfdm commented May 22, 2015

This looks like it is related to Issue #172

@ahmadsalim
Copy link

I think this is a duplicate of #172 as @jfdm mentioned, so I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants