arrays - What is the most idiomatic style to force a computation using Sequences in f#? -


i have side-effective operation

     securities |> seq.map (fun x -> request.append("securities",x)) 

what idiomatic way have code perform ?

i wrote seq.doit, itches

  module seq =      let doit sa = sa |> seq.toarray |> ignore 

deferred sequences used when create sequences using seq.delay or sequence expression seq{}. function on sequence returning datatype other seq can force computation.

alternatively, can use for loop instead of seq.iter:

for s in securities    request.append("securities", s) 

if want hide side effects , return request later use, seq.fold choice:

securities |> seq.fold (fun acc x -> acc.append("securities", x); acc) request 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -