Core screwed up Utop.

"Douglas Lewit [email protected] [ocaml_beginners]" <[email protected]> Sat, 24 Sep 2016 17:20:34 -0500
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAM0XMJQokHbUmV9vZ_g+ctLT45CdW29zrAdMaSghuA=SbSebyg@mail.gmail.com>
Hi everyone,

I went on github ( a real computer jungle for sure! ) and upgraded to Ocaml
4.03.  Then I installed Core, which I believe is a library containing all
of Jane Street's contributions to the Ocaml language.  That screwed up my
Utop installation, so I tried to reinstall Utop.  No success with that.
There were many error messages, but the primary failure had to do with a
dependency called "*lwt*".  I did a Google search and discovered that some
other Ocaml users have had problems with this dependency as well.  I'm not
really sure how to fix it.  I can still use Ocaml's default top-level,
which is okay, but Utop is really fantastic!  Utop is way better than
Ocaml's default top-level.  Any suggestions?  Much appreciated.

Best,

Douglas Lewit

P.S.  Could someone provide some feedback on the following code?  It works
well for getting every nth member of a list, but isn't there an easier way
to do this?  I just thought it was a lot of work to accomplish a more or
less simple task.  Thanks.

*let everyNth ls n = *
*     let rec everynth lst m = *
*                match lst with *
*                |[ ] -> [ ]*
*                |head :: tail -> if m mod n = 0 then head :: everynth tail
(m + 1)*
*                                       else everynth tail (m + 1) in *
*                everynth ls 1 ;;*

An interesting side note here.  This recursive function can be implemented
in Ruby, but of course the syntax is a tiny bit different.  ( For example,
instead of match lst with [ ] or head :: tail you would do something like
if lst == [ ] then [ ] else head, *tail = lst ......... etc, etc.  But
what's really interesting is that with Ruby the inner function must be
declared as a lambda expression.  If it's a regular function defined using
the "def" keyword then the inner function cannot "see" the variable n.
It's interesting to me how Ruby and Ocaml not only have different syntax
but also somewhat different rules regarding the scope of variables within
functions and nested functions.  Ruby of course is mostly object-oriented,
but its creator was a very avid LISP programmer and for that reason decided
to endow Ruby with certain important functional features.  So even though
Ruby is mostly object-oriented the language has some powerful functional
features that remind me a lot of Ocaml, LISP, Haskell, Erlang, etc, etc.
For example, Ruby does a pretty good job at recursion, currying, etc.
Okay, that's it for now.  Thanks!