Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  helper tools for reading haskell source (Nathan H?sken)
   2. Re:  helper tools for reading haskell source (Henk-Jan van Tuyl)
   3. Re:  helper tools for reading haskell source (Miguel Negrao)
   4. Re:  helper tools for reading haskell source (Joey Hess)
   5.  Antiderivative (indefinite integral)? (Martin Drautzburg)
   6. Re:  Antiderivative (indefinite integral)? (Miguel Negrao)
   7. Re:  Antiderivative (indefinite integral)? (Mateusz Kowalczyk)
   8. Re:  Antiderivative (indefinite integral)? (Martin Drautzburg)
   9. Re:  Antiderivative (indefinite integral)? (Martin Drautzburg)
  10. Re:  Antiderivative (indefinite integral)? (Kim-Ee Yeoh)


----------------------------------------------------------------------

Message: 1
Date: Sat, 19 Jan 2013 13:52:59 +0100
From: Nathan H?sken <nathan.hues...@posteo.de>
Subject: [Haskell-beginners] helper tools for reading haskell source
To: beginners@haskell.org
Message-ID: <50fa972b.3090...@posteo.de>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hey,

Often, when I read haskell code, I would like to know how and where a 
datatype or function is defined.
Normaly I read the code of package, and I then use grep. But when it is 
not defined in the same package, grep can not help me.

Example: I want to know where the datatype Frame and the function 
windowGetChildren in the wxHaskell odule are defined.
I know there is hoogle, but for these it was unable to help me (or I was 
unable to use it correctly?).

So I was wondering, what other tools or methods do you use to "analyse" 
haskell source?

Regards,
Nathan



------------------------------

Message: 2
Date: Sat, 19 Jan 2013 14:04:19 +0100
From: "Henk-Jan van Tuyl" <hjgt...@chello.nl>
Subject: Re: [Haskell-beginners] helper tools for reading haskell
        source
To: beginners@haskell.org, Nathan H?sken        <nathan.hues...@posteo.de>
Message-ID: <op.wq5s9iblpz0...@zen5.arnhem.chello.nl>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Sat, 19 Jan 2013 13:52:59 +0100, Nathan H?sken  
<nathan.hues...@posteo.de> wrote:

> Example: I want to know where the datatype Frame and the function  
> windowGetChildren in the wxHaskell module are defined.
> I know there is Hoogle, but for these it was unable to help me (or I was  
> unable to use it correctly?).

windowGetChildren is defined in wxcore, so you have to enter
   windowGetChildren +wxcore
in the Hoogle search field

Regards,
Henk-Jan van Tuyl


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--



------------------------------

Message: 3
Date: Sat, 19 Jan 2013 13:51:00 +0000
From: Miguel Negrao <miguel.negrao-li...@friendlyvirus.org>
Subject: Re: [Haskell-beginners] helper tools for reading haskell
        source
To: beginners@haskell.org
Message-ID: <045432c1-c456-40b8-9446-c62d92173...@friendlyvirus.org>
Content-Type: text/plain; charset=windows-1252


A 19/01/2013, ?s 12:52, Nathan H?sken escreveu:

> Hey,
> 
> Often, when I read haskell code, I would like to know how and where a 
> datatype or function is defined.
> Normaly I read the code of package, and I then use grep. But when it is not 
> defined in the same package, grep can not help me.
> 
> Example: I want to know where the datatype Frame and the function 
> windowGetChildren in the wxHaskell odule are defined.
> I know there is hoogle, but for these it was unable to help me (or I was 
> unable to use it correctly?).

Also, it?s useful to know that hayoo has access to many more packages then 
hoogle, so I mostly use hayoo now. Also, EclipseFP and Leksah can give you this 
information with a key press or even just hovering the mouse over a function.

best,
Miguel


------------------------------

Message: 4
Date: Sat, 19 Jan 2013 11:58:02 -0400
From: Joey Hess <j...@kitenet.net>
Subject: Re: [Haskell-beginners] helper tools for reading haskell
        source
To: beginners@haskell.org
Message-ID: <20130119155802.gb21...@gnu.kitenet.net>
Content-Type: text/plain; charset="iso-8859-1"

Nathan H?sken wrote:
> Often, when I read haskell code, I would like to know how and where
> a datatype or function is defined.
> Normaly I read the code of package, and I then use grep. But when it
> is not defined in the same package, grep can not help me.
> 
> Example: I want to know where the datatype Frame and the function
> windowGetChildren in the wxHaskell odule are defined.
> I know there is hoogle, but for these it was unable to help me (or I
> was unable to use it correctly?).
> 
> So I was wondering, what other tools or methods do you use to
> "analyse" haskell source?

If you're able to compile the code, you can also load its file in ghci.
Then :i will tell you what module defines a symbol.

-- 
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130119/7d68187a/attachment-0001.pgp>

------------------------------

Message: 5
Date: Sat, 19 Jan 2013 19:55:37 +0100
From: Martin Drautzburg <martin.drautzb...@web.de>
Subject: [Haskell-beginners] Antiderivative (indefinite integral)?
To: beginners@haskell.org
Message-ID: <201301191955.37128.martin.drautzb...@web.de>
Content-Type: Text/Plain;  charset="us-ascii"

Hello all,

not strictly a Haskell question, but anyways ...

is it possible to compute the antiderivative of a function f::Int->Int ? 

I understand that you can compute the definite integral by simply summing up 
the values of f within a given interval.

My first guess would be: no this is not possible. The antiderivative F of a 
function f::Int->Int needs to have the property that F(b) - F(a) must be the 
sum of f within [a,b]. To do this I must know all values withib [a,b]. But at 
the time I compute the antiderivative I do not know this interval yet.

What is striking me is that in calculus I can often symbolically compute the 
antiderivative and I get a simple function, and I can get the value of F for a 
given x and I get a simple number. Why is that so?

-- 
Martin



------------------------------

Message: 6
Date: Sat, 19 Jan 2013 20:25:28 +0000
From: Miguel Negrao <miguel.negrao-li...@friendlyvirus.org>
Subject: Re: [Haskell-beginners] Antiderivative (indefinite integral)?
To: beginners@haskell.org
Message-ID: <be9beab5-6702-48ad-afec-bf2dc4b4a...@friendlyvirus.org>
Content-Type: text/plain; charset=windows-1252


A 19/01/2013, ?s 18:55, Martin Drautzburg escreveu:

> Hello all,
> 
> not strictly a Haskell question, but anyways ...
> 
> is it possible to compute the antiderivative of a function f::Int->Int ? 
> 
> I understand that you can compute the definite integral by simply summing up 
> the values of f within a given interval.
> 
> My first guess would be: no this is not possible. The antiderivative F of a 
> function f::Int->Int needs to have the property that F(b) - F(a) must be the 
> sum of f within [a,b]. To do this I must know all values withib [a,b]. But at 
> the time I compute the antiderivative I do not know this interval yet.
> 
> What is striking me is that in calculus I can often symbolically compute the 
> antiderivative and I get a simple function, and I can get the value of F for 
> a 
> given x and I get a simple number. Why is that so?


        That?s due to the 
http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus together with 
rules for certain functions that allow you to symbolically get your 
antiderivative. Off course, those tricks don?t work for all functions, there 
are functions which are know to have an antiderivative but which cannot be 
given an analytical expression.  
        If you implement the rules I mentioned in haskel then you can get the 
the antiderivative by substitution for a subset of functions which also have to 
be encoded symbolically. 

best,
Miguel


------------------------------

Message: 7
Date: Sat, 19 Jan 2013 20:12:20 +0000
From: Mateusz Kowalczyk <fuuze...@fuuzetsu.co.uk>
Subject: Re: [Haskell-beginners] Antiderivative (indefinite integral)?
To: beginners@haskell.org
Message-ID: <50fafe24.2030...@fuuzetsu.co.uk>
Content-Type: text/plain; charset=windows-1252; format=flowed

I'd like to add that Haskell cafe is probably a better place to ask 
questions like these. Beginners mailing list is a bit more about basics 
of working with Haskell itself while cafe is a lot more meta.

On 19/01/13 20:25, Miguel Negrao wrote:
>
> A 19/01/2013, ?s 18:55, Martin Drautzburg escreveu:
>
>> Hello all,
>>
>> not strictly a Haskell question, but anyways ...
>>
>> is it possible to compute the antiderivative of a function f::Int->Int ?
>>
>> I understand that you can compute the definite integral by simply summing up
>> the values of f within a given interval.
>>
>> My first guess would be: no this is not possible. The antiderivative F of a
>> function f::Int->Int needs to have the property that F(b) - F(a) must be the
>> sum of f within [a,b]. To do this I must know all values withib [a,b]. But at
>> the time I compute the antiderivative I do not know this interval yet.
>>
>> What is striking me is that in calculus I can often symbolically compute the
>> antiderivative and I get a simple function, and I can get the value of F for 
>> a
>> given x and I get a simple number. Why is that so?
>
>
>       That?s due to the 
> http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus together with 
> rules for certain functions that allow you to symbolically get your 
> antiderivative. Off course, those tricks don?t work for all functions, there 
> are functions which are know to have an antiderivative but which cannot be 
> given an analytical expression.
>       If you implement the rules I mentioned in haskel then you can get the 
> the antiderivative by substitution for a subset of functions which also have 
> to be encoded symbolically.
>
> best,
> Miguel
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



------------------------------

Message: 8
Date: Sat, 19 Jan 2013 23:50:26 +0100
From: Martin Drautzburg <martin.drautzb...@web.de>
Subject: Re: [Haskell-beginners] Antiderivative (indefinite integral)?
To: beginners@haskell.org
Message-ID: <201301192350.26798.martin.drautzb...@web.de>
Content-Type: Text/Plain;  charset="iso-8859-15"

On Saturday, 19. January 2013 20:41:32 Denis Kasak wrote:
 However, if
> the same function was given to you as an infinite list of tuples of (x,
> f(x)) you would need to do an infinite number of steps just to compute the
> antiderivative, much less prove anything about it.

An if the function is given as rows in a table (discrete, finite) then I can 
compute the derivative by just looking at two successive values, however for 
the antiderivative I have to look at all values between the lowest possible x 
and the running x.

If the function is discrete but has no lower bound for x, then I cannot 
compute an antiderivative at all, at least not one which will be correct for 
any x. 

I wrote an antiderivative function for discrete values and ended up passing it 
a lower bound for x. IIUC then there is no way to avoid this.

Is this about right?

It is still somewhat strange. For a discrete function f(i) I can compute the 
definite integral F(b) - F(a) but I cannot compute F(a) or F(b) themselves. 
Right?

-- 
Martin



------------------------------

Message: 9
Date: Sat, 19 Jan 2013 23:54:03 +0100
From: Martin Drautzburg <martin.drautzb...@web.de>
Subject: Re: [Haskell-beginners] Antiderivative (indefinite integral)?
To: beginners@haskell.org
Message-ID: <201301192354.04039.martin.drautzb...@web.de>
Content-Type: Text/Plain;  charset="iso-8859-1"

On Saturday, 19. January 2013 22:38:09 Paul Higham wrote:

> Looking at the antiderivative the same way we can write
> 
>       s          = [Int] -> [Int]
>       s []      = []
>       s (f:fs) = scanl (+) f fs

But your function has a well definied starting point. This won't work anymore 
if the function is defined for all negative Ints, right?

-- 
Martin



------------------------------

Message: 10
Date: Sun, 20 Jan 2013 12:50:27 +0700
From: Kim-Ee Yeoh <k...@atamo.com>
Subject: Re: [Haskell-beginners] Antiderivative (indefinite integral)?
To: Martin Drautzburg <martin.drautzb...@web.de>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <CAPY+ZdQ=EYUg_xaeTc6SW2Ou3FEsVZbHc0t8k-N=o_gndni...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Just surveying this thread, it appears a bunch of issues are being mixed-up:

(1) the distinction between continuous and discrete functions, and the
extent to which the latter serves as an approximation of the former

Derivative IS-TO antiderivative IS-TO integral AS (finite) difference IS-TO
"anti-difference" IS-TO (discrete) summation.

(2) the FP notion of closure

I'll respond to a small slice of (1) and most of (2).

(1)

> It is still somewhat strange. For a discrete function f(i) I can compute
the definite integral F(b) - F(a) but I cannot compute F(a) or F(b)
themselves. Right?

In the continuous case, the antiderivative is defined /up to an additive
constant/. In calculating the definite integral, the constant gets
cancelled out because it is the same on both sides of the subtraction.

> What is striking me is that in calculus I can often symbolically compute
the antiderivative and I get a simple function, and I can get the value of
F for a given x and I get a simple number. Why is that so?

So no, you don't get a simple number. It is ambiguous to evaluate the
antiderivative at a point.

Unless you set down an arbitrary rule such as: the antiderivative must pass
through the origin, i.e. F(0)=0.

In the discrete case, you must first fully define which of forward /
backward / central difference you're adopting.

AND adopt some arbitrary rule to deal with the additive constant.

Finally, you can define the anti-difference F(x) of f(x) appropriately to
obtain the equation you desire: F(b)-F(a)=sum of f from a to b inclusive.

> however for the antiderivative I have to look at all values between the
lowest possible x and the running x. If the function is discrete but has no
lower bound for x, then I cannot compute an antiderivative at all, at least
not one which will be correct for any x.

Using the F(0)=0 rule, you'll be summing /about the origin/. So you'd avoid
nastiness like having to sum f(x) starting from "the lowest possible x".

(2)

> The antiderivative F of a function f::Int->Int needs to have the property
that F(b) - F(a) must be the sum of f within [a,b]. To do this I must know
all values withib [a,b]. But at the time I compute the antiderivative I do
not know this interval yet.

It's easy to write an integrator :: (Int -> Int) -> Int -> Int -> Int,
where integrator takes a function f, and bounds of the interval a and b. By
partially applying to a particular function f1, we get a function Int ->
Int -> Int which integrates f1 given whatever bounds. The latter can be
further partially applied with the lower bound fixed at 0 to obtain a
function Int -> Int, which sums f1 from 0 to the given number.

On the other hand, we can fix the bounds [a,b] to obtain a specialized
integrator: (Int -> Int) -> Int, that varies over the /function/ rather
than over the /interval/.

Partial application (Schemers, read "closure") makes this all possible.

p.s. Everyone, please "Reply to All" to make sure your email gets to the
list reflector at haskell.org. Otherwise your responses are private to
Martin and you lose out on the aspect of community.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130120/99498d04/attachment.htm>

------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 55, Issue 20
*****************************************

Reply via email to