newLISP Fan Club

Forum => newLISP in the real world => Topic started by: vetelko on October 19, 2016, 02:46:56 AM

Title: map trim command on list members
Post by: vetelko on October 19, 2016, 02:46:56 AM
Hi guys,



how can I map trim command to list members?

say I have list like this:
(set 'lst '("a." "b " "c"))
and I want to trim dot character trying this construct:
(set 'lst2 (map (curry trim {.}) lst))
but it doesn't work, output is:
("." "." ".")
Title: Re: map trim command on list members
Post by: rrq on October 19, 2016, 03:43:22 AM
If you try it out by hand, as in > (curry trim ".")
(lambda ($x) (trim "." $x))
you see that the curried function is not exactly what you want.

You rather need to use a function like (fn ($x) (trim $x ".")) instead; there's no abbreviation macro for that order of arguments.