The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

Show your WorkFrom the old forum

Concat_list. UPDATE!

2 replies Last reply

  1. NOTE: the node in the demo attached to this note contains a small bug. See next post.

    Nodebox provides a way of turning one string into many (make_strings) but no way of doing the reverse: concatenating many strings into one.

    Years ago I published a node to solve this problem, concat_list. But there was a problem: it required an external code module. This has annoyed me ever since. Not only is it a nuisance when you use it on a project, it also meant that if I ever used concat_list inside ANOTHER new node, that node would then have the same external code requirement.

    Last year I finally got fed up with this and came up with an alternative that does not require a code module, but is limited to a maximum of 600 strings. I describe it here:

    https://forum.nodebox.net/t/4869126942/improved-factorial-and-concat-list-alternative

    At the time (for reasons you can read in the above link) I decided not to replace the original node, but merely to tuck it away inside the demo for concat_list.

    Today I am reversing that decision!

    I have improved the alternative and replaced the original with it. In release 3.7 of my library, the concat_list node will no longer require external code, but will be limited to a maximum of 600 strings. If you need to concatenate more than 600 strings, you can still find the original node, renamed concat_all, in the demo for concat_list.

    NOTE: This node is pretty fast in most situations. But if you are using it repeatedly and notice any performance issues, and the number of strings you need to concatenate is less than 600, you can significantly improve the performance by making a simple alteration. If this happens to you, please post a request on the forum and I'll tell you how to do it.

    I came to this decision because yesterday I was using Nodebox to solve a quick math puzzle and needed concat_list. Wrangling the code module caused me a minor bit of trouble. The thing is: I had FORGOTTEN about the alternative version I created last year. When that finally dawned on me I decided enough is enough. 99.9% of the time the Python-free version works just fine, so it should be the default.

    Here is the demo (with NO external module needed). I simply alphabetize the words in the first sentence of the Gettysburg Address - a simple thing, but something you can't do without this node.

    The Cartan Node Library - getting better one node at a time.

    Copy link
  2. Update to the update! Added Sept 23, 2026

    The attached update works exactly like the old concat_list, but is noticeably faster and can now handle a maximum of 65,536 strings instead of just 600. It has about 4000 fewer nodes inside and is a megabyte lighter.

    Still no external Python module required.

    I rewrote this entirely by hand in Nodebox, but I did have a little AI help: an interesting chat with Goggle's Gemini AI.

    I asked it if there was way to concatenate a list of strings in Nodebox. It said not without Python and offered to write the Python module for me. I asked if it was familiar with the Cartan Node Library and it said it was. So I asked, if it was impossible, how could concat_list do it?

    It said "Oh, you mean the MODERN version of concat_list, yes I see that now, though it is limited to 600 strings." So I asked if, following that same approach, it could see a more efficient way of doing it. "Thinking... Thinking..." and then YES! It suggested a better way by doing the hard-coded recursion pairwise instead of 6 strings at a time. That way the overall list would shrink in half with every crank of the wheel.

    Of course! I should have thought of that myself. I then asked why not shrink it by a factor of 7 each time instead of 2. It answered that you could do that, but the overhead of managing odd sized chunks would be significant. Two was much cleaner and simpler and almost as fast. Good point.

    It then provided a plain English algorithm which used a subsets node at one point. I objected saying, "Wait, Nodebox doesn't have a subsets node!" It responded "Yes, but the Cartan Node Library does. I assumed you would know that." Again, it was right, though my subsets node would be overkill for this particular task; easier to roll my own.

    So I rolled up my sleeves, coded it entirely in Nodebox, and tested it. Worked like a charm!

    I relate this droll story just to point out that AI has gotten significantly better in the last year. It can now be a genuinely helpful collaborator. You still have to watch it like a hawk - it will confidently spew nonsense every now and then - but I find that it can now understand Nodebox coding fairly well, sometimes even better than me!

    I still have many concerns about AI, and never use it in my art, but for this purpose I think it can be truly useful. So if you are stuck on a Nodebox problem and don't want to wait for me to find your post on the forum, you might consider asking a friendly AI for help. (If you do, please consider sharing your adventures with the rest of us.)

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply