Tuesday, February 18, 2014

Re: magnum.vim - Pure Vim script big integer library

Marc,

On Tuesday, February 18, 2014 10:00:22 PM UTC+1, MarcWeber wrote:
> Feedback about the plugin:
> ============================================
> + written nicely (api, code, ..), with test suite ! (great)
>
> + works correctly (I've run maybe 2400 additional tests, 200 random runs
> for each method)
> (generating the test cases takes about 0.02 secs, running them takes
> about 6 secs (core-i5)
> (Code generating test code : http://dpaste.com/1634959/)
>
> + unique selling point (base conversions possible) could be emphasized in README
> This could also be of interest to other plugin writers.

Thanks a lot for giving it a spin and for the feedback. Making
magnum.vim was a learning experience, but I'm hopeful that others might
find some use in it. It is obviously no competition for Python.

> - false statement ? (found in wiki):
>
> =========== claim:
> Given some UNIX timestamps, determine the average. This is something you can't do with Vim numbers.
>
> let times = [
> \ 1390938148,
> \ 1390759759,
> \ 1391028429,
> \ 1390992724,
> \ 1391100465,
> \ ]
> [...]
> ===============
>
> Why can't I do this with vim?

I was a little ambiguous here. By 'Vim numbers' I meant Vim's integer
data type, which is signed int32 at the moment (see also
':h expr-number'). I agree, floats open up a whole new world of
precision.

> ...
>
> " cannot use it inside a function !??
> let s:zero = magnum#ZERO
>
> ...

I stumbled over this myself, it's a quirk of variable scoping in Vim.
See the note at the bottom of magnum.txt:

Note that due to the way in which variable scoping works in Vim,
you must qualify these variables with |g:| when using them
inside a function.

Thanks for the Haskell snippet, I'll enjoy reading it later.


--
David

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment