🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #213

Re: O LANGUAGE DESIGNER, REMEMBER THE POOR USER

#213
From: news
Date: Sat, 05 May 1990 05:53
33 lines
1859 bytes
In article <3738@castle.ed.ac.uk> aipdc@castle.ed.ac.uk
(Paul D. Crowley) writes: 

   Warning: I don't actually know what I'm talking about.

So maybe I shouldn't respond?

   I tried as hard as I could to think of a way of randomizing an
   array in Prolog.  I can think of several ways of doing it in O(n^2)
   time.  I can think of one very tedious way of doing it in O(n
   log(n)) time.  I don't know how to do it in O(n) time, despite the
   fact that it can be done extremely efficiently in any imperative
   language.

Prolog does not have well structured array primitives.

   Is there no way to handle arrays in an applicative way, similar to
   the way ML has applicative assignments?

There are several ways.  They all boil down to providing primitives
adequate for the job.  For example, I know at least one language
which, given an array of positive integer constants, has a primitive
which will return numbers chosen pseudorandomly from the range 1..n
for each n.

Variations on this theme might involve constructing an array from a
set of precomputed random values.

In any event, don't let the array structure bother you.  Just demand
corresponding structure from your language.  [not to be confused with
imperative structures such as loops.]

Wulkwa
Technical Details
Message-ID: <9597@chaph.usc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!chaph.usc.edu!usc.edu!news
References: <13568@dime.cs.umass.edu> <3140@goanna.cs.rmit.OZ.AU> <3738@castle.ed.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!chaph.usc.edu!usc.edu!news
From: news@usc.edu
Newsgroups: comp.lang.functional
Subject: Re: O LANGUAGE DESIGNER, REMEMBER THE POOR USER
Message-ID: <9597@chaph.usc.edu>
Date: 5 May 90 05:53:17 GMT
References: <13568@dime.cs.umass.edu> <3140@goanna.cs.rmit.OZ.AU>
 <3738@castle.ed.ac.uk>
Sender: news@chaph.usc.edu
Organization: University of Southern California, Los Angeles, CA
Lines: 33
In-reply-to: aipdc@castle.ed.ac.uk's message of 1 May 90 16:20:27 GMT