Re: replace first n items in sequence

2010-12-18 Thread Alan
I feel similarly: always use a built-in if there is one, even for something as simple as this. I couldn't find one either, and my solution is basically the same as Benny's, but there's no particular need to (let) the count, and once that's removed it's so short it almost doesn't merit a defn anymor

Re: replace first n items in sequence

2010-12-18 Thread Benny Tsai
No problem :) I prefer built-in's as well, but I couldn't find anything. Maybe someone else will have better luck... On Dec 18, 3:32 pm, Glen Rubin wrote: > ok that's looks very succinct, I will use it.  Just figured I would > ask if it exists, b/c always prefer to use a built-in and it sounded

Re: replace first n items in sequence

2010-12-18 Thread Glen Rubin
ok that's looks very succinct, I will use it. Just figured I would ask if it exists, b/c always prefer to use a built-in and it sounded basic enough to be. thanks! On Dec 18, 5:15 pm, Benny Tsai wrote: > I didn't see a built-in fn for this, and couldn't restrain myself from > trying to write on

Re: replace first n items in sequence

2010-12-18 Thread Benny Tsai
I didn't see a built-in fn for this, and couldn't restrain myself from trying to write one: (defn replace-first-n [xs ys] (let [n (count ys)] (concat ys (drop n xs On Dec 18, 2:38 pm, Glen Rubin wrote: > I am looking for a fn that does the following.  Let's say i have > sequences A & B

replace first n items in sequence

2010-12-18 Thread Glen Rubin
I am looking for a fn that does the following. Let's say i have sequences A & B A: '(1 2 3 4 5 6 7 8 9 10) B '(54 666 23) I want to replace A's first items with B's, so that I get: '(54 666 23 4 5 6 7 8 9 10) Is there a fn to do this? Otherwise, I will write one. Thanks! -- You received