Concat_list. UPDATE!

john's Avatar

john

05 May, 2025 07:07 PM

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.

  1. Support Staff 1 Posted by john on 06 May, 2025 02:15 AM

    john's Avatar

    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.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • concat_list_screenshot.png 470 KB
  • concat_list_3.7_demo.ndbx.zip 13.4 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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

Recent Discussions

17 May, 2025 10:24 PM
17 May, 2025 12:17 AM
14 May, 2025 08:41 AM
09 May, 2025 01:15 PM
07 May, 2025 03:57 AM

 

06 May, 2025 06:46 AM
06 May, 2025 02:15 AM
21 Apr, 2025 10:47 AM
21 Apr, 2025 10:41 AM
21 Apr, 2025 05:56 AM
19 Apr, 2025 07:17 PM