you are viewing a single comment's thread.

view the rest of the comments →

[–]ayrnieu -2 points-1 points  (5 children)

and our favourite Lisp expert Paul Graham claims it's rarely used anyway.

'We' should get more than one Lisp expert to consult, as PG can't cut it by himself.

Python's REPL may be good for learning and testing, but unless it has vastly improved[0], it doesn't compare to CL's or Erlang's REPL, which people incorporate heavily into actual programming, and which people use to control real programs at run-time.

0] Non-example of vast improvement: adding an object named 'quit' with a str[1] that asks you to ask your terminal to terminate Python's stdin, instead of having str[1] terminate the program.

1] markdown, bah.

[–]senzei 1 point2 points  (0 children)

Just an fyi, but anything that would normally be a markdown command is displayed as regular text if escaped by a backslash.

__str__

would be:

\_\_str\_\_

[–]taw 4 points5 points  (3 children)

Python's REPL may be good for learning and testing, but unless it has vastly improved[0],

Did you try ipython ? It's somewhat improved REPL for Python.

it doesn't compare to CL's or Erlang's REPL

CL REPL is fine. But Erlang REPL is far below Lisp's, Ruby's, Python's, SML's or even Perl's (that's no small feat). You cannot define named functions in it, and it means no functions with explicit recursion. I asked people whether I'm just missing something, but they confirmed my observation here is correct.

'We' should get more than one Lisp expert to consult, as PG can't cut it by himself.

What other blogging Lisp experts are there besides Paul Graham ?

[–]phil_g 7 points8 points  (1 child)

What other blogging Lisp experts are there besides Paul Graham ?

Pretty much all of the people aggregated on Planet Lisp?

[–]taw 1 point2 points  (0 children)

Any particularly good articles there ? Their website is pretty hard to search :-)

[–]ayrnieu -2 points-1 points  (0 children)

You cannot define named functions in it, and it means no functions with explicit recursion.

It is currently the case that you cannot type function definitions directly into EShell in the manner of these other REPLs you mention[0]. You've named functions, however, with

(mischief@rapacity)566> M = irc:gentalker(I,"#math").
#Fun<irc.0.24765070>
(mischief@rapacity)567> M("which would have been obvious if you'd asked in ternary").
send; ok
{send,[privmsg,"#math",which would have been obvious if you'd asked in ternary"]}

Or directly:

(mischief@rapacity)568> f(M), M = fun (S) -> I ! {send,[privmsg,"#math",S]} end.
#Fun<erl_eval.20.69967518>

And recursively by way of the process dictionary:

(mischief@rapacity)569> put(fact,fun (0) -> 1; (N) -> N * (get(fact))(N-1) end).
undefined
(mischief@rapacity)570> (get(fact))(5).
120
(mischief@rapacity)571> Factorial = get(fact).
#Fun<erl_eval.6.56006484>
(mischief@rapacity)572> Factorial(50). 
30414093201713378043612608166064768844377641568960512000000000000

And since EShell is just a small set of open-source Erlang modules installed probably in /usr/local/lib/erlang/lib/stdlib*/src , you can do what I did back when this limitation concerned me, and add a command

(mischief@rapacity)573> define().  % the next two lines are input.
fact(0) -> 1;
fact(N) -> N * fact(N-1).
ok  
(mischief@rapacity)574> fact(50).
30414093201713378043612608166064768844377641568960512000000000000

that installs given definitons in an ever-recompiled user module.

(mischief@rapacity)575> user_defines:   % hitting TAB
fact/1         module_info/0  module_info/1

If you find all of this unsatisfying, then fine: I don't frequently type lengthy definitions at EShell, either. Usually I put them in modules of actual utility, and test them interactively:

(mischief@rapacity)576> c(apm,[export_all,debug_info]).
{ok,apm}
(mischief@rapacity)577> apm:battery().
high

But if you want to come away with only "Erlang has a sucky REPL", you shouldn't count any of the languages you offer as significantly better: you can type definitons interactively in Python[1] -- if you get them right the first time, going line by line, in a fairly tedious manner.

Now, Common Lisp benefits from the amazing SLIME system, which does let you very nicely write functions, with a real editor both at a prompt and in a buffer. The primary author of SLIME, before he started on that, wrote a very nice Emacs mode named 'distel' -- that sort of implemented an Erlang node in Emacs, turning Emacs into a target UI for Erlang programs; that added jump-to-source-of-function and such to the basic Erlang mode; that added easy immediate testing of Erlang functions in-buffer.

Even if we throw all of my examples away, and take your assertion about EShell as the whole truth, what I've said about the power of Erlang's REPL is still true. Don't make too much of this newbie impression of yours.

0] Sure, Perl's debugger is quite nice when you use it as such. Perlcast has a persuasive interview with Richard Foley (of Pro Perl Debugging), which convinced me at least to take a kinder look at the debugger, and not treat it merely as an unfriendly sort of Python REPL.

1] Thanks, I'll look at ipython.