Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16910 > unrolled thread

Chained-functional notation examples?

Started byUnknown <dog@gmail.com>
First post2014-05-06 06:26 +0000
Last post2014-05-09 06:06 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Chained-functional notation examples? Unknown <dog@gmail.com> - 2014-05-06 06:26 +0000
    Re: Chained-functional notation examples? Unknown <dog@gmail.com> - 2014-05-07 06:45 +0000
    Re: Chained-functional notation examples? roby <roby.nowak@gmail.com> - 2014-05-09 06:06 +0000

#16910 — Chained-functional notation examples?

FromUnknown <dog@gmail.com>
Date2014-05-06 06:26 +0000
SubjectChained-functional notation examples?
Message-ID<lk9vb6$66t$1@smc.vnet.net>
I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature of
unix-piping [functional notation].  He claims [& I believe him] that Mathematica has a better, more consistent notation.  But the facility of PRE, IN & POST-fix alternatives, seems bad.  You want ONE way of acieving the goal. More rules just increases mental load.

A major benefit of functional [unix-piping] programming style, is that you
don't need to remember the-full-journey: you just need to remember the previous stage's output. Nor do you need to remember several names: the previous output is just "it".  A superficial read through a recent article[s] here, about <collecting data from several servers, and agregating it, and sending the result to a master> seemed very interesting, and matches my ideas of using functional programming.  But I can't afford to invest in ANOTHER notation/syntax, without good prospect of productivety increase.

Just as a test, how would Mathematica handle the following [or part of]
little task:

search all files in Dir=tree D |
 which are less than N days-old |
 and which contain string S1 |
 and which contain string S2 .

Actually, this seems not a good example, since it's biased towards the *nix
file system's format/syntax.

Try:
Search in table of ListOfOpenFiles for lineS with path-P [field] |
 which have same tty-field as line with path-P2 & program-M [field]

This sounds like a data-base problem?

Or is there a nice list of 'such' Mathematica examples?

 Thanks,

== John Grant.

[toc] | [next] | [standalone]


#16914

FromUnknown <dog@gmail.com>
Date2014-05-07 06:45 +0000
Message-ID<lkckph$hbe$1@smc.vnet.net>
In reply to#16910
On Tue, 06 May 2014 06:26:46 +0000, Unknown wrote:

> I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature of
> unix-piping [functional notation].  He claims [& I believe him] that
> Mathematica has a better, more consistent notation.  But the facility of
> PRE, IN & POST-fix alternatives, seems bad.  You want ONE way of
> acieving the goal. More rules just increases mental load.
> 
> A major benefit of functional [unix-piping] programming style, is that
> you don't need to remember the-full-journey: you just need to remember
> the previous stage's output. Nor do you need to remember several names:
> the previous output is just "it".  A superficial read through a recent
> article[s] here, about <collecting data from several servers, and
> agregating it, and sending the result to a master> seemed very
> interesting, and matches my ideas of using functional programming.  But
> I can't afford to invest in ANOTHER notation/syntax, without good
> prospect of productivety increase.
> 
> Just as a test, how would Mathematica handle the following [or part of]
> little task:
> 
> search all files in Dir=tree D |
>  which are less than N days-old |
>  and which contain string S1 |
>  and which contain string S2 .
> 
> Actually, this seems not a good example, since it's biased towards the
> *nix file system's format/syntax.
> 
> Try:
> Search in table of ListOfOpenFiles for lineS with path-P [field] |
>  which have same tty-field as line with path-P2 & program-M [field]
> 
> This sounds like a data-base problem?
> 
> Or is there a nice list of 'such' Mathematica examples?
> 
>  Thanks,
> 
> == John Grant.

Here's a related real-live problem:
 list all files in Dir-tree:D |
 which are less-than daysOld:N |
 and contain "egal" in the FullPathName |
  and contain String:"uid" OR "UID"

[toc] | [prev] | [next] | [standalone]


#16927

Fromroby <roby.nowak@gmail.com>
Date2014-05-09 06:06 +0000
Message-ID<lkhr8d$dvd$1@smc.vnet.net>
In reply to#16910
Am Dienstag, 6. Mai 2014 08:26:46 UTC+2 schrieb Unknown:
> I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature of
>
> unix-piping [functional notation].  He claims [& I believe him] that Mathematica has a better, more consistent notation.  But the facility of PRE, IN & POST-fix alternatives, seems bad.  You want ONE way of acieving the goal. More rules just increases mental load.
>
>
>
> A major benefit of functional [unix-piping] programming style, is that you
>
> don't need to remember the-full-journey: you just need to remember the previous stage's output. Nor do you need to remember several names: the previous output is just "it".  A superficial read through a recent article[s] here, about <collecting data from several servers, and agregating it, and sending the result to a master> seemed very interesting, and matches my ideas of using functional programming.  But I can't afford to invest in ANOTHER notation/syntax, without good prospect of productivety increase.
>
>
>
> Just as a test, how would Mathematica handle the following [or part of]
>
> little task:
>
>
>
> search all files in Dir=tree D |
>
>  which are less than N days-old |
>
>  and which contain string S1 |
>
>  and which contain string S2 .
>
>
>
> Actually, this seems not a good example, since it's biased towards the *nix
>
> file system's format/syntax.
>
>
>
> Try:
>
> Search in table of ListOfOpenFiles for lineS with path-P [field] |
>
>  which have same tty-field as line with path-P2 & program-M [field]
>
>
>
> This sounds like a data-base problem?
>
>
>
> Or is there a nice list of 'such' Mathematica examples?
>
>
>
>  Thanks,
>
>
>
> == John Grant.


Well, I think that postfixing by use of the Mathematica Postfix operator "//"
accompanied by use of Mathematica pure Function "&" with access to the last result =
by using Mathematica Slot "#" (argument to the pure Function)
mimics *nix piping best:

the following gets all files of "c:/temp" in all sub dirs
older than 200 days
containing at least one of the strings "str1", "str2" :


"c:/temp" //
FileNames["*", #, Infinity]& //
Select[#, DateDifference[FileDate[#], DateList[]] > 200 &]& //
Select[#, StringMatchQ[#, "*str1*"] || StringMatchQ[#, "*str2*"]&] &

Regards Robert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web