Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1033043 // intersperse_dyn - add an element between each two elements calculated out of them

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3877L/22K).

static <A> L<A> intersperse_dyn(IF2<A> f, Iterable<A> l) {
  new L<A> out;
  A prev = null;
  fOr (A x : l) {
    if (!empty(out))
      out.add(f.get(prev, x));
    out.add(x);
    prev = x;
  }
  ret out;
}

Author comment

Began life as a copy of #1025665

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033043
Snippet name: intersperse_dyn - add an element between each two elements calculated out of them
Eternal ID of this version: #1033043/1
Text MD5: 4be18eb5d67cbd5adf87de2851b2f64e
Transpilation MD5: b549c926461ccac862ae61d1f2d5581d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-11 17:41:13
Source code size: 218 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 155 / 192
Referenced in: [show references]