Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

JoCaml

From Wikipedia, the free encyclopedia
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "JoCaml" – news ·newspapers ·books ·scholar ·JSTOR
(May 2015) (Learn how and when to remove this message)
The topic of this articlemay not meet Wikipedia'sgeneral notability guideline. Please help to demonstrate the notability of the topic by citingreliable secondary sources that areindependent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to bemerged,redirected, ordeleted.
Find sources: "JoCaml" – news ·newspapers ·books ·scholar ·JSTOR
(May 2015) (Learn how and when to remove this message)
(Learn how and when to remove this message)
JoCaml
ParadigmsMulti-paradigm:functional,imperative
FamilyML:Caml:OCaml
DeveloperInria
First appeared1999; 26 years ago (1999)
Stable release
4.01 / March 2014; 11 years ago (2014-03)
OSCross-platform
LicenseLGPL
Websitejocaml.inria.fr

JoCaml[1][2] is an experimentalgeneral-purpose,high-level,multi-paradigm,functional andobject-orientedprogramming language derived fromOCaml. It integrates the primitives of thejoin-calculus to enable flexible,type-checkedconcurrent anddistributed programming. The current version of JoCaml is a re-implementation of the now unmaintained JoCaml[3] made by Fabrice Le Fessant, featuring a modified syntax and improved OCaml compatibility compared to the original.

JoCaml was used by team Camls 'R Us to implement a distributedray tracer,[4] earning 2nd place on the ICFP 2000 programming contest.

The name is a reference toJoe Camel, a cartooncamel used in advertisements forCamel-brand cigarettes.

Example

[edit]
typecoins=Nickel|Dimeanddrinks=Coffee|Teaandbuttons=BCoffee|BTea|BCancel;;(* def defines a Join-pattern alternatives set clause   * '&' in the left side of '=' means join (channel synchronism)   * '&' in the right hand side is parallel processing   * synchronous_reply :== "reply" [x] "to" channel_name   * synchronous channels have function-like types (`a -> `b)   * while asynchronous ones have type `a Join.chan   * only the last statement in a pattern rhs expression can be an asynchronous message   * 0 in an asynchronous message position means STOP ("no sent message" in CSP terminology).   *)defput(s)=print_endlines;0(* STOP *);;(* put: string Join.chan *)defgive(d)=matchdwithCoffee->put("Coffee")|Tea->put("Tea");;(* give: drink Join.chan *)defrefund(v)=lets=Printf.sprintf"Refund %d"vinput(s);;(* refund: int Join.chan *)letnew_vendinggiverefund=letvend(cost:int)(credit:int)=ifcredit>=costthen(true,credit-cost)else(false,credit)indefcoin(Nickel)&value(v)=value(v+5)&replytocoinorcoin(Dime)&value(v)=value(v+10)&replytocoinorbutton(BCoffee)&value(v)=letshould_give,remainder=vend10vin(ifshould_givethengive(Coffee)else0(* STOP *))&value(remainder)&replytobuttonorbutton(BTea)&value(v)=letshould_give,remainder=vend5vin(ifshould_givethengive(Tea)else0(* STOP *))&value(remainder)&replytobuttonorbutton(BCancel)&value(v)=refund(v)&value(0)&replytobuttoninspawnvalue(0);coin,button(* coin, button: int -> unit *);;(* new_vending: drink Join.chan -> int Join.chan -> (int->unit)*(int->unit) *)letccoin,cbutton=new_vendinggiverefundinccoin(Nickel);ccoin(Nickel);ccoin(Dime);Unix.sleep(1);cbutton(BCoffee);Unix.sleep(1);cbutton(BTea);Unix.sleep(1);cbutton(BCancel);Unix.sleep(1)(* let the last message show up *);;

execution

$jocamlcexample.ml-otest$./testCoffeeTeaRefund 5

See also

[edit]

References

[edit]
  1. ^Ma, Qin; Maranget, Luc (2004). "Compiling Pattern-Matching in Join-Patterns".Proceedings of the 15th International Conference on Concurrency Theory. LNCS.3170. Springer-Verlag.
  2. ^Ma, Qin; Maranget, Luc (2008). "Algebraic Pattern Matching in Join Calculus".Logical Methods in Computer Science.4 (1).arXiv:0802.4018.Bibcode:2008arXiv0802.4018M.doi:10.2168/LMCS-4(1:7)2008.S2CID 15873901.
  3. ^Conchon, S.; Le Fessant, F. (1999)."Jocaml: Mobile agents for Objective-Caml".Proceedings of the First and Third International Symposium on Agent Systems Applications, and Mobile Agents. pp. 22–29.doi:10.1109/ASAMA.1999.805390.ISBN 0-7695-0342-X.S2CID 14355301.
  4. ^Louis Mandel; Luc Maranget."Programming in JoCaml". Inria research report 6261.

External links

[edit]
ML programming
Software
Implementations,
dialects
Caml
Standard ML
Dependent ML
Programming tools
Theorem provers,
proof assistants
Community
Designers
  • Lennart Augustsson (Lazy ML)
  • Damien Doligez (OCaml)
  • Gérard Huet (Caml)
  • Xavier Leroy (Caml, OCaml)
  • Robin Milner (ML)
  • Don Sannella (Extended ML)
  • Don Syme (F#)

  • Stub icon

    Thisprogramming-language-related article is astub. You can help Wikipedia byexpanding it.

    Retrieved from "https://en.wikipedia.org/w/index.php?title=JoCaml&oldid=1268124147"
    Categories:
    Hidden categories:

    [8]ページ先頭

    ©2009-2025 Movatter.jp