mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 10:23:46 +00:00
extras/curs/curs.m:
extras/curs/curs.panel.m:
Make panel a separate submodule of curs, not a nested submodule.
extras/base64/base64.m:
extras/curses/mcurses.basics.m:
extras/curses/mcurses.m:
extras/curses/mcurses.misc.m:
extras/curses/mcurses.user.m:
extras/gator/evolve.m:
extras/gator/genotype.m:
extras/gator/phenotype.m:
extras/gator/tausworthe3.m:
extras/monte/dots.m:
extras/monte/geom.m:
extras/monte/hg.m:
extras/monte/monte.m:
extras/monte/rnd.m:
extras/moose/grammar.m:
extras/moose/moose.m:
extras/mopenssl/mopenssl.m:
extras/net/echo.m:
extras/net/errno.m:
extras/net/getaddrinfo.m:
extras/net/net.m:
extras/net/netdb.m:
extras/net/sockets.m:
extras/net/streams.m:
extras/net/tcp.m:
extras/net/test_lookups.m:
extras/net/types.m:
extras/odbc/odbc.m:
extras/odbc/odbc_test.m:
extras/references/README:
extras/references/reference.m:
extras/references/scoped_update.m:
extras/solver_types/library/any.m:
extras/solver_types/library/any_array.m:
extras/solver_types/library/any_assoc_list.m:
extras/solver_types/library/any_list.m:
extras/solver_types/library/any_map.m:
extras/solver_types/library/any_tree234.m:
extras/solver_types/library/any_util.m:
extras/trail/trail.m:
extras/trailed_update/samples/interpreter.m:
extras/trailed_update/samples/vqueens.m:
extras/trailed_update/tests/var_test.m:
extras/trailed_update/tr_array.m:
extras/trailed_update/tr_store.m:
extras/trailed_update/trailed_update.m:
extras/trailed_update/unsafe.m:
extras/trailed_update/var.m:
Bring programming style up to date.
60 lines
1.7 KiB
Mathematica
60 lines
1.7 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2010 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module dots.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module hg.
|
|
:- import_module geom.
|
|
:- import_module monte.
|
|
:- import_module rnd.
|
|
|
|
:- import_module float.
|
|
:- import_module int.
|
|
:- import_module list.
|
|
:- import_module string.
|
|
|
|
main(!IO) :-
|
|
io.format("newgraph\n", [], !IO),
|
|
io.format("xaxis min -2.5 max 2.5 size %2.2f\n", [f(5.0/3.0)], !IO),
|
|
io.format("yaxis min -2.5 max 4.5 size %2.2f\n", [f(7.0/3.0)], !IO),
|
|
io.format("newcurve marksize 0.01 0.01 pts ", [], !IO),
|
|
dots(hgBox, hg, 100000, !IO).
|
|
|
|
:- pred dots(box::in, monte.shape::in(monte.shape), precision::in,
|
|
io::di, io::uo) is det.
|
|
|
|
dots(Box, Shape, Precision, !IO) :-
|
|
rnd__init(17, Rnd0),
|
|
dots2(Box, Shape, Precision, Rnd0, !IO).
|
|
|
|
:- pred dots2(box::in, monte.shape::in(monte.shape), int::in, rnd::in,
|
|
io::di, io::uo) is det.
|
|
|
|
dots2(Box, Shape, N, !.Rnd, !IO) :-
|
|
( if N > 0 then
|
|
frange(Box ^ xmin, Box ^ xmax, X, !Rnd),
|
|
frange(Box ^ ymin, Box ^ ymax, Y, !Rnd),
|
|
frange(Box ^ zmin, Box ^ zmax, Z, !Rnd),
|
|
( if call(Shape, X, Y, Z) then
|
|
io.format("%2.2f %2.2f ", [f(X), f(Z)], !IO)
|
|
else
|
|
true
|
|
),
|
|
dots2(Box, Shape, N - 1, !.Rnd, !IO)
|
|
else
|
|
true
|
|
).
|