map trim command on list members

Started by vetelko, October 19, 2016, 02:46:56 AM

Previous topic - Next topic

vetelko

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:
("." "." ".")
newLISP v.10.7.6 64-bit on BSD IPv4/6 UTF-8 libffi

rrq

#1
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.