* [Caml-list] Ocaml et la Standard Library
@ 2002-11-02 20:16 poinca
2002-11-03 11:18 ` Remi VANICAT
0 siblings, 1 reply; 8+ messages in thread
From: poinca @ 2002-11-02 20:16 UTC (permalink / raw)
To: caml-list
Je viens d'installer OCaml 3.0.6 sur MacOS X. Par contre j'ai un petit soucis avec la 'Standard
Library'. Comment la charge-t-on ? (les fonctions hd, tl, list_length, vect_length .... sont très
pratique )
Objective Caml version 3.06
# let list = [1;2;4;5];;
val list : int list = [1; 2; 4; 5]
# hd list;;
Unbound value hd
# list_length list;;
Unbound value list_length
Merci
Poinca
Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,13 /mn) ; tél : 08 92 68 13 50 (0,34/mn)"
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Ocaml et la Standard Library
2002-11-02 20:16 [Caml-list] Ocaml et la Standard Library poinca
@ 2002-11-03 11:18 ` Remi VANICAT
2002-11-03 12:23 ` Sven Luther
0 siblings, 1 reply; 8+ messages in thread
From: Remi VANICAT @ 2002-11-03 11:18 UTC (permalink / raw)
To: caml-list
"poinca" <poinca@laposte.net> writes:
> Je viens d'installer OCaml 3.0.6 sur MacOS X. Par contre j'ai un
> petit soucis avec la 'Standard Library'. Comment la charge-t-on ?
Elle est chargé par défaut. Il faut utiliser les noms qualifiés ou des
open.
> (les fonctions hd, tl, list_length, vect_length .... sont très
> pratique )
vect_length ? list_length ? c'est pas du ocaml ça. Les fonctions
sont :
List.hd List.tl List.length et Array.length (bien que un array et un
vect, c'est pas exactement la même chose)
Si les List. et Array. te gène, on peux faire un open :
# open List;;
# hd [2; 3];;
- : int = 2
--
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Ocaml et la Standard Library
2002-11-03 11:18 ` Remi VANICAT
@ 2002-11-03 12:23 ` Sven Luther
0 siblings, 0 replies; 8+ messages in thread
From: Sven Luther @ 2002-11-03 12:23 UTC (permalink / raw)
To: Remi VANICAT; +Cc: caml-list
On Sun, Nov 03, 2002 at 12:18:57PM +0100, Remi VANICAT wrote:
> "poinca" <poinca@laposte.net> writes:
>
> > Je viens d'installer OCaml 3.0.6 sur MacOS X. Par contre j'ai un
> > petit soucis avec la 'Standard Library'. Comment la charge-t-on ?
>
> Elle est chargé par défaut. Il faut utiliser les noms qualifiés ou des
> open.
>
> > (les fonctions hd, tl, list_length, vect_length .... sont très
> > pratique )
>
> vect_length ? list_length ? c'est pas du ocaml ça. Les fonctions
> sont :
cela doit etre sortit d'une ancienne doc sur caml-light. caml-light
utilisait/utilise des souligne pour les modules (les fichiers en fait,
il n'y avait pas encore vraiment des modules a l'epoque).
Amicalement,
Sven Luther
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Caml-list] Open types and methods
@ 2002-11-03 10:30 Jérôme Marant
2002-11-03 10:57 ` Stefano Zacchiroli
2002-11-03 11:29 ` Olivier Andrieu
0 siblings, 2 replies; 8+ messages in thread
From: Jérôme Marant @ 2002-11-03 10:30 UTC (permalink / raw)
To: caml-list
Hi,
I know that I cannot use open types as method parameter types,
like:
method foo (w : #mother) = ....
So, how can I pass to a method an object of a given class or
of its inherited classes, i.e. how to work this limitation
around?
Thanks.
Cheers,
--
Jérôme Marant
http://marant.org
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Open types and methods
2002-11-03 10:30 [Caml-list] Open types and methods Jérôme Marant
@ 2002-11-03 10:57 ` Stefano Zacchiroli
2002-11-04 8:48 ` Stefano Zacchiroli
2002-11-03 11:29 ` Olivier Andrieu
1 sibling, 1 reply; 8+ messages in thread
From: Stefano Zacchiroli @ 2002-11-03 10:57 UTC (permalink / raw)
To: caml-list
On Sun, Nov 03, 2002 at 11:30:36AM +0100, J?r?me Marant wrote:
> I know that I cannot use open types as method parameter types,
> like:
>
> method foo (w : #mother) = ....
>
> So, how can I pass to a method an object of a given class or
> of its inherited classes, i.e. how to work this limitation
> around?
Just define the method as:
method foo (w: #mother) = ...
And cast the object when invoking foo:
obj#foo (son :> mother)
Cheers.
--
Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy
zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro
"I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!" -- G.Romney
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Caml-list] Open types and methods
2002-11-03 10:30 [Caml-list] Open types and methods Jérôme Marant
2002-11-03 10:57 ` Stefano Zacchiroli
@ 2002-11-03 11:29 ` Olivier Andrieu
2002-11-03 15:13 ` Jérôme Marant
1 sibling, 1 reply; 8+ messages in thread
From: Olivier Andrieu @ 2002-11-03 11:29 UTC (permalink / raw)
To: Jérôme Marant; +Cc: caml-list
Jérôme Marant [Sunday 3 November 2002] :
>
>
> Hi,
>
> I know that I cannot use open types as method parameter types,
> like:
>
> method foo (w : #mother) = ....
>
> So, how can I pass to a method an object of a given class or
> of its inherited classes, i.e. how to work this limitation
> around?
Polymorphic methods ?
method foo : 'a. (#mother as 'a) -> ... = fun w -> ...
--
Olivier
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-11-04 8:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-02 20:16 [Caml-list] Ocaml et la Standard Library poinca
2002-11-03 11:18 ` Remi VANICAT
2002-11-03 12:23 ` Sven Luther
2002-11-03 10:30 [Caml-list] Open types and methods Jérôme Marant
2002-11-03 10:57 ` Stefano Zacchiroli
2002-11-04 8:48 ` Stefano Zacchiroli
2002-11-03 11:29 ` Olivier Andrieu
2002-11-03 15:13 ` Jérôme Marant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox