lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Bo,
I was using 1.001 version and still get error:

lua: lua-functional.lua:272: attempt to call local 'iter' (a number value)
stack traceback:
	lua-functional.lua:272: in function <lua-functional.lua:267>
	(tail call): ?
	lua-functional-fact.lua:10: in main chunk
	[C]: ?
>Exit code: 1

Regards
   Andrew

On Fri, Sep 30, 2011 at 1:29 PM, Bo Waggoner <luafunctional@gmail.com> wrote:
> Hi, so, I actually found this bug with version 1.0, and had just fixed it
> and updated to version 1.001 before sending out the email. With the current
> files in the repository, the test runs fine on my system. Could you let me
> know if that's the problem? Thanks for getting back to me!!
> Thanks also for the reply, Javier! I have no experience with modules, so I
> love how, in Lua, "it just works."
> Bo
>
> On Fri, Sep 30, 2011 at 12:19 PM, Andrew Wilson <agrwagrw@gmail.com> wrote:
>>
>> In sample code provided something seems wrong with sum function?
>>
>> > lfunc = dofile('lua-functional.lua')  -- load all functions into the
>> > table
>> > lfunc
>> > lfunc.loadglobally(lfunc)  -- now all functions are in the global
>> > namespace
>> > -- first line generates a list of fibonnacci numbers below 100
>> > fibs = gent({1,2}, function(t,ind) return t[ind-1]+t[ind-2] end,
>> > function(t,ind) return geq(ind,100) end)
>> > odd = compose(apply(eq,1),applyn(mod,2,2))
>> > list = listcomp(function(x) return x*x end, fibs, odd)
>> > sum = apply(foldl1,add)
>>
>> lua: lua-functional.lua:273: attempt to call local 'iter' (a number value)
>> stack traceback:
>>        lua-functional.lua:273: in function <lua-functional.lua:267>
>>        (tail call): ?
>>        lua-functional-fact.lua:10: in main chunk
>>        [C]: ?
>> >Exit code: 1
>>
>>
>>
>> On Fri, Sep 30, 2011 at 11:27 AM, Bo Waggoner <luafunctional@gmail.com>
>> wrote:
>> > Hi all, this is my first time posting to the mailing list!
>> > I've created and posted a functional programming library, which you can
>> > download here:
>> > https://bitbucket.org/luafunctional/lua-functional
>> > This was mainly just something I did for fun and because I really enjoy
>> > both
>> > FP and Lua, and I hope it might be useful! I know there are some other
>> > similar resources, so here's some of the attributes of this one:
>> > Pros:
>> > -pretty big set of functions: map, zips, folds, filters, list
>> > comprehension,
>> > ranges, currying, scans, and mini helper functions.
>> > -documentation
>> > -somewhat well tested (has a test suite)
>> > -"plug and play" (see example below) -- not a module (or maybe this is a
>> > con?)
>> > Cons:
>> > -performance not benchmarked/known
>> > I would love any feedback! The source is completely free, so it would be
>> > great if anyone wants to incorporate these functions or the library into
>> > a
>> > different project or library as well.
>> > Here's an example (sum the squares of the odd fibonnacci numbers under
>> > 100):
>> > lfunc = dofile('lua-functional.lua')  -- load all functions into the
>> > table
>> > lfunc
>> > lfunc.loadglobally(lfunc)  -- now all functions are in the global
>> > namespace
>> > -- first line generates a list of fibonnacci numbers below 100
>> > fibs = gent({1,2}, function(t,ind) return t[ind-1]+t[ind-2] end,
>> > function(t,ind) return geq(ind,100) end)
>> > odd = compose(apply(eq,1),applyn(mod,2,2))
>> > list = listcomp(function(x) return x*x end, fibs, odd)
>> > sum = apply(foldl1,add)
>> > print(sum(list))
>> >
>> > Thanks everyone! Again, feedback would be awesome!
>> > Bo
>>
>
>