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. Re:  [Haskell-cafe] I think someone had a complicated program
      to use brackets for array indexing - is it possible to use a DSL
      for this? (KC)
   2. Re:  [Haskell-cafe] I think someone had a complicated program
      to use brackets for array indexing - is it possible to use a DSL
      for this? (KC)
   3. Re:  [Haskell-cafe] I think someone had a complicated program
      to use brackets for array indexing - is it possible to use a DSL
      for this? (Christopher Allen)
   4. Re:  best way to code this~~ ([email protected])
   5.  How to use trigonometric functions with  Data.Scientific?
      (Martin Vlk)


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

Message: 1
Date: Mon, 1 Jun 2015 13:56:45 -0700
From: KC <[email protected]>
To: Brandon Allbery <[email protected]>
Cc: Tikhon Jelvis <[email protected]>, Haskell Beginners
        <[email protected]>, haskell-cafe <[email protected]>
Subject: Re: [Haskell-beginners] [Haskell-cafe] I think someone had a
        complicated program to use brackets for array indexing - is it
        possible to use a DSL for this?
Message-ID:
        <camlkxyn-0zgbjrvd1atjog+a8btejyjmr1kquz8mjbw0njb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I'm a part time tutor even though I don't look Elizabethan

I was trying to lower the learning curve for students

Maybe I'll point them to
http://dev.stephendiehl.com/hask/
And
Data.Vector

--
--

Sent from an expensive device which will be obsolete in a few months! :D

Casey

On Jun 1, 2015 1:35 PM, "Brandon Allbery" <[email protected]> wrote:

> On Mon, Jun 1, 2015 at 4:29 PM, KC <[email protected]> wrote:
>
>> Then a tuple might work better as input to a function to index into an
>> array
>>
>> e.g. myArray  (5)
>>
>
> Aside from 1-tuples not being a thing? (That's the same as (myArray 5).)
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> [email protected]
> [email protected]
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150601/6a72d28c/attachment-0001.html>

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

Message: 2
Date: Mon, 1 Jun 2015 18:00:33 -0700
From: KC <[email protected]>
To: Tikhon Jelvis <[email protected]>
Cc: Richard O'Keefe <[email protected]>, Haskell Beginners
        <[email protected]>, haskell-cafe <[email protected]>
Subject: Re: [Haskell-beginners] [Haskell-cafe] I think someone had a
        complicated program to use brackets for array indexing - is it
        possible to use a DSL for this?
Message-ID:
        <CAMLKXyk=x0ouxxfsx98ggnzbp6pbkqs9+aja1ydhpe1rt7z...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Jun 1, 2015 5:52 PM, "Tikhon Jelvis" <[email protected]> wrote:
If you teach them about how operators are normal functions in Haskell,
using an operator to index into an array makes the indexing operation less
magical?a big pedagogical boon, in my view. The fewer special cases in the
language you're teaching, the better, and looking similar to other
languages is not a good reason for a special case.

Especially since the similarity could be misleading!)

Good point (s)

--
--

Sent from an expensive device which will be obsolete in a few months! :D

Casey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150601/4b1c250c/attachment-0001.html>

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

Message: 3
Date: Mon, 1 Jun 2015 20:06:42 -0500
From: Christopher Allen <[email protected]>
To: Tikhon Jelvis <[email protected]>
Cc: [email protected], Haskell Beginners <[email protected]>,
        haskell-cafe <[email protected]>
Subject: Re: [Haskell-beginners] [Haskell-cafe] I think someone had a
        complicated program to use brackets for array indexing - is it
        possible to use a DSL for this?
Message-ID:
        <cadnndoox5tnjev0vypotxgsx8vougs7adi13j9tgu_onouq...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Strongly agreed with ok and Tikhon. I've tried these weird pidgins and
localized fabrications wrapped around Haskell before, it's only a stumbling
block.

Haskell is simple, you don't have to lie - just encourage them not to draw
false analogies.

On Mon, Jun 1, 2015 at 7:52 PM, Tikhon Jelvis <[email protected]> wrote:

> If you teach them about how operators are normal functions in Haskell,
> using an operator to index into an array makes the indexing operation less
> magical?a big pedagogical boon, in my view. The fewer special cases in the
> language you're teaching, the better, and looking similar to other
> languages is not a good reason for a special case.
>
> Especially since the similarity could be misleading!)
>
> On Mon, Jun 1, 2015 at 5:48 PM, <[email protected]> wrote:
>
>> > I'm a part time tutor even though I don't look Elizabethan
>> >
>> > I was trying to lower the learning curve for students
>>
>> Using square brackets for array indexing in Haskell
>> would be more a case of putting a stumbling block in
>> their way than lowering the learning curve.
>>
>> Fortran uses A(I), not A[I], and has for the last fifty-some
>> years.  The official definition of Simula 67 uses A(I) as
>> well, despite its predecessor Algol 60 using a[i].  COBOL
>> uses A(I), and has done so nearly as long as Fortran.  PL/I
>> (yes, it still exists) uses A(I), not A[I].  BASIC uses
>> A(I), this is still so in Visual Basic.NET.  If memory
>> serves me correctly, MINITAB uses parentheses, not brackets.
>>
>> Is a pattern beginning to emerge?
>>
>> Lying to the students by implicitly telling them "all programming
>> languages use square brackets for array indexing" will be doing
>> them no favour.  Even lying about Haskell is no kindness.
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150601/5850f943/attachment-0001.html>

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

Message: 4
Date: Mon, 1 Jun 2015 20:35:57 -0700
From: <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] best way to code this~~
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII

On Mon, 01 Jun 2015 16:10:47 +0000
Alex Hammel <[email protected]> wrote:

Thank you so much for all the info !  Really appreciate it.

> extract :: [String] -> [(String,b)] -> ([String],[b])
> extract xs assocs =
>     let xs' = map uppercase xs
>         eithers = map (\x -> lookupEither x assocs) xs'
>         -- spoilers: same as [ lookupEither x assocs | x <- xs' ]
>     in partitionEithers eithers

> 
> This differs slightly from your algorithm in that it returns
> '(["BAR"],[1]), where yours would return (["Bar"],[1]). If preserving
> the original case in the output, I would either write a

ok. big surprise, i like your version much better.
however, i'm unclear why you didn't just use

  eithers = map (\x -> lookupEither (uppercase x) assocs) xs

instead of mapping everything to uppercase first.

meanwhile i need to get with the list comprehension program.  i use python list 
comprehensions all the time, and yet i continue to use map in haskell. how 
weird is that ?


Brian


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

Message: 5
Date: Tue, 02 Jun 2015 10:51:41 +0000
From: Martin Vlk <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] How to use trigonometric functions with
        Data.Scientific?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

Hi, I am writing a program to do some astronomical calculation, and I am
using the Data.Scientific library to represent my floating point
numbers. Would anyone know how to use trigonometric functions with the
Scientific type?

I see:
a :: Scientific
a = scientific 500036 (-5)

sin :: Floating a => a -> a

-- this won't work
wrongType = sin a

Any ideas?

Many Thanks
Martin


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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 84, Issue 3
****************************************

Reply via email to