Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Haskell ghc, linking error when trying to compile a program
using ghc and Euterpea (Florian Gillard)
2. Re: : GCJ 2015 - Round 1A Problem - Haircut (Kostiantyn Rybnikov)
3. definition of >>= for lists (Stanislaw Findeisen)
4. Re: definition of >>= for lists (Erik Stevenson)
5. Re: Variable re-use (Stanislaw Findeisen)
----------------------------------------------------------------------
Message: 1
Date: Sat, 2 May 2015 15:19:48 +0200
From: Florian Gillard <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Haskell ghc, linking error when trying to
compile a program using ghc and Euterpea
Message-ID:
<caglpzlwmsqg4ifuoaonctcfhf+xru_20495msdmqlljgdxg...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I am checking out the computing music development library Euterpea, and I
am trying to compile the following basic program:
import Euterpea
t251 :: Music Pitch
t251 = let dMinor = d 4 wn :=: f 4 wn :=: a 4 wn
gMajor = g 4 wn :=: b 4 wn :=: d 5 wn
cMajor = c 4 bn :=: e 4 bn :=: g 4 bn
in dMinor :+: gMajor :+: cMajor
main = play t251
the program works fine inside ghci, but when I try to compile it using ghc
test.hs I get the following error message:
Linking test ... /usr/bin/ld:
/home/fayong/.cabal/lib/PortMidi-0.1.3/ghc-7.6.3/libHSPortMidi-0.1.3.a(ptlinux.o):
undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing
from command line collect2: error: ld returned 1 exit status
It seems to be a linking error but I don't know how to fix it. (I tried to
pass -lpthread as an option but it didn't work)
I installed Euterpea via cabal, on linux mint 17
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150502/846ca0b5/attachment-0001.html>
------------------------------
Message: 2
Date: Sun, 3 May 2015 11:04:59 +0300
From: Kostiantyn Rybnikov <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] : GCJ 2015 - Round 1A Problem -
Haircut
Message-ID:
<CAAbahfSMCKJ6y0Mdf2r2y9fNca=0DL1B3=nez575nxejcks...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Instead of looking at it as an estimate, you can look at it as a
"summarized speed of all barbers".
It would let you know much time would it take to cut everyone before you.
Afterwards you'd need to go through barbers and find the first one that
would become available after this time-period.
Do you think this makes sense?
27 ????. 2015 05:40 "Gregory Guthrie" <[email protected]> ????:
> Seems to me that an estimate won't help, one has to know exactly how much
> to skip over.
>
> I did this:
> Find the lowest common multiple (lcm), and then from that the shortest
> cycle of services,
> And then skip any multiple of those from the customer queue.
>
> sim :: Problem -> [Result]
> sim (n, ts) = serve tSkip (servers ts)
> -- optimize; skip ahead over server cycles...
> where tsLcm = (foldl lcm $ head ts) $ tail ts
> tCycle = sum $ map (div tsLcm) ts
> tSkip = n - (div n tCycle)*tCycle
>
> (Some fixup is needed for tSkip=0, one easy one is to force an extra
> cycle.)
> > ----------------------------------------------------------------------
> > Message: 1
> > Date: Sat, 18 Apr 2015 10:29:11 -0400
> > From: Doug McIlroy <[email protected]>
> > To: [email protected]
> > Cc: [email protected]
> > Subject: Re: [Haskell-beginners] GCJ 2015 - Round 1A Problem - Haircut
> > Message-ID: <[email protected]>
> > Content-Type: text/plain; charset=us-ascii
> >
> > > Can someone tell me how I could have avoided or fixed this?
> >
> > The trouble manifested as stack overflow on solving
> >
> > > https://code.google.com/codejam/contest/4224486/dashboard#s=p1
> >
> > For efficiency, you'll probably need more cleverness in math than in
> Haskell. You can predict
> > an approximate start time for the Nth customer's service from the
> average per-customer
> > service time M, where 1/M = sum 1/M_k.
> > Starting from that estimate, one can skip over almost the entire service
> simulation.
> >
> > Doug McIlroy
> >
> >
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150503/862e6fde/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 03 May 2015 12:48:09 +0200
From: Stanislaw Findeisen <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] definition of >>= for lists
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Hi
Where is the definition of (>>=) for lists? I was trying to locate it
using Hoogle but no luck. :(
--
http://people.eisenbits.com/~stf/
http://www.eisenbits.com/
OpenPGP: 9EC2 5620 2355 B1DC 4A8F 8C79 0EC7 C214 E5AE 3B4E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150503/dfae8524/attachment-0001.sig>
------------------------------
Message: 4
Date: Sun, 3 May 2015 07:03:50 -0400
From: Erik Stevenson <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] definition of >>= for lists
Message-ID:
<CAA4Ncsf=WC5JfYOnWL3Wd3Nu=51s_SwatheBqh1gZ=1ymps...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
instance Monad [] where {-# INLINE (>>=) #-} xs >>= f
= [y | x <- xs, y <- f x] {-# INLINE (>>) #-} (>>) = (*>)
{-# INLINE return #-} return x = [x] {-# INLINE fail
#-} fail _ = []
source:
https://hackage.haskell.org/package/base-4.8.0.0/docs/src/GHC-Base.html#line-726
Found link on:
https://hackage.haskell.org/package/base-4.8.0.0/docs/Control-Monad.html by
scrolling down to the list of monad instances.
On Sun, May 3, 2015 at 6:48 AM, Stanislaw Findeisen <
[email protected]> wrote:
> Hi
>
> Where is the definition of (>>=) for lists? I was trying to locate it
> using Hoogle but no luck. :(
>
> --
> http://people.eisenbits.com/~stf/
> http://www.eisenbits.com/
>
> OpenPGP: 9EC2 5620 2355 B1DC 4A8F 8C79 0EC7 C214 E5AE 3B4E
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150503/b0978c14/attachment-0001.html>
------------------------------
Message: 5
Date: Sun, 03 May 2015 13:02:22 +0200
From: Stanislaw Findeisen <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Variable re-use
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
On 2015-04-28 12:15, Alexey Shmalko wrote:
> I'm sorry, my example should've been:
>
> [1,2,3] >>= \a -> [a+1] >>= \a -> return a
Or just:
[1,2,3] >>= (return . (+1))
--
http://people.eisenbits.com/~stf/
http://www.eisenbits.com/
OpenPGP: 9EC2 5620 2355 B1DC 4A8F 8C79 0EC7 C214 E5AE 3B4E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150503/ac70f2e3/attachment-0001.sig>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 83, Issue 2
****************************************