Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Interesting exercise / NeXT machines Message-ID: <4765@goanna.cs.rmit.oz.au> Date: 13 Feb 91 06:35:42 GMT References: <1991Feb12.013413.24312@cs.ubc.ca> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 21 In article <1991Feb12.013413.24312@cs.ubc.ca>, poole@cs.ubc.ca (David Poole) writes: > 1. Does anyone know whether there is a Prolog that runs on NeXT computers. You may be able to run binaries from some other 680x0 machines. Or try SB Prolog (but not _too_ hard). > 2. I recently had the need for an efficient implementation of a > priority queue. I wanted to add and remove element in log n time. The > "normal" way (using an array called a "heap") that is taught in > computer science courses is inappropriate for Prolog. Wrong. Heaps work very nicely indeed in Prolog. A file called HEAPS.PL is available in the DEC-10 Prolog library (see library(heaps) in the Quintus library). Your mistake is in identifying "heaps" with one particular *IMPLEMENTATION* of heaps using arrays. A heap is just a node-labelled binary tree with a constraint on the labels. I wouldn't go so far as to call this a trivial exercise, but it's not far off it. -- Professional programming is paranoid programming