One can also define the adverb as:

   SuchThat=. '#~u' (adverb :)

   assert (((1000&<)@:*:) suchthat i. 100) -: ((1000&<)@:*:) SuchThat i. 100

or, tacitly, as:

   st=. ((#~)`) (`:6)

   assert (((1000&<)@:*:) suchthat i. 100) -: ((1000&<)@:*:) st i. 100


On Fri, Dec 26, 2014 at 12:07 PM, Jon Hough <jgho...@outlook.com> wrote:

>
>
> Another example
> suchthat =: adverb define
> (#~u) y
>
> )
> Find all positive int x less than 100 such that x^2 > 1000
>
>
>  ((1000&<)@:*:) suchthat i. 100
> This seems to be what I wanted.
> Come to think of it, since the expression is
> {x | x < 100 AND x^2 > 1000}
>
> the i. 100 part should belong on the left side since it is part of the
> "such that" condition.
>
> > Date: Fri, 26 Dec 2014 09:00:15 -0800
> > From: rogerhui.can...@gmail.com
> > To: programm...@jsoftware.com
> > Subject: Re: [Jprogramming] "Such that" syntax in J
> >
> > Using -: in that context requires extra parens.  Besides, ←→ is prettier.
> >
> > On Fri, Dec 26, 2014 at 8:52 AM, R.E. Boss <r.e.b...@outlook.com> wrote:
> > >
> > > Why not use the primitive '-:' ?
> > >
> > > (+/(1+i._)^-s) -: */%1-(p:i._)^-s
> > >
> > >
> > > R.E. Boss
> > >
> > >
> > > > -----Original Message-----
> > > > From: programming-boun...@forums.jsoftware.com [mailto:programming-
> > > > boun...@forums.jsoftware.com] On Behalf Of Roger Hui
> > > > Sent: vrijdag 26 december 2014 17:28
> > > > To: Programming forum
> > > > Subject: Re: [Jprogramming] "Such that" syntax in J
> > > >
> > > > ←→ are metasymbols, commonly used in mathematics to denote
> > > > equivalence.
> > > >
> > > >
> > > >
> > > > On Fri, Dec 26, 2014 at 8:20 AM, Jon Hough <jgho...@outlook.com>
> wrote:
> > > > >
> > > > > Thanks for replying.
> > > > >
> > > > > I'm confused about two things.
> > > > >
> > > > > (1) I'm worried I haven't explained myself well.
> > > > > I mean I want to find all x given g(x) is true for some function g.
> > > > >
> > > > > i.e. the set { x | g(x) is true }
> > > > > (You may have answered this, I need to read your example more
> > > carefully,
> > > > > but this leads me to problem 2...)
> > > > >
> > > > > (2) I don't understand what
> > > > > ←→
> > > > > means in terms of J. These are not ASCII characters or J
> primitives.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > > Date: Fri, 26 Dec 2014 08:13:40 -0800
> > > > > > From: rogerhui.can...@gmail.com
> > > > > > To: programm...@jsoftware.com
> > > > > > Subject: Re: [Jprogramming] "Such that" syntax in J
> > > > > >
> > > > > > f x
> > > > > >
> > > > > > where x is an array of all values of interest.  For (countably)
> > > infinite
> > > > > > sets you have to express x in terms of i._ .  For example, to
> > > express the
> > > > > > Euler product formula for the Riemann zeta function,
> > > > > >
> > > > > >    +/(1+i._)^-s ←→ */%1-(p:i._)^-s
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Fri, Dec 26, 2014 at 8:04 AM, Jon Hough <jgho...@outlook.com>
> > > > wrote:
> > > > > > >
> > > > > > > In Haskell (and other languages I'm sure) one can express the
> idea
> > > of
> > > > > > > "such that" to denote one expression depending on another. In
> > > Haskell
> > > > > we
> > > > > > > can use the syntax:
> > > > > > >
> > > > > > > [ f x | x <- xs ]
> > > > > > >
> > > > > > > which means
> > > > > > >  "the list of all f x
> > > > > > > such that x is drawn from xs."
> > > > > > >
> > > > > > > So | is syntactically similar to the English "such that". (and
> very
> > > > > much
> > > > > > > like | in mathematical sets)
> > > > > > >
> > > > > > > I would like to know if J has a construct to express the above
> > > Haskell
> > > > > > > code.
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Jon.
> > > > > > >
> > > > > > >
> > > ----------------------------------------------------------------------
> > > > > > > For information about J forums see
> > > > http://www.jsoftware.com/forums.htm
> > > > > > >
> > > > > >
> > > ----------------------------------------------------------------------
> > > > > > For information about J forums see
> > > > http://www.jsoftware.com/forums.htm
> > > > >
> > > > >
> ----------------------------------------------------------------------
> > > > > For information about J forums see
> > > > http://www.jsoftware.com/forums.htm
> > > > >
> > > >
> ----------------------------------------------------------------------
> > > > For information about J forums see
> http://www.jsoftware.com/forums.htm
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to