Concat_list. UPDATE!
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:
http://support.nodebox.net/discussions/show-your-work/734-improved-...
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.
-
concat_list_screenshot.png 470 KB
- concat_list_3.7_demo.ndbx.zip 13.4 KB
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by john on 06 May, 2025 02:15 AM
UPDATE to this UPDATE!
Oops. Just caught a very tiny bug which only occurs is you use a null delimiter.
Bug fixed. Download the TRUE update from the demo attached to THIS post.
Sorry about that.