!1 1.5 2
1 1.32934 2

To get the middle value in Haskell you probably need something like
http://www.haskell.org/haskellwiki/?title=Gamma_and_Beta_function&oldid=25546

Except, that seems to be a deleted page, for some reason, so maybe what you
are supposed to do is use the logGamma function (
http://hackage.haskell.org/package/math-functions-0.1.1.2/docs/Numeric-SpecFunctions.html#g:1)
and then find e to that power. So it's completely unambiguous, once you've
decided on the appropriate data type and which version of haskell you are
using and the underlying specification designed by someone who was probably
just making stuff up.

There's some problem here, from my point of view, one of which has to do
with a fundamental misunderstanding of how we process language. Words are
inherently ambiguous because they are symbols - they refer to collections
of experiences (which will vary from person to person, but which will also
have commonalities from person to person). And we build sentences and
discussions where a part of the process is to constrain the topic to the
point where we are comfortable that we've a general agreement on what's
being said. (But even that drifts during the course of a conversation.)

Anyways... some people are going to like Haskell, and that's fine. It can
be a fun language, but like any language it will have flaws. And the more
popular a language is, the more criticism it's going to get and the more
useful stuff will be encoded using it, and the harder it will be to find
the useful stuff (because there will also be more useless stuff).

You just sort of have to live with the flaws while getting stuff done that
you find useful.

For myself, I like J and see a lot of potential in it, but it's not the
same potential that I see in Haskell. Still, this is a J forum, not a
Haskell forum, so I should also probably stick with J here and (since this
is the programming forum) I should also include some J code.

It's sort of like the difference between being busy and getting stuff done.

So...

Here's an expression that will convert Gray Code to Binary:
   ~:/\&.|:

So here's an example of converting Binary to Gray Code:
   ~:/\&.|:inv #:i.8
0 0 0
0 0 1
0 1 1
0 1 0
1 1 0
1 1 1
1 0 1
1 0 0

That's fun, in my opinion. And I don't need contrasts with other languages
to make it so.

More generally, one of the things I really like about J is how many
concepts "just work". There's a lot of thought and care that went into the
language and that makes it expressive in a fun way.

Thanks,

-- 
Raul



On Thu, May 29, 2014 at 3:03 AM, Aai <[email protected]> wrote:

> J:
>
> +/ ,.&.": !100x
>
> Haskell:
> (almost 1:1 translation)
>
> foldr (+) 0 $ map digitToInt $ show $ product [1..100]
>
> Let's define a factorial function
>
> let factorial = product. enumFromTo 1
>
> then
>
> foldr (+) 0 $ map digitToInt $ show $ factorial 100
> \--------/   \--------------------/
>     +/               ,.&.":               !100x
>
> Data.Char and Data.List are needed here. They belong to the basic
> libraries of a Haskell installation.
>
>
>
>
>
> On 29-05-14 01:41, 'elton wang' via Programming wrote:
>
>> This may not be a good example to show Haskell's relative strength. All
>> the expressiveness comes from the handy function "digits", which is belong
>> to a package in Haskell, you have to "import Data.Digit" or something.
>>
>>
>>
>>
>>
>> On Wednesday, May 28, 2014 11:35 AM, Jon Hough <[email protected]>
>> wrote:
>>
>>
>> Project Euler 16 is defined:
>> 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is
>> the sum of the digits of the number 21000?
>> http://projecteuler.net/problem=16
>>
>>
>> My J solution:NB. create base
>> base =. 302 $ 10
>>
>> digitsum =. +/ @:(base & #:)"1@: (1000x &(^~))   digitsum 2
>> As a J beginner, clearly my code is not as terse or as elegant as it
>> could be. But browsing the solution forums I found this Haskell solution:
>> sum $ digits 10 $ 2^1000
>>
>> I don't know Haskell but the above code pretty much speaks for itself.
>> Clearly the solution is terse, simple and easy to understand.Comparing
>> Haskell to J, it seems one of J's strong points, terseness and rapid
>> program developing, doesn't hold up to Haskell so much as it does against
>> C-style languages.
>> So my question is, what advantages does J hold over Haskell, in terms of
>> speed, terseness etc?
>> Regards.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
> --
> Met vriendelijke groet,
> @@i = Arie Groeneveld
>
>
> ----------------------------------------------------------------------
> 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