Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Brian Adkins Newsgroups: comp.lang.functional Subject: Converting list comprehensions to Standard ML Date: Sat, 21 May 2011 18:21:21 -0400 Organization: A noiseless patient Spider Lines: 18 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="1hRJk2m14aRWSp6vwasOlQ"; logging-data="5521"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wdaWAchPmJcRcsijjLLRG" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:mE7TsTo1WSJDwluqUmtH+MrfYQc= sha1:sZxdG68oueuK2KAXKp4RTNMWFJE= Xref: x330-a1.tempe.blueboxinc.net comp.lang.functional:100 I've been translating a simple Haskell program I wrote to Standard ML, and I just bumped up agains this list comprehension: [ (r,c) | r <- [0..4], c <- [0..r], predicate (r,c) ] I don't think I appreciated the brevity of list comprehensions that much until I attempted to convert this :) What would be the most idiomatic way to implement this in Standard ML? The fact that the second generator depends on the first complicates things somewhat. Thanks, Brian -- Brian Adkins http://lojic.com/