Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > haskell APL perl+maypole/gantry, python smalltalk clisp plt schemehow decide?
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 13th September 15:42
joe knapka
External User
 
Posts: 1
Default haskell APL perl+maypole/gantry, python smalltalk clisp plt schemehow decide?



Umm, BVE did not say he took 9 months to learn
Chicken Scheme; rather, he spend nine months
working on Chicken itself to make various improvements
that he felt were necessary. (That figure appears
in nearly all of his posts; it's pretty hard
to miss :-)

Learning Scheme (at least enough to do interesting
stuff) takes very little time compared to many other
languages. OTOH the particular libraries provided
by the Scheme implementor can, I suppose, be a
challenge. I'm using PLT, and have barely begun
to explore the libraries it ships with. But I'm
able to find what I want with little trouble, since
the PLT docs are quite good (or at least, I haven't
yet hit the Wall of Frustration for PLT docs).

-- JK
  Reply With Quote


 


2 18th September 11:56
jurgen_defurne
External User
 
Posts: 1
Default haskell APL perl+maypole/gantry, python smalltalk clisp plt scheme how decide?



Python may have rolled Perl, but certainly not because Python is more
powerful than Perl. You cannot return an anonymous function/subroutine
in Python which isn't an expression. What I mean is that in Python you
have a lambda operator, but that is much less powerful than Perl's sub
keyword, which makes it possible to do things in Perl that are Lisp
like. In fact, the only thing missing in Perl in comparison to Lisp are
macros.

Python just has a simpler syntax than Perl, that is what makes it
successful. But it is not nearly as powerful as Lisp, or Perl for that
matter.

Regards,

Jurgen
  Reply With Quote
3 18th September 11:56
jurgen_defurne
External User
 
Posts: 1
Default Google Schmoogle


What does it mean to handle code as data ? I like comparing Perl to
Lisp, because with Perl I can do much things that are possible in Lisp.

I think that Perl can handle code as data.

First, there is an eval statement.

Second, substitutions can be done, and they can be done before run-time
using the BEGIN {} or INIT {} clauses.

The only thing that Lisp has is that macros are automatically processed
at compile time. In Perl, you would need to add several BEGIN {} and/or
INIT {} clauses for all macro's you would need to write.

Regards,

Jurgen
  Reply With Quote
4 5th October 21:22
robert uhl
External User
 
Posts: 1
Default haskell APL perl+maypole/gantry, python smalltalk clisp pltscheme how decide?


"jurgen_defurne" <jurgen.defurne@pandora.be> writes:


You can get the same effect with a def form. def x... is the same as
lambda:, it just allows more complex functions. The more important
criterion is that access to outer-scope variables is read-only, although
I am told that there are ways around that too, e.g.:

def anon(foo):
var = [foo]
def func():
var[0] += 1
return var[0]
return func

f = anon(1)
f() -> 2
f() -> 3

Not, perhaps, the most elegant thing but...


*cough* CLOS. And conditions. And a compiler (granted, not all Lisp
implementations have one).

Does Perl have list comprehensions and generators? Serious
question--while my Perl-fu was once pretty good, it's been many years
now, so I really can't remember. And I'm pretty certain that Perl
doesn't allow operator overloading (although whether this is actually
bad is a matter of some disagreement).

Python is also more regular than Perl (no list collapsing or scalar
mangling, which is nice). And its object system--while bolted on--is at
least sane.

Lisp is nicer than Python, but either is nicer than Perl IMHO.

--
Robert Uhl <http://public.xdi.org/=ruhl>
Who does not love wine, women, and song,
Remains a fool his whole life long.
--Johann Heinrich Voss
  Reply With Quote
5 5th October 21:22
nicola mingotti
External User
 
Posts: 1
Default Google Schmoogle


I don't know Perl well but I think you can't do the following
so easily.

This (very)ugly example shows how a Lisp program can modify itself ...
code is data.
It does also something : it counts.

;; ------------
(setq i 1)

(setq program
'(tagbody
start
(format t "~%i --> ~A~%" i)
(format t "-- CODE --: ~%~S" program)
(if (> i 2) (go quit))
(setf (third (second (fifth program))) (+ 1 i))
(setq i (+ i 1))
(sleep 2)
(go start)
quit))

(eval program)
;; ------------


Bye

Nicola Mingotti
  Reply With Quote
6 5th October 21:22
ken tilton
External User
 
Posts: 1
Default Google Schmoogle


Well, it is a gray area, so just because perl can do some tricks does
not mean it has effectively the same power as Lisp. But I do not know
perl so I may not be much help in deciding.

I never use Lisp eval, fwiw.


"can be done"? By you or a preprocessor. Are you talking about something
akin to the C preprocessor? That is certainly useful (I beat on the C
preprocessor like I was its daddy back in my day) but not what we are talking about.


How do you know? Do you know how to write good hairy Lisp macros? If
not, you might want to retract the above.

The key to Lisp code=data is not eval, it is that code is /represented/
just like a form of Lisp data (the list, including nested lists) which
has two huge consequences for macros: they can take apart their code
bodies with all of Lisp's power to dissect lists, and they can generate
code trivially just by producing other lists. Of code.

For another language to offer Lisp macros, the macro keyword would have
to pre-parse the Java or COBOL or Python source and present it to the
macro function as a terribly convenient data structure for that
language, and be prepared to accept same once transformed by the macro
function and produce sensible run-time code therefrom. There then still
is a new burden of understanding the transformation from native syntax
to convenient representation, but as long as they use lists it won't be
too hard.

ken

--
Cells: http://common-lisp.net/project/cells/

"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
  Reply With Quote
7 5th October 21:23
jurgen_defurne
External User
 
Posts: 1
Default haskell APL perl+maypole/gantry, python smalltalk clisp plt scheme how decide?


Allright, I did not know you could do it that way. Last time I tried
returning functions, I tried using anonymous ones. It seems that Python
is capable of returning functions at different addresses.

I do OO programming in Perl. I have a whole OO library built in Perl
for our operations (40000 lines of code approx.). And Perl has an
introspection package (I do not use it, but I know it is there).

Try eval {}; if ($@) {} for conditions. It is not as explicitly defined
as in CL, but is usable and extendable. I have a whole lot of functions
which call external programs, so I made a version of system(), which
checks for the exit status and throws an exception if there has been an
error.

Well, Python doesn't have a compiler either (maybe attempts).


Perl does not have list comprehensions, but since Perl supports
closures and OO, it is quite easy to create generators and iterators in
several different flavours.

I have taken a look at list comprehensions, and it mostly seems
syntactic sugar to generate lists from other lists. I suppose that if
one really needs something like list comprehensions, it is possible to
define them in Perl. I would recommend reading 'Higher-order Perl' from
Mark Jason Dominus to see what can be done with Perl.


I do not have a problem with Perl's OO system.


The only thing I really hate about Perl is its verbose syntax. That is
why I got interested in Scheme and Common Lisp.

Regards,

Jurgen
  Reply With Quote
8 5th October 21:24
jurgen_defurne
External User
 
Posts: 1
Default haskell APL perl+maypole/gantry, python smalltalk clisp plt scheme how decide?


Oh, I almost forgot : Perl does allow operator overloading.

Regards,

Jurgen
  Reply With Quote
9 5th October 21:25
jayessay
External User
 
Posts: 1
Default haskell APL perl+maypole/gantry, python smalltalk clisp plt scheme how decide?


"jurgen_defurne" <jurgen.defurne@pandora.be> writes:


You can do OO programming in C++, Java, or C and assembly for that
matter. That doesn't mean you have anything like the capabilities of
CLOS at hand.


Errors are a proper subset of exceptions which are a proper subset of
conditions. You need to go back and look this over again to
understand the point being made about missing conditions (and CLOS as well).


WRT generators, you're claim here is a vast overstatement.


What's that have to do with the "sanity" (or lack thereof) of it?

^^^^^^ ?!?!?

Wow. First time I've seen "line noise" called "verbose".


/Jon

--
'j' - a n t h o n y at romeo/charley/november com
  Reply With Quote
Reply


Thread Tools
Display Modes




666