[Omake] join function?
Nick
z508617 at ftml.net
Sat Jan 6 20:21:31 PST 2007
Oops I didn't explain clearly what I meant by concatenation.
I apologize.
The following ocaml code explains the join function better than I could.
----------- join.ml begins -----------------
let rec join x y = match x, y with
| [], _
| _, [] -> []
| x :: xs, y :: ys -> (x ^ y) :: join xs ys
let _ =
let result =
join ["a"; "b"; "c"; "d" ] [ ".x"; ".y"; ".w"; ".z"]
in
List.iter print_endline result
------------ join.ml ends -----------------
On Sat, 06 Jan 2007 19:55:02 -0800, "Erick Tryzelaar"
<erickt at dslextreme.com> said:
> Nick wrote:
> > Hello list,
> >
> > First of all I'd like to say that omake is impressive.
> > Good work.
> > I am porting a gmake project over to omake and have come upon the
> > following difficulty -- how do I translate $(join seq1, seq2) to omake?
> > join takes 2 sequences of strings and returns a sequence of their
> > concatenation.
> > For example
> > $(join a b c d, .x .y .w .z) returns
> > a.x b.y c.w d.z
> > Thank you for your help.
>
> Just use the $(array ...) function, like this:
>
> % x[]=1 2 3
> - : <array
> "1" : Sequence
> "2" : Sequence
> "3" : Sequence>
> : Array
> % y[]=4 5 6
> - : <array
> "4" : Sequence
> "5" : Sequence
> "6" : Sequence>
> : Array
> % z=$(array $x $y)
> - : <array
> "1" : Sequence
> "2" : Sequence
> "3" : Sequence
> "4" : Sequence
> "5" : Sequence
> "6" : Sequence>
> : Array
>
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
--
Nick
z508617 at ftml.net
--
http://www.fastmail.fm - Choose from over 50 domains or use your own
More information about the Omake
mailing list