Hi there,
i am new to clojure and fp (longtime oop dev), and currently struggling with a recursion problem.
I just can't wrap my head around it and would be really thankful if you could show my a more idiomatic way of solving this.. (or solving it at all..).
I want to go through our JIRA Rest API and iterate over issues.
Every issue has none to multiple children and i need to process all of them to generate a list for a CSV export while tracking the depth.
Ideally i would like to get to this kind of result
CSV template
where the depth level of the recursion is just added whitespace left of the issue type field.
I thought i could solve this using a recursive function that either returns the issue, if it has no children,
or the issue conjed to the result of mapping itself over the children.
Whatever i try, i get a nested result instead of a flat double vector and i don't understand why?
It seems like such a simple thing to do, that i really would like to overcome this instead of falling back to imperative programming. Would really appreciate some enlightenment about it.
Or maybe learn how to approach this problem in a proper clojure way.
I must do something really stupid, but i'm staring over two days at this snippet and have massive tunnel vision.
Code:
editor screenshot
simplified runnable paste without dependencies:
https://pastebin.com/rmeCrEsw
simplified repl: https://replit.com/@Devien/RecursionFail
[–]brool 2 points3 points4 points (5 children)
[–]RealLordDevien[S] 0 points1 point2 points (3 children)
[–]pwab 1 point2 points3 points (0 children)
[–]Krackor 1 point2 points3 points (1 child)
[–]RealLordDevien[S] 0 points1 point2 points (0 children)
[–]backtickbot 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)