|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alpha: God damned crazy language! I can't tell what type anything is!
Gamma: Well it's no good shouting about it. It's a perfectly well-typed
expression.
Beta: Let it go kid, it's not wise to upset a Python programmer.
Gamma: But sir, nobody complains that Python is dynamically typed.
Beta: That's because in Python people don't write functions that take a
list of functions, compose them into a single function, return a
high-order function that takes a function and applies it to the result
of the first function, apply 0 to that, execute the resulting function
on an empty list and finally return an Integer. Haskell programmers have
been known to do that.
Gamma: ...I quite see your point, sir.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid XP v8 <voi### [at] devnull> wrote:
> Alpha: God damned crazy language! I can't tell what type anything is!
>
> Gamma: Well it's no good shouting about it. It's a perfectly well-typed
> expression.
>
> Beta: Let it go kid, it's not wise to upset a Python programmer.
>
> Gamma: But sir, nobody complains that Python is dynamically typed.
>
> Beta: That's because in Python people don't write functions that take a
> list of functions, compose them into a single function, return a
> high-order function that takes a function and applies it to the result
> of the first function, apply 0 to that, execute the resulting function
> on an empty list and finally return an Integer. Haskell programmers have
> been known to do that.
>
> Gamma: ...I quite see your point, sir.
I don't quite see your point. Scheme programmers have been doing it for decades
without static typing systems getting in the way. :)
Python programmers are mostly imperative programmers and don't see the point in
so much functions and so little builtin loops.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> I don't quite see your point. Scheme programmers have been doing it for decades
> without static typing systems getting in the way. :)
I don't know what Scheme is.
People claim that Lisp is a functional language, but it doesn't look
very functional to me. But Lisp apparently allows you to do something
similar too... Whether it is "common" for Lisp programs to actually
works like this is another matter. ;-)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Invisible <voi### [at] devnull> wrote:
> nemesis wrote:
>
> > I don't quite see your point. Scheme programmers have been doing it for decades
> > without static typing systems getting in the way. :)
>
> I don't know what Scheme is.
>
> People claim that Lisp is a functional language, but it doesn't look
> very functional to me. But Lisp apparently allows you to do something
> similar too... Whether it is "common" for Lisp programs to actually
> works like this is another matter. ;-)
Common Lisp is the "industrial-strength" Lisp idiom. It's basically a mix of
several old Lisps with a bit of Scheme. Scheme is a minimalist Lisp idiom
designed mainly for research and education. The many implementations make sure
it's able to do a lot more.
Old Lispers are indeed pretty imperative but Scheme is a strict, eager
evaluation, mostly functional language which solves problems mostly by function
application and applicative programming. Mutators (set!) and direct
side-effecting IO are still present, but using sparingly. It's very much like
ML, except with sweet regular syntax, no builtin pattern matching and no static
typing. Of course, you may probably don't know what ML is, but Google is your
friend. You may eventually learn about Haskell's ancestry...
Here's an example of Scheme code:
(let ((%? (lambda (a b) (zero? (modulo a b)))))
(let sum ((i 5) (r 0))
(if (= i 100000) r
(sum (+ 1 i) (if (or (%? i 5) (%? i 7))
(+ r i)
r)))))
Forget the parentheses. Besides all, they are a great aid for structured
editing of source code in appropriate editors, like replacing a whole large
parenthetical expression in a breeze.
You could try downloading
http://download.plt-scheme.org/drscheme/
And running it. Not necessarily the fastest Scheme implementation (that would
be the Stalin native compiler), but a very complete and sound all-around
implementation and friendly programming environment.
BTW, you seem to enjoy math and programming and since there are so many things
you don't know, perhaps this is a good opportunity for showing you this?
http://projecteuler.net/
It's a very popular, friendly, free-time contest of math/programming problems.
Register, pick a favorite language, enter the correct answer to the problems
and eventually become an Eulerian:
http://projecteuler.net/index.php?section=scores&show=eulerians
It's very fun. The statistics page is a finding... :)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> BTW, you seem to enjoy math and programming and since there are so many
> things
> you don't know, perhaps this is a good opportunity for showing you this?
>
> http://projecteuler.net/
Hehe, did you look in p.o-t.f.h.b.b.b ?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> BTW, you seem to enjoy math and programming and since there are so many things
> you don't know, perhaps this is a good opportunity for showing you this?
>
> http://projecteuler.net/
As Scott said - it's on that other newsgroup. I don't know if it's been
discussed in a while, though.
I did about 100 problems. Would like to get back to them, but they tend
to eat up my hours.
--
Vultures only fly with carrion luggage.
/\ /\ /\ /
/ \/ \ u e e n / \/ a w a z
>>>>>>mue### [at] nawazorg<<<<<<
anl
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
scott wrote:
>> BTW, you seem to enjoy math and programming and since there are so
>> many things
>> you don't know, perhaps this is a good opportunity for showing you this?
>>
>> http://projecteuler.net/
>
> Hehe, did you look in p.o-t.f.h.b.b.b ?
>
Now I see. I should've known Mathematical Orchid would know it better. :)
Well, I won't be looking at the ones I didn't do yet, spoils all the fun. :P
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> Common Lisp is the "industrial-strength" Lisp idiom. It's basically a mix of
> several old Lisps with a bit of Scheme. Scheme is a minimalist Lisp idiom
> designed mainly for research and education. The many implementations make sure
> it's able to do a lot more.
>
> Old Lispers are indeed pretty imperative but Scheme is a strict, eager
> evaluation, mostly functional language which solves problems mostly by function
> application and applicative programming. Mutators (set!) and direct
> side-effecting IO are still present, but using sparingly. It's very much like
> ML, except with sweet regular syntax, no builtin pattern matching and no static
> typing. Of course, you may probably don't know what ML is, but Google is your
> friend.
ML I have at least heard of. The vague impression I have is that it's
kind of similar to Haskell, but insane.
> You may eventually learn about Haskell's ancestry...
AFAIK, Haskell is basically Miranda(tm) with a few minor modifications.
(Oh, and type classes.)
> Here's an example of Scheme code:
> (let ((%? (lambda (a b) (zero? (modulo a b)))))
> (let sum ((i 5) (r 0))
> (if (= i 100000) r
> (sum (+ 1 i) (if (or (%? i 5) (%? i 7))
> (+ r i)
> r)))))
>
> Forget the parentheses. Besides all, they are a great aid for structured
> editing of source code in appropriate editors, like replacing a whole large
> parenthetical expression in a breeze.
I think you'd need to colour code expressions by depth or something to
really make sense of that. Really deeply nested expressions are
difficult to parse visually. (I also imagine that without assistence it
would be very hard to make all the parentheses match up correctly...)
> BTW, you seem to enjoy math and programming and since there are so many things
> you don't know, perhaps this is a good opportunity for showing you this?
>
> http://projecteuler.net/
I did a few of them, but the later ones are too hard. (And, frankly, not
very interesting.)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Invisible wrote:
> nemesis wrote:
> ML I have at least heard of. The vague impression I have is that it's
> kind of similar to Haskell, but insane.
They both look insane to me. ;)
>> You may eventually learn about Haskell's ancestry...
>
> AFAIK, Haskell is basically Miranda(tm) with a few minor modifications.
> (Oh, and type classes.)
Yes, but ML was the one to really begin it all. OCaml is it's current
popular iteration, as well as F# from Microsoft.
>> Here's an example of Scheme code:
>> (let ((%? (lambda (a b) (zero? (modulo a b)))))
>> (let sum ((i 5) (r 0))
>> (if (= i 100000) r
>> (sum (+ 1 i) (if (or (%? i 5) (%? i 7))
>> (+ r i)
>> r)))))
> I think you'd need to colour code expressions by depth or something to
> really make sense of that. Really deeply nested expressions are
> difficult to parse visually.
Not at all. Prefix syntax makes everything very clear: most everything
in the begining of a list is a function or macro and the rest are
arguments, like
(+ 1 i) or ((lambda (x) (* x x)) 3)
Identifiers can have symbols like "?".
> (I also imagine that without assistence it
> would be very hard to make all the parentheses match up correctly...)
Not at all, if notepad is all you got, just be sure to always open and
close in sequence, then position between and continue typing. Of
course, I won't comment on identation in this case. :D
But any slightly advanced editor gives you parentheses matching for free.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> They both look insane to me. ;)
OK, fair enough.
>>> You may eventually learn about Haskell's ancestry...
>>
>> AFAIK, Haskell is basically Miranda(tm) with a few minor
>> modifications. (Oh, and type classes.)
>
> Yes, but ML was the one to really begin it all. OCaml is it's current
> popular iteration, as well as F# from Microsoft.
I haven't really looked at OCaml.
I looked at Clean. (It isn't.) And also F# (which seemed really ugly).
>> I think you'd need to colour code expressions by depth or something to
>> really make sense of that. Really deeply nested expressions are
>> difficult to parse visually.
>
> Not at all. Prefix syntax makes everything very clear: most everything
> in the begining of a list is a function or macro and the rest are
> arguments, like
> (+ 1 i) or ((lambda (x) (* x x)) 3)
I'm having trouble seeing which thing a given subexpression is the
argument to. To do that, you have to count brackets. It's not
impossible, just not very easy.
>> (I also imagine that without assistence it would be very hard to make
>> all the parentheses match up correctly...)
>
> Not at all, if notepad is all you got, just be sure to always open and
> close in sequence, then position between and continue typing. Of
> course, I won't comment on identation in this case. :D
>
> But any slightly advanced editor gives you parentheses matching for free.
SciTE gives me paren matching, but apparently it doesn't understand
Haskell syntax, so it fails to comprehend that anything inside quote
marks is a literal string and so shouldn't be matched against... :-S
Maybe I should go write a text editor of my own...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|