Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #256718 > unrolled thread
| Started by | coreyh@free.fr |
|---|---|
| First post | 2023-04-04 04:40 +0200 |
| Last post | 2023-04-08 17:00 +0200 |
| Articles | 20 on this page of 31 — 13 participants |
Back to article view | Back to linux.debian.user
my immature thoughts on perl coreyh@free.fr - 2023-04-04 04:40 +0200
Re: my immature thoughts on perl Greg Wooledge <greg@wooledge.org> - 2023-04-04 05:00 +0200
Re: my immature thoughts on perl David Christensen <dpchrist@holgerdanske.com> - 2023-04-04 05:40 +0200
Re: my immature thoughts on perl coreyh@free.fr - 2023-04-04 06:00 +0200
Re: my immature thoughts on perl <tomas@tuxteam.de> - 2023-04-04 07:00 +0200
Re: my immature thoughts on perl Greg Wooledge <greg@wooledge.org> - 2023-04-04 13:20 +0200
Re: my immature thoughts on perl <tomas@tuxteam.de> - 2023-04-04 13:30 +0200
Re: my immature thoughts on perl Ken Peng <k.peng@att.net> - 2023-04-04 13:50 +0200
Re: my immature thoughts on perl Will Mengarini <seldon@eskimo.com> - 2023-04-04 06:10 +0200
Re: my immature thoughts on perl Vincent Lefevre <vincent@vinc17.net> - 2023-04-04 10:40 +0200
Re: my immature thoughts on perl john doe <johndoe65534@mail.com> - 2023-04-04 09:10 +0200
Re: my immature thoughts on perl Andy Smith <andy@strugglers.net> - 2023-04-04 15:50 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-07 21:30 +0200
Re: my immature thoughts on perl "Andrew M.A. Cater" <amacater@einval.com> - 2023-04-07 22:10 +0200
Re: my immature thoughts on perl <tomas@tuxteam.de> - 2023-04-08 07:40 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-08 14:40 +0200
Re: my immature thoughts on perl <tomas@tuxteam.de> - 2023-04-09 07:20 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-09 09:50 +0200
Re: my immature thoughts on perl Stefan Monnier <monnier@iro.umontreal.ca> - 2023-04-09 17:20 +0200
Re: my immature thoughts on perl "Andrew M.A. Cater" <amacater@einval.com> - 2023-04-09 17:30 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-09 17:50 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-09 17:40 +0200
Re: my immature thoughts on perl coreyh@free.fr - 2023-04-08 01:10 +0200
Re: my immature thoughts on perl <tomas@tuxteam.de> - 2023-04-08 07:40 +0200
Re: my immature thoughts on perl davidson <davidson@freevolt.org> - 2023-04-08 08:10 +0200
Re: my immature thoughts on perl <tomas@tuxteam.de> - 2023-04-09 07:20 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-08 14:50 +0200
Re: my immature thoughts on perl Stefan Monnier <monnier@iro.umontreal.ca> - 2023-04-08 18:30 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-08 18:50 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-08 19:00 +0200
Re: my immature thoughts on perl Emanuel Berg <incal@dataswamp.org> - 2023-04-08 17:00 +0200
Page 1 of 2 [1] 2 Next page →
| From | coreyh@free.fr |
|---|---|
| Date | 2023-04-04 04:40 +0200 |
| Subject | my immature thoughts on perl |
| Message-ID | <GgEKt-hcuQ-1@gated-at.bofh.it> |
Hello list,
I am not that familiar with perl (though I like it), but I found it
maybe have two flaws as follows.
1. doesn't have an interactive shell.
2. the block statement (like lambda) is ugly.
For instance, in ruby (irb) this is quite smooth:
irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
=> 14
And in scala (shell):
scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
res1: Int = 14
In perl there is no interactive shell, and the block statement seems
strange:
$ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
14
How do you think of it?
Thanks
Corey
[toc] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2023-04-04 05:00 +0200 |
| Message-ID | <GgF3P-hcBr-1@gated-at.bofh.it> |
| In reply to | #256718 |
On Tue, Apr 04, 2023 at 10:35:39AM +0800, coreyh@free.fr wrote:
> For instance, in ruby (irb) this is quite smooth:
>
> irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
> => 14
>
>
> And in scala (shell):
>
> scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
> res1: Int = 14
And Tcl:
unicorn:~$ rlwrap tclsh
% ::tcl::mathop::+ {*}[lmap x {1 2 3 4} {expr {$x+1}}]
14
As long as we're collecting solutions.
> In perl there is no interactive shell, and the block statement seems
> strange:
>
> $ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
> 14
I'm not as experienced with perl. I don't know how to shorten that.
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2023-04-04 05:40 +0200 |
| Message-ID | <GgFGx-hd3u-1@gated-at.bofh.it> |
| In reply to | #256718 |
On 4/3/23 19:35, coreyh@free.fr wrote:
> Hello list,
>
> I am not that familiar with perl (though I like it), but I found it
> maybe have two flaws as follows.
>
> 1. doesn't have an interactive shell.
> 2. the block statement (like lambda) is ugly.
>
> For instance, in ruby (irb) this is quite smooth:
>
> irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
> => 14
>
>
> And in scala (shell):
>
> scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
> res1: Int = 14
>
> In perl there is no interactive shell, and the block statement seems
> strange:
>
> $ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
> 14
>
>
> How do you think of it?
>
> Thanks
> Corey
That post would be better sent to the Perl Beginner's mailing list:
https://lists.perl.org/list/beginners.html
David
[toc] | [prev] | [next] | [standalone]
| From | coreyh@free.fr |
|---|---|
| Date | 2023-04-04 06:00 +0200 |
| Message-ID | <GgFZT-hd9Y-1@gated-at.bofh.it> |
| In reply to | #256718 |
On 04/04/2023 11:50, Will Mengarini wrote:
> * coreyh@free.fr <coreyh@free.fr> [23-04/04=Tu 10:35 +0800]:
>> For instance, in ruby (irb) this is quite smooth:
>> irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
>> => 14
>>
>> And in scala (shell):
>> scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
>> res1: Int = 14
>
>> In perl there is no interactive shell [...]
>
> perl -le 'print eval $_ while <>'
>
>> In perl [...] the block statement seems strange:
>> $ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
>> 14
>
> perl -le '@x=(1..4); print eval join "+", map $_+1, @x'
>
> Too bad this is two days late, but Perl is an April 1 kind of language.
I heard in perl never 'eval' a string. :)
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2023-04-04 07:00 +0200 |
| Message-ID | <GgGVY-hdPw-1@gated-at.bofh.it> |
| In reply to | #256722 |
[Multipart message — attachments visible in raw view] — view raw
On Tue, Apr 04, 2023 at 11:52:57AM +0800, coreyh@free.fr wrote: [...] > I heard in perl never 'eval' a string. :) Never say never :) That said... there are better things to eval in Perl than a string, so if you have the choice, think twice. But you have got to think anyway if you are programming. In Tcl, OTOH, EIAS (Everything Is A String), so you've got to eval strings (don't take me too seriously: modern Tcl cheats, and it's more "Everything looks like a string", but I disgress). Cheers -- t
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2023-04-04 13:20 +0200 |
| Message-ID | <GgMRI-hhKG-11@gated-at.bofh.it> |
| In reply to | #256724 |
On Tue, Apr 04, 2023 at 06:50:02AM +0200, tomas@tuxteam.de wrote:
> In Tcl, OTOH, EIAS (Everything Is A String), so you've got
> to eval strings (don't take me too seriously: modern Tcl
> cheats, and it's more "Everything looks like a string",
> but I disgress).
The introduction of the {*} operator eliminated a lot of the need for
eval. Instead of
eval myfunc $listvar
now, you can do
myfunc {*}$listvar
which "expands" the list variable and passes each element as a separate
argument. This is much cleaner, because it lets you decide where and
when you want to perform that expansion. eval forces you to expand
everything in the command where it's used.
In the context of this thread, you can do things like:
% namespace import ::tcl::mathop::+
% + 1 2 3 4
10
% set nums {1 2 3 4}
1 2 3 4
% + {*}$nums
10
% + {*}[lmap x $nums {+ $x 1}]
14
Which is the most elegant way to express the desired piece of code in Tcl,
as far as I'm aware. lmap returns a list, and {*} expands it for the
mathop + command to use.
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2023-04-04 13:30 +0200 |
| Message-ID | <GgN1n-hhOa-1@gated-at.bofh.it> |
| In reply to | #256731 |
[Multipart message — attachments visible in raw view] — view raw
On Tue, Apr 04, 2023 at 07:12:05AM -0400, Greg Wooledge wrote:
> On Tue, Apr 04, 2023 at 06:50:02AM +0200, tomas@tuxteam.de wrote:
> > In Tcl, OTOH, EIAS [...]
> The introduction of the {*} operator eliminated a lot of the need for
> eval. Instead of
[...]
Thanks for the reminder :)
I think watching carefully Tcl's evolution teaches a lot about
languages, the type of design decisions going into them and their
(changing) context.
Cheers
--
t
[toc] | [prev] | [next] | [standalone]
| From | Ken Peng <k.peng@att.net> |
|---|---|
| Date | 2023-04-04 13:50 +0200 |
| Message-ID | <GgNkJ-hhVI-1@gated-at.bofh.it> |
| In reply to | #256732 |
tomas@tuxteam.de wrote: > I think watching carefully Tcl's evolution teaches a lot about > languages, the type of design decisions going into them and their > (changing) context. I was surprised to see many people here still use TCL. Many years ago I used this language for sysadmin jobs. It was working just fine. -- https://kenpeng.pages.dev/
[toc] | [prev] | [next] | [standalone]
| From | Will Mengarini <seldon@eskimo.com> |
|---|---|
| Date | 2023-04-04 06:10 +0200 |
| Message-ID | <GgFZT-hd9Y-3@gated-at.bofh.it> |
| In reply to | #256718 |
* coreyh@free.fr <coreyh@free.fr> [23-04/04=Tu 10:35 +0800]:
> For instance, in ruby (irb) this is quite smooth:
> irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
> => 14
>
> And in scala (shell):
> scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
> res1: Int = 14
> In perl there is no interactive shell [...]
perl -le 'print eval $_ while <>'
> In perl [...] the block statement seems strange:
> $ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
> 14
perl -le '@x=(1..4); print eval join "+", map $_+1, @x'
Too bad this is two days late, but Perl is an April 1 kind of language.
[toc] | [prev] | [next] | [standalone]
| From | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| Date | 2023-04-04 10:40 +0200 |
| Message-ID | <GgKmR-hg4J-3@gated-at.bofh.it> |
| In reply to | #256723 |
On 2023-04-03 20:50:22 -0700, Will Mengarini wrote:
> * coreyh@free.fr <coreyh@free.fr> [23-04/04=Tu 10:35 +0800]:
> > For instance, in ruby (irb) this is quite smooth:
> > irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
> > => 14
> >
> > And in scala (shell):
> > scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
> > res1: Int = 14
>
> > In perl there is no interactive shell [...]
>
> perl -le 'print eval $_ while <>'
https://metacpan.org/pod/Shell::Perl
https://stackoverflow.com/questions/73667/how-can-i-start-an-interactive-console-for-perl
TIMTOWTDI :-)
> > In perl [...] the block statement seems strange:
> > $ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
> > 14
>
> perl -le '@x=(1..4); print eval join "+", map $_+1, @x'
Though I have already used the eval+join trick a few years ago, this
is rather ugly. Using List::Util with "reduce" is probably better:
https://metacpan.org/pod/List::Util
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
[toc] | [prev] | [next] | [standalone]
| From | john doe <johndoe65534@mail.com> |
|---|---|
| Date | 2023-04-04 09:10 +0200 |
| Message-ID | <GgIXL-hfj5-1@gated-at.bofh.it> |
| In reply to | #256718 |
On 4/4/23 04:35, coreyh@free.fr wrote: > Hello list, > Would it be possible to refrain from using the list for OT stuff. Your Perl threads are generating traffic that are not useful. -- John Doe
[toc] | [prev] | [next] | [standalone]
| From | Andy Smith <andy@strugglers.net> |
|---|---|
| Date | 2023-04-04 15:50 +0200 |
| Message-ID | <GgPcR-hj9I-1@gated-at.bofh.it> |
| In reply to | #256718 |
Hello, On Tue, Apr 04, 2023 at 10:35:39AM +0800, coreyh@free.fr wrote: > How do you think of it? I think you should use Ruby if you like Ruby better! Honestly, we aren't the "I'd Like An Argument Please" sketch; if we were then you'd have to be paying. As it stands I am only doing this in my spare time. That is, why are you asking people to convince you to like Perl? There are lots of languages and you appear to have found one you like better. Cheers, Andy -- https://bitfolk.com/ -- No-nonsense VPS hosting
[toc] | [prev] | [next] | [standalone]
| From | Emanuel Berg <incal@dataswamp.org> |
|---|---|
| Date | 2023-04-07 21:30 +0200 |
| Message-ID | <GhZWx-sLi-1@gated-at.bofh.it> |
| In reply to | #256740 |
Andy Smith wrote: > I think you should use Ruby if you like Ruby better! Perl is the best language, maybe Lisp is the best language. But everything else isn't as good. -- underground experts united https://dataswamp.org/~incal
[toc] | [prev] | [next] | [standalone]
| From | "Andrew M.A. Cater" <amacater@einval.com> |
|---|---|
| Date | 2023-04-07 22:10 +0200 |
| Message-ID | <Gi0zf-tej-1@gated-at.bofh.it> |
| In reply to | #256842 |
On Fri, Apr 07, 2023 at 09:28:59PM +0200, Emanuel Berg wrote: > Andy Smith wrote: > > > I think you should use Ruby if you like Ruby better! > > Perl is the best language, maybe Lisp is the best language. > But everything else isn't as good. > Every categorical generalisation is wrong. (Even this one :) ) Andy > -- > underground experts united > https://dataswamp.org/~incal >
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2023-04-08 07:40 +0200 |
| Message-ID | <Gi9sS-yPt-7@gated-at.bofh.it> |
| In reply to | #256843 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Apr 07, 2023 at 08:09:12PM +0000, Andrew M.A. Cater wrote: > On Fri, Apr 07, 2023 at 09:28:59PM +0200, Emanuel Berg wrote: > > Andy Smith wrote: > > > > > I think you should use Ruby if you like Ruby better! > > > > Perl is the best language, maybe Lisp is the best language. > > But everything else isn't as good. > > > > Every categorical generalisation is wrong. (Even this one :) ) Heh: I usually taunt people with "All generalizations suck". Great minds think alike, it seems. (I usually leave the "but hey, this is a generalization, too" as an exercise for the reader ;-) Cheers -- t
[toc] | [prev] | [next] | [standalone]
| From | Emanuel Berg <incal@dataswamp.org> |
|---|---|
| Date | 2023-04-08 14:40 +0200 |
| Message-ID | <Gig1k-CYD-3@gated-at.bofh.it> |
| In reply to | #256854 |
tomas wrote: >>> Perl is the best language, maybe Lisp is the best >>> language. But everything else isn't as good. >> >> Every categorical generalisation is wrong. (Even this one >> :) ) > > I usually taunt people with "All generalizations suck". Can't it be the exception to confirm the rule? But ... the exception should be the opposite, or maybe where the function is not defined - singularity, don't remember the word. No, that was it, right? Anyway, here the exception would then be All generalizations are bad, except the on that says they are. No, that makes sense, right? It's the exception! B) - counting the votes then ... - and, from the Z System, 19 Million Buckazoid for Lisp! - expected, they are always pro Lisp - it's the only planet system we know of where they do scientific research even - scientific research? - on Lisp - aah, oh :) - like we say, they are firmly in the Lisp camp. but +19 noted, let's move on -- underground experts united https://dataswamp.org/~incal
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2023-04-09 07:20 +0200 |
| Message-ID | <GivD4-MRC-5@gated-at.bofh.it> |
| In reply to | #256863 |
[Multipart message — attachments visible in raw view] — view raw
On Sat, Apr 08, 2023 at 02:37:56PM +0200, Emanuel Berg wrote: > tomas wrote: > > >>> Perl is the best language, maybe Lisp is the best > >>> language. But everything else isn't as good. > >> > >> Every categorical generalisation is wrong. (Even this one > >> :) ) > > > > I usually taunt people with "All generalizations suck". > > Can't it be the exception to confirm the rule? There is a barber in Crete who shaves all men who don't shave themselves [1]. Cheers [1] https://en.wikipedia.org/wiki/Barber_paradox -- t
[toc] | [prev] | [next] | [standalone]
| From | Emanuel Berg <incal@dataswamp.org> |
|---|---|
| Date | 2023-04-09 09:50 +0200 |
| Message-ID | <GixYe-Odz-3@gated-at.bofh.it> |
| In reply to | #256934 |
tomas wrote: > There is a barber in Crete who shaves all men who don't > shave themselves [1] > https://en.wikipedia.org/wiki/Barber_paradox Yeah, but that isn't really a paradox, is it? It's like all the programs that will increase inflation :) -- underground experts united https://dataswamp.org/~incal
[toc] | [prev] | [next] | [standalone]
| From | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| Date | 2023-04-09 17:20 +0200 |
| Message-ID | <GiEZH-SKa-1@gated-at.bofh.it> |
| In reply to | #256934 |
>> > I usually taunt people with "All generalizations suck".
>> Can't it be the exception to confirm the rule?
> There is a barber in Crete who shaves all men who don't
> shave themselves [1].
You're just pointing out that *impredicative* generalizations suck even
more than the rest.
Stefan
[toc] | [prev] | [next] | [standalone]
| From | "Andrew M.A. Cater" <amacater@einval.com> |
|---|---|
| Date | 2023-04-09 17:30 +0200 |
| Message-ID | <GiF9n-SNn-11@gated-at.bofh.it> |
| In reply to | #256971 |
On Sun, Apr 09, 2023 at 11:18:14AM -0400, Stefan Monnier wrote: > >> > I usually taunt people with "All generalizations suck". > >> Can't it be the exception to confirm the rule? > > There is a barber in Crete who shaves all men who don't > > shave themselves [1]. > You don't want to believe that - Epimenides the Cretan asserts that "all Cretans are liars" > You're just pointing out that *impredicative* generalizations suck even > more than the rest. > > > Stefan > All best, as ever, Andy
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.debian.user
csiph-web