0

In order to create a .map function and do it the way Less allows it, recursively, I do need to separate the head of the list from the tail.

.map would obviously have to take three things; @list, @function and @args...

Is there any way I can do that?

Maciej Sitko
  • 416
  • 3
  • 13
  • I don't think you can mimic the `map()` function as is with Less because the map function typically outputs another array. As far as I know Less does not support dynamic creation of arrays. Maybe there are other alternates to achieve your final output than mimicking the `map()` function. If you could post further details, I will try to help. – Harry Feb 19 '15 at 12:06
  • 1
    i do not understand your question, but possible see: http://stackoverflow.com/questions/27809514/how-to-exend-the-less-compiler-with-a-custom-function-leveraging-a-plugin – Bass Jobsen Feb 19 '15 at 12:28
  • Harry I don't strive to achieve immutable state here but since less doesn't even support foreach loops, and only the recursion; it would be nice to mimick rest/tail functionality in some way, altogether with first/head. But I am not sure if it's possible to find a workaround to that. Just wanted to play around as I thinlk Sass supports a lot of more features so there it's an easier job to do it. – Maciej Sitko Feb 19 '15 at 13:30
  • @MaciejSitko: We can mimick a foreach loop in Less. I remember seeing a custom mixin written by seven-phases-max. Let me try and find it for you. – Harry Feb 19 '15 at 13:41
  • 1
    @MaciejSitko: [This](https://github.com/seven-phases-max/less.curious/blob/master/articles/for-each.md) is the one that I was referring to. – Harry Feb 19 '15 at 14:02

0 Answers0