* Re: Okasaki's "Purely Functional Data Structures" translated to [not found] <199901211455.PAA32009@miss.wu-wien.ac.at> @ 1999-01-22 11:34 ` Pierpaolo Bernardi 1999-01-23 17:56 ` Markus Mottl 0 siblings, 1 reply; 4+ messages in thread From: Pierpaolo Bernardi @ 1999-01-22 11:34 UTC (permalink / raw) To: Markus Mottl; +Cc: OCAML On Thu, 21 Jan 1999, Markus Mottl wrote: > Although this implementation seems to be quite perfect, I have allowed > myself to make some very small changes, so that it can be immediately > used as a module and fits better to the way modules are implemented in > the standard library. Good. > The following changes should be noted: > * The type of these lists is not "ralist" anymore in the module but > "t". This corresponds to the way this is handled in the standard > modules. Rigth. > * A somewhat bigger change: the type of the list is not: > > type 'a ralist = Nil | Root of int * 'a tree * 'a ralist > > but now: > > type 'a t = (int * 'a tree) list > > I think that new users will understand details of implementation > easier with this change. It also comes closer to Okasaki's version. Okasaki in his paper on RALs presents both versions. The one I used is faster for Ocaml, so I suggest that you use the version I sent. Users should use the book or the paper to understand details. > * The rest of the changes concern mainly layout (hardly noticable). De gustibus... 8-) Cheers, Pierpaolo ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Okasaki's "Purely Functional Data Structures" translated to 1999-01-22 11:34 ` Okasaki's "Purely Functional Data Structures" translated to Pierpaolo Bernardi @ 1999-01-23 17:56 ` Markus Mottl 0 siblings, 0 replies; 4+ messages in thread From: Markus Mottl @ 1999-01-23 17:56 UTC (permalink / raw) To: Pierpaolo Bernardi; +Cc: OCAML Hello, > > * A somewhat bigger change: the type of the list is not: > > > > type 'a ralist = Nil | Root of int * 'a tree * 'a ralist > > > > but now: > > > > type 'a t = (int * 'a tree) list > > > > I think that new users will understand details of implementation > > easier with this change. It also comes closer to Okasaki's version. > > Okasaki in his paper on RALs presents both versions. The one I > used is faster for Ocaml, so I suggest that you use the version I sent. > Users should use the book or the paper to understand details. I haven't read his paper, I just know his book - there is nothing about the second possibility in it (maybe I have overlooked it). Anyway, I have compared performance between the two (just for some common operations). Your version was about 3% faster - not really much, but I added it again to the repository and renamed the former version to "sb_ralist2". This should satisfy both the speed-hungry and the advocats of elegance... By the way, chapter seven is now available, too. And I have made the necessary changes so that "PhysicistsQueue" (chapter six) works. As always: http://miss.wu-wien.ac.at/~mottl/ocaml_sources/intro.html Best regards, Markus -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <Pine.GSO.4.00.9901191822100.8220-100000@carlotta.cli.di.unipi.it>]
* Re: Okasaki's "Purely Functional Data Structures" translated to [not found] <Pine.GSO.4.00.9901191822100.8220-100000@carlotta.cli.di.unipi.it> @ 1999-01-20 0:34 ` Markus Mottl 1999-01-20 17:06 ` Pierpaolo Bernardi 0 siblings, 1 reply; 4+ messages in thread From: Markus Mottl @ 1999-01-20 0:34 UTC (permalink / raw) To: Pierpaolo Bernardi; +Cc: OCAML Hello, > I have translated the Random Access List structure, and have > written equivalents for most of the Ocaml list library functions. > > If you wish, I'll send what I have done to you. > > I would have liked to translate more of the code, but I am still waiting > for the book to arrive (I have ordered it several months ago). As it seems, Okasaki's book is out-of-print at the moment - by some miracle I was able to get one at our university book shop. But you need not necessarily wait for the book to get the sources. The SML- and Haskell-version can be downloaded from his site at: http://www.cs.columbia.edu/~cdo/papers.html It would be really nice to get your implementations of data structures. I have not yet come to the Random Access List, although it is certainly one of the funnier data structures: random access to elements of lists in O(log n) - I like that! Until now, OCAML's standard library only contains the most basic data structures. I am sure many people would like to see some more to choose from. As someone has already mentioned, the interfaces of the modules in the sources are everything else but "fat". They support basic functionality only. But it shouldn't be too difficult to add some further functions to make things comfortable - the really tricky things are already mostly implemented (though, hidden behind module interfaces). Porting the sources is not difficult - should be possible for people with basic knowledge in OCAML. I have not yet used SML, but it's (nearly) always clear, what has to be changed. Regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Okasaki's "Purely Functional Data Structures" translated to 1999-01-20 0:34 ` Markus Mottl @ 1999-01-20 17:06 ` Pierpaolo Bernardi 0 siblings, 0 replies; 4+ messages in thread From: Pierpaolo Bernardi @ 1999-01-20 17:06 UTC (permalink / raw) To: mottl; +Cc: caml-list [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 5448 bytes --] Hello, But you need not necessarily wait for the book to get the sources. The SML- and Haskell-version can be downloaded from his site at: http://www.cs.columbia.edu/~cdo/papers.html Yes, I know this, thanks. Still, I was waiting for the book so I could translate the code while reading the text. It would be really nice to get your implementations of data structures. I have not yet come to the Random Access List, although it is certainly one of the funnier data structures: random access to elements of lists in O(log n) - I like that! And they work very well with Ocaml. A test that I did using only hd, tl and cons was only two times slower using RALs than builtin lists. The code is attached below. I used Ocaml names (hd, tl) instead of the original head, tail, etc. Enjoy. Pierpaolo Bernardi begin 600 ral.tar.gz M'XL("%\)IC8"`W)A;"YT87(`[5Q9;]M($O:S?D7#&$Q(FW%$QL>,9QP@R,P" M`;+91;(/"P2!0%.43802)9)V*",_?JOZ8E^4*=E.@@7[P9:ZJZNKOCJZFJ3X MX?6[%WM/W,CQ^&P\)O3_60C_"8FB4_J?MS$AIZ<GX?'X.(R."0G#ER_#/7*R M]QW:357')2%[EVFYB,OILHNNJF^FZ:+.]OZ_V@>P?QGG1_/\Z=8(Q^/3;OL? M@[%/T/['IR]?CL,3\(4P.CD]VR/CP?Y/WD;>`?GE[?2<,"<(;DEX%)+P]]]_ M>Q%&+Z*(C,_.Q[^=AQ%99FFYC,G?S5)\_(4<^*/1O)C>Y"FIU\N4?'C]_J]_ M_7/R^LV;OS]^G+Q[^_$_Y&)$2)5=C=#4E.99C&ME53VB?6F3I,LZ*Q;D'W&6 MWY0I*6:DJLML<66,OUW<PKSI)"ZO;N9@"F/X?5%/9L7-8DH88R`FZ7Q9K\FY MLJ8828I%1=C(\U?MN/9%$E]/\=.Y22;'Z]PYKNF)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L4,(<%GMXW+;:I'BIT-$/30OM>V MQ9X^?6CD-/I^U9!??[46"%V=5GTH1OH%BO;\T^9]2I>C6P1*SI^P?718BM+D M'SKZ#(GD0#],V!-@?4`QI.@40$7PZ9)&8R>-9D/28/NWX5+J%N,:VJ;<9;/L M#5=RVRUA=+GLHVVW+B#Z8=!Q=])Q4UUQ'^D0/X4_Z,&DHN`8Z>\-?)+I#"VO MW7RA,U0?R1F<*/0"H,?>@<_P][^Z0.5M0-;,#@+U-*0CPLR>R<RUB8M)*[(< ME[--M+S#2'*L][%3K+JX>UU!MMH!S$="<ULX5Q:>*S>@JQ^'*/N-1T](O2]! M)O#X`M[5T!]^&403Y2$@^7,#$R_*20?8Q=!%;(3OVM!#O?F%*B@_>9#WS06M M`8CHCTU;Q/F&!TX=.MY_%ME.ZBZ!A:%WLB+P99!O8QN7[YOF<8BE!4$G_NI8 M7QML%1"&0)MD$>99[1@;CQ\<#XR.5?_@6+EC8_6]0V/5*S)67=9COS'K9SQ\ MRI&=4\6CH.PI?NMN#J5TBTX?-J/U"%XGO="$4+7`V_T>U!2T0C'H(OV>I7(^ MTBN\=5OBZ)HS/CTOGX@:J[]Y-NI(-BC9H9^VGEW)=6E)EQ6_!'R4NW?0Z[AW MMU5M+1R$<@I,&=6[=[)WB]MW?(Y96@M6/_TM/`N)/B"XRFO\)>?>T/J__R7[ M0>]_(<<GXPC?__+R[/0X.CZ)\/TO9]'I\/Z7'_#^E\S]`IBS\VAX`<SP`ICA M!3##"V"&%\`,+X`97@`SO`!F>`$,JV^&0\;0AC:TH0UM:$,;VM"&-K2A#6UH I0QO:T(8VM*$-;6A#&]K0AC:TH0UM:$,;VM"&-K0?U/X']A<7(`!X``"A ` end ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-01-24 14:44 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <199901211455.PAA32009@miss.wu-wien.ac.at> 1999-01-22 11:34 ` Okasaki's "Purely Functional Data Structures" translated to Pierpaolo Bernardi 1999-01-23 17:56 ` Markus Mottl [not found] <Pine.GSO.4.00.9901191822100.8220-100000@carlotta.cli.di.unipi.it> 1999-01-20 0:34 ` Markus Mottl 1999-01-20 17:06 ` Pierpaolo Bernardi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox