fluffos/docs/efun/strings/implode.md

36 lines
993 B
Markdown
Raw Permalink Normal View History

2018-12-30 16:43:04 -08:00
---
title: strings / implode
---
2023-11-25 09:50:24 -08:00
# implode
2018-12-30 16:43:04 -08:00
### NAME
2018-12-30 16:59:01 -08:00
implode() - concatenate strings
2018-12-30 16:43:04 -08:00
### SYNOPSIS
2018-12-30 16:59:01 -08:00
string implode( mixed *arr, string del );
docs/efun: document FFI + dwlib efuns, fix return-type errors, drop stale docs Reviewed every efun doc against the .spec source of truth (the make_func declarations) and the implementations. New docs for 28 previously-undocumented efuns: - package_ffi (18): new docs/efun/ffi/ category — ffi_load/unload/symbol/ prepare/call, alloc/free/sizeof/peek/address/read/write, struct_layout, callback/callback_addr/callback_free, error/status. - package_dwlib (10, under contrib/): add_a, vowel, replace, replace_dollars/html/mxp/objects, roulette_wheel, query_multiple_short, reference_allowed. Return-type fixes where the doc contradicted the spec/impl (mostly stale MudOS behavior): cache_stats/debugmalloc/dump_file_descriptors/ malloc_status/mud_status return string; disable_commands/flush_messages/ receive/set_heart_beat are void; get_char/input_to/link/set_eval_limit return int; call_stack -> mixed *, function_profile -> mapping *. Also corrected receive's and disable_commands' stale "returns ..." prose. Expanded implode (function-fold form) and save_object (save-to-string form), both of which the docs had omitted. Removed 4 stale docs for efuns that no longer exist (no spec entry, no f_ implementation, zero references anywhere): errorp, opcprof, swap, dump_socket_status. Regenerated the affected efun index pages. The Docusaurus build passes with onBrokenLinks:throw, confirming no dangling links. Note: the docs/zh-CN translated tree still mirrors the old English docs (same stale entries, and it lacks the new efuns); left for a separate translation pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 16:03:27 -07:00
mixed implode( mixed *arr, function f, void | mixed extra );
2018-12-30 16:43:04 -08:00
### DESCRIPTION
2018-12-30 16:59:01 -08:00
docs/efun: document FFI + dwlib efuns, fix return-type errors, drop stale docs Reviewed every efun doc against the .spec source of truth (the make_func declarations) and the implementations. New docs for 28 previously-undocumented efuns: - package_ffi (18): new docs/efun/ffi/ category — ffi_load/unload/symbol/ prepare/call, alloc/free/sizeof/peek/address/read/write, struct_layout, callback/callback_addr/callback_free, error/status. - package_dwlib (10, under contrib/): add_a, vowel, replace, replace_dollars/html/mxp/objects, roulette_wheel, query_multiple_short, reference_allowed. Return-type fixes where the doc contradicted the spec/impl (mostly stale MudOS behavior): cache_stats/debugmalloc/dump_file_descriptors/ malloc_status/mud_status return string; disable_commands/flush_messages/ receive/set_heart_beat are void; get_char/input_to/link/set_eval_limit return int; call_stack -> mixed *, function_profile -> mapping *. Also corrected receive's and disable_commands' stale "returns ..." prose. Expanded implode (function-fold form) and save_object (save-to-string form), both of which the docs had omitted. Removed 4 stale docs for efuns that no longer exist (no spec entry, no f_ implementation, zero references anywhere): errorp, opcprof, swap, dump_socket_status. Regenerated the affected efun index pages. The Docusaurus build passes with onBrokenLinks:throw, confirming no dangling links. Note: the docs/zh-CN translated tree still mirrors the old English docs (same stale entries, and it lacks the new efuns); left for a separate translation pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 16:03:27 -07:00
In the first form, concatenate all strings found in array 'arr', with
the string 'del' between each element. Only strings are used from the
array; elements that are not strings are ignored.
In the second form, when the second argument is a function, implode()
instead reduces the array: it combines the elements left to right by
repeatedly calling 'f' with the running result and the next element
(a fold), and returns whatever the final call returns. The optional
'extra' argument, when present, is used as the starting value.
### RETURN VALUE
The joined string for the delimiter form, or the accumulated value
(any type) for the function form.
2018-12-30 16:43:04 -08:00
### SEE ALSO
docs/efun: document FFI + dwlib efuns, fix return-type errors, drop stale docs Reviewed every efun doc against the .spec source of truth (the make_func declarations) and the implementations. New docs for 28 previously-undocumented efuns: - package_ffi (18): new docs/efun/ffi/ category — ffi_load/unload/symbol/ prepare/call, alloc/free/sizeof/peek/address/read/write, struct_layout, callback/callback_addr/callback_free, error/status. - package_dwlib (10, under contrib/): add_a, vowel, replace, replace_dollars/html/mxp/objects, roulette_wheel, query_multiple_short, reference_allowed. Return-type fixes where the doc contradicted the spec/impl (mostly stale MudOS behavior): cache_stats/debugmalloc/dump_file_descriptors/ malloc_status/mud_status return string; disable_commands/flush_messages/ receive/set_heart_beat are void; get_char/input_to/link/set_eval_limit return int; call_stack -> mixed *, function_profile -> mapping *. Also corrected receive's and disable_commands' stale "returns ..." prose. Expanded implode (function-fold form) and save_object (save-to-string form), both of which the docs had omitted. Removed 4 stale docs for efuns that no longer exist (no spec entry, no f_ implementation, zero references anywhere): errorp, opcprof, swap, dump_socket_status. Regenerated the affected efun index pages. The Docusaurus build passes with onBrokenLinks:throw, confirming no dangling links. Note: the docs/zh-CN translated tree still mirrors the old English docs (same stale entries, and it lacks the new efuns); left for a separate translation pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 16:03:27 -07:00
explode(3), sprintf(3), filter(3), map(3)