... Nice explanation. I think it would have been easier to follow if you would have used sequential addresses 0, 1, 2, 3, ... or maybe a_0, a_1, a_2, ... ....
4642
Oliver Bandel
oliver@...
Oct 1, 2005 10:37 am
Hello, after I have learned to write tail-rec code I have forgotten how to write these direct style, somtimes called "silly style" or "stupid style", or "naive...
4643
Oliver Bandel
oliver@...
Oct 1, 2005 1:47 pm
... I doubt it is. It explains what is going on internally with memory allocation and so on. But it does not explain why it is allowed to do such definitions...
4644
Oliver Bandel
oliver@...
Oct 1, 2005 1:48 pm
... [...] Which style best using for automatically closing e.g. filedescriptors after read was completed? Using closures, CPS, Monads, .... ? Isn't CPS-style...
4645
Radu Grigore
radugrigore
Oct 1, 2005 2:20 pm
... let rec suf = function [] -> [] | h :: t -> (h :: t) :: (suf t);; __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 ...
4646
Java
segolas1212
Oct 1, 2005 2:47 pm
Hi everybody, this is my first post and I'm a VERY beginner of ml programming :-) So, let's start: # function x -> function y->x y;; - : ('a -> 'b) -> 'a ->...
4647
Remi Vanicat
dl_ens
Oct 1, 2005 3:10 pm
... Well, did you try to put parenthesis to see what realy happen? The code you give us is equivalent to fun x -> fun y -> (x y) and (x y) mean that y is given...
4648
Java
segolas1212
Oct 1, 2005 4:30 pm
... (x y) mean x is a function with y as argument???? ... mmm... my mind was born with imperative languages, so I think that something like this: fun x...
4649
Remi Vanicat
dl_ens
Oct 1, 2005 5:21 pm
... The application of the function f to 10 is wrote f 10 so the application of the function x to y is wrote x y then you can put parenthesis around this. ... ...
4650
a22_19_22
Oct 1, 2005 5:39 pm
. . . ... Interesting. I hacked around more than I expected, too :-). Here's what I came up with: # let suffixes list = let rec suffixes_aux li = match li...
4651
Oliver Bandel
oliver@...
Oct 1, 2005 5:49 pm
... ooops: ============================================================= suf = function [] -> [] | h :: t -> (h :: t) :: (suf t);; val suf : 'a list -> 'a list...
4652
Oliver Bandel
oliver@...
Oct 1, 2005 5:49 pm
On Sat, Oct 01, 2005 at 01:23:42PM +0200, Oliver Bandel wrote: [...] ... Ciao, Oliver...
4653
Oliver Bandel
oliver@...
Oct 1, 2005 5:50 pm
... [...] thanks. Oliver...
4654
a22_19_22
Oct 1, 2005 5:55 pm
. . . ... Almost, I think. To get [] at the end, tails have to be accumulated: let rec suf = function [] -> [] | h :: t -> t :: (suf t) But then we need the...
4655
Radu Grigore
radugrigore
Oct 1, 2005 7:20 pm
... I'm not sure why would you want that empty list: it caries no information since it will always be there. let rec suf = function [] -> [[]] | h :: t -> (h...
4656
Oliver Bandel
oliver@...
Oct 2, 2005 10:30 am
Hello, look at this example with lesser types... ...it was what I first thought could be a possible problem, and it seems it is one: ...
4657
Seth J. Fogarty
aravthamis
Oct 2, 2005 7:40 pm
... These aren't syntatic constructs, they are semantic ones. And, IMO, using the idea of 'locations39; in semantics is perfectly valid. For OCaml it is even...
4658
Seth J. Fogarty
aravthamis
Oct 2, 2005 7:47 pm
... I am not certain what the difference is between closures and CPS. CPS, in OCaml, is implemented using closures. I'll also note that CPS can be considered a...
4659
Oliver Bandel
oliver@...
Oct 2, 2005 8:40 pm
... Because this is, what the execise is looking for a s a result. (Okasaki-Book). ... Yes, now it's correct. ;-) Ciao, Oliver...
4660
a22_19_22
Oct 2, 2005 9:09 pm
. . . No, the behavior is /very/ well defined. Just not terribly useful. I gotta put my $.02 in here (I think there was a brief mention of cyclic lists in this...
4661
Seth J. Fogarty
aravthamis
Oct 3, 2005 12:21 am
... Well, I stand gladly corrected. ... These shouldn't be terribly hard to rewrite this way... it's a bit of a strange way of thinking about them, but it's...
4662
a22_19_22
Oct 3, 2005 1:20 am
. . . ... Well, I'm glad to hear it :-) . . . ... It depends on what you get used to, I guess. Common Lisp supports variable-arity functions, so mapping a...
4663
Brian Hurt
bhurt42
Oct 3, 2005 1:35 am
... No, they're not: let rec fold_left239; f init alist blist = match alist, blist with ... ;; let rec fold_right239; f alist blist init = (* NOT tail recursive *)...
4664
Brian Hurt
bhurt42
Oct 3, 2005 1:48 am
... This works: # let rec suf = function | [] -> [ [] ] | (_ :: t) as e -> e :: (suf t);; val suf : 'a list -> 'a list list = <fun> # suf [1;2;3;4];; - : int...
4665
dmitry grebeniuk
dmitrygrebeniuk
Oct 3, 2005 6:07 am
Shalom, Oliver. OB> I doubt it is. OB> It explains what is going on internally with memory allocation and so on. OB> But it does not explain why it is allowed...
4666
Richard Jones
rwmjones
Oct 3, 2005 1:35 pm
... Well we can assure you that OCaml certainly does support native TCP/IP sockets through the Unix module in the standard library. Could somebody introduce a...
4667
Alexey Nikolayev
alexeynikolayev
Oct 3, 2005 3:39 pm
Ok, it looks like we always have more than 2 choices ;) Thanks you Richard for so sufficient response. At this point we can go ahead. The issue is resolved....
4668
Jon Harrop
harropjon
Oct 3, 2005 6:54 pm
... Exactly, yes. You can write in conventional mathematical notation like this: # let f(x) = x+1;; val f : int -> int = <fun> # f(3);; - : int = 4 But the...
4669
Java
segolas1212
Oct 4, 2005 9:23 pm
thanks for all the help you give me! now i'm starting to understand and ca say fun x -> fun y ->(x y);; - : ('a -> 'b) -> 'a -> 'b = <fun> I can say first...
4670
Martin Jambon
BioMim
Oct 4, 2005 9:29 pm
... Yes! -- Martin Jambon, PhD http://martin.jambon.free.fr Freedom for the regexps! http://martin.jambon.free.fr/micmatch-howto.html...