Article View: pl.comp.lang.funkcyjne
Article #48Re: OCaml: Wspó³dzielenie pomiêdzy rekordami ...
From: Nathell
Date: Wed, 04 Dec 2002 09:48
Date: Wed, 04 Dec 2002 09:48
28 lines
1947 bytes
1947 bytes
I dteachtaireacht Wed, 4 Dec 2002 09:19:46 +0000 (UTC) scríobh Andrzej M.
Ostruszka:
> > Je¿eli mam rekord który zawiera float'y ale nie sk³ada siê tylko
> > z float'ów wiêc one sa pude³kowane(?? tak siê to mówi ??) to jak zrobiæ
> > tak by dany float by³ wspó³dzielony pomiêdzy ró¿nymi rekordami
> > i modyfikacja w jednym by³a widoczna we wszystkich?
>
> Chcia³em tylko dodaæ, ¿e obej¶cie z zastosowaniem jednoelementowej
> tablicy float znam :)
A obejscie z zastosowaniem referencji?
#v+
type rekord = {s : string; f : float ref};;
let share = ref 0.0;;
let rec1 = {s = "rec1"; f = share};;
let rec2 = {s = "rec2"; f = share};;
rec1.f := 2.0 *. !(rec1.f) +. 3.1415926535;;
!(rec2.f);;
#v-
hth :-)
--
Nathell [http://www.nhp.prv.pl]
"Don't treat fictional people as if they were human beings. It only
encourages them." -- Aris Katsaris in rec.games.int-fiction
(replace mishrak.ac.thull with zodiac.mimuw.edu.pl to send me email)
Technical Details
Message-ID:
<slrnaurjrr.1ro.nathell@orange14.mimuw.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!mimuw.edu.pl!news.mimuw.edu.pl!not-for-mailReferences:
<slrnaurham.prp.amo@order.if.uj.edu.pl> <slrnaurhpi.pv8.amo@order.if.uj.edu.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!mimuw.edu.pl!news.mimuw.edu.pl!not-for-mail From: Nathell <nathell@mishrak.ac.thull> Newsgroups: pl.comp.lang.funkcyjne Subject: Re: OCaml: Wspó³dzielenie pomiêdzy rekordami ... Date: Wed, 4 Dec 2002 09:48:44 +0000 (UTC) Organization: Warsaw University, Faculty of Mathematics, Informatics and Mechanics Lines: 28 Message-ID: <slrnaurjrr.1ro.nathell@orange14.mimuw.edu.pl> References: <slrnaurham.prp.amo@order.if.uj.edu.pl> <slrnaurhpi.pv8.amo@order.if.uj.edu.pl> Reply-To: nathell@mishrak.ac.thull NNTP-Posting-Host: orange14.mimuw.edu.pl Mime-Version: 1.0 X-Trace: kenny.mimuw.edu.pl 1038995324 5080 10.1.1.114 (4 Dec 2002 09:48:44 GMT) X-Complaints-To: abuse@news.mimuw.edu.pl NNTP-Posting-Date: Wed, 4 Dec 2002 09:48:44 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit