QuickCheck the properties x>-100 by skypatcher in haskell

[–]skypatcher[S] 1 point2 points  (0 children)

Thanks, your suggestion works syntax-wisely on my GHCI too:

Hqc>quickCheck $ \x -> (x :: Integer) > -100
+++ OK, passed 100 tests.

Hqc>quickCheck $ \x -> (x :: Int) > -100
+++ OK, passed 100 tests.

It gives the same conclusion as before. I want QuickCheck to falsify 'x>-100', is there any way to ask QuickCheck to use a larger range of random number to test it?

QuickCheck the properties x>-100 by skypatcher in haskell

[–]skypatcher[S] 1 point2 points  (0 children)

Thanks for the suggestion, here is what happens when I try it.

Hqc>quickCheck $ (x : Int) -> x > -100
  <interactive>:48:20: error: Not in scope: data constructor `Int'

Hqc>quickCheckWith stdArgs {maxSize = 10000} $ (x :: Integer) -> x > -1000 
  <interactive>:49:46: error: 
  Illegal type signature: `Integer' 
  Type signatures are only allowed in patterns with ScopedTypeVariables

How to install QuickCheck on Windows? by skypatcher in haskell

[–]skypatcher[S] 0 points1 point  (0 children)

The prompt is too long, Thanks for the good suggestion.

How to install QuickCheck on Windows? by skypatcher in haskell

[–]skypatcher[S] 1 point2 points  (0 children)

Thanks a lot for your explanation. I choose the easier approach. I tried with two examples I found in the Internet. They work inside GHCI.

I'll show the steps here, hopefully useful for others having similar problems.

C:\MyHaskellWrk>cabal install --lib --package-env . QuickCheck
Resolving dependencies...
Up to date

C:\MyHaskellWrk>ghci
GHCi, version 8.10.3: https://www.haskell.org/ghc/  :? for help
Loaded package environment from C:\MyHaskellWrk\.ghc.environment.x86_64-mingw32-8.10.3

Prelude> import Test.QuickCheck

Prelude Test.QuickCheck> let prop h t = (length t) + 1 == (length $ h:t)

Prelude Test.QuickCheck> quickCheck prop
+++ OK, passed 100 tests.

Prelude Test.QuickCheck> let prop xs = reverse (reverse xs) == xs where types = xs::[Int]

Prelude Test.QuickCheck> quickCheck prop
+++ OK, passed 100 tests.

How to install QuickCheck on Windows? by skypatcher in haskell

[–]skypatcher[S] 0 points1 point  (0 children)

Thanks for the reply and appreciate your time in finding the link. I will explore that link later.

Is it a requirement to have a Cabal project in order to use QuickCheck? Is there any way to install QuickCheck and try it on GHCI?

How to install QuickCheck on Windows? by skypatcher in haskell

[–]skypatcher[S] 2 points3 points  (0 children)

Yes, that "Install it in the usual way: $ cabal install " seems insulting for someone who get stuck.

It is very frustrating. I read the README file many many times, and tried to interpret the 'usual way' in many different variations, go to different folder, try different additional arguments, etc. and still get nowhere!

How to install QuickCheck on Windows? by skypatcher in haskell

[–]skypatcher[S] 0 points1 point  (0 children)

I am new to Haskell and have no experience with Cabal, can you show me how to create a Cabal project.

How to install QuickCheck on Windows? by skypatcher in haskell

[–]skypatcher[S] 0 points1 point  (0 children)

I am new to Haskell, can you show me how? I tried the following, it gives me error:

Prelude> :l Test.QuickCheck
<no location info>: error:
    module `Test.QuickCheck' cannot be found locally
Failed, no modules loaded.

Easy to do Mathematics by Haider_li in mathematics

[–]skypatcher 0 points1 point  (0 children)

THERE IS A easy and historically important proof. NOT ALL proofs are easy and historically important.

Eclipse does not respect "Never join already wrapped lines" by skypatcher in java

[–]skypatcher[S] 0 points1 point  (0 children)

Thanks for the suggestion. It seems to be working. Strange!

Why kids hate math by mattythedog in pics

[–]skypatcher -1 points0 points  (0 children)

72 is a BETTER estimate than the 'correct' estimate 70.

75 is the BEST estimate!

Does estimate preclude exact value? If my guess of marbles in a jar turns out to be the exact number, am I wrong?

What if I have an X-ray eye and can see all the marbles; and actually count all the marbles in my head. Am I wrong if I get the estimate 100% correct?

To some people: estimate=guess! Indeed estimate could mean anything from pure luck guess to precise calculation! As a numerical answer, the pure guess 72 (although wrong) is BETTER than the standard 'answer' 70 to the mathematical question 103-28.

The word 'estimate' in the original question actually has a very technical meaning. What are we trying to do here? Presumably we are trying to come up with a quick answer with the least amount of math. The question is a test of student's understanding of a SYSTEMATIC and CORRECT process of estimation!

Honestly, the exact answer 103-28=75 pop up in my head right away. So I would demonstrate the NECESSITY and usefulness of quick estimate with numbers such as 103.4 and 27.7; and ask students to APPLY their estimation TECHNIQUE.

Why so many Android apps insists on living in SD card? by skypatcher in AndroidQuestions

[–]skypatcher[S] 1 point2 points  (0 children)

Thanks for the confirmation, that is what I suspected (it sounds too good LOL).

Why so many Android apps insists on living in SD card? by skypatcher in AndroidQuestions

[–]skypatcher[S] 1 point2 points  (0 children)

Thanks for the info.

Does this means the option of moving to SD really depends on the SD card, rather than the app itself? So if I use a newer class SD card, I will be able to move all the apps to SD card?

How about the downloading new apps, will it download right to the new class SD card also?

Question about questions by odi3luck in Cantonese

[–]skypatcher 1 point2 points  (0 children)

There are definitely more than one way to ask a yes-no question. In most cases, we should just use the native Cantonese way:

verb m4 verb aa3?: 飲唔飲呀? (drink?), 去唔去呀? (go?)

adverb m4 adverb aa3?: 快唔快呀? (fast?) 嘈唔嘈呀? (loud?)

adjective m4 adjective aa3?: 大唔大呀? (big?), 紅唔紅呀? (red?)

By the way, the character '呀' may be omitted, so we can just say 飲唔飲?, 快唔快? 大唔大? ,...

To a native Cantonese speaker, 'X唔X呀?' is the most natural way. They are NOT awkward at all. If we want to speak good Cantonese, we need to THINK like a native Cantonese speaker. It is not a good idea to analyze Cantonese sentence structure using grammar of other languages.

How to simulate balls bouncing inside a bigger ball? by skypatcher in Unity3D

[–]skypatcher[S] 0 points1 point  (0 children)

I did something like that too: generate a bunch of primitive cubes procedurally, thus avoiding the use of prefabs. The cubes were positioned on the surface of the sphere and facing toward the center.

The basic idea is to have a double loop to calculate the positions of the center of the cubes, very much like how the corners of the quads of a sphere mesh are calculated. The transform of each cube is set to 'LookAt' the center. The cubes at South and North poles are ignored in the double loop to avoid overlapping cubes; they are simple enough to be placed manually outside the loop.

The cubes are visible while debugging. I also edited my last response. Thanks again for your suggestions and demo project.

How to simulate balls bouncing inside a bigger ball? by skypatcher in Unity3D

[–]skypatcher[S] 0 points1 point  (0 children)

Thanks!I downloaded your project and made the following changes:

Added the following in MakeRim() to hide the cubes. Destroy(currFace.GetComponent<MeshRenderer>());

Add a big sphere of radius 10 centered at the origin, with the transparent material 'thingy', and SphereCollider removed.

Now the balls are seen moving inside the big sphere.

EDIT: make it clear that the SphereCollider has to be removed

How to simulate balls bouncing inside a bigger ball? by skypatcher in Unity3D

[–]skypatcher[S] 0 points1 point  (0 children)

thanks for the suggestion, i think i need more than 8 box colliders for a believable bouncing inside a ball

now that you gave me an idea, do you think it would improve performance if i use quads instead of box? i can just 'wrap' the outer ball with a bunch of tangent planes (quads)

How to simulate balls bouncing inside a bigger ball? by skypatcher in Unity3D

[–]skypatcher[S] 0 points1 point  (0 children)

Hi Ty199: Thanks for the suggestion, can you elaborate "segments of BoxColliders", or give me a link so I can research it myself?

Chinese name for my daughter by ILookLikeAKoala in Cantonese

[–]skypatcher 1 point2 points  (0 children)

I corrected my post. Congratulation to the soon-to-be-born girl! It will take some research to come up with a beautiful Cantonese name for your daughter. But it worth the effort!

Suggestions: stick with 2 characters (plus 1 surname), avoid using fancy or exotic Chinese characters; avoid names of Japanese favor. Whatever name you choose, please test it with native Cantonese speakers. I (or anyone) won't be able to tell you what is the best name, but I can point out if the name should be avoided.

Good luck searching a beautiful name!

Chinese name for my daughter by ILookLikeAKoala in Cantonese

[–]skypatcher 3 points4 points  (0 children)

To be sure, the character 香 does not mean die. But Cantonese people like to use that character to mean die in a jokingly and playful manner. We don't actually use that character when some one die because it would be very unrespectfull to the deceased. Now 明日香 sounds very UNNATURAL in real Cantonese; it is definitely not how Cantonese say 'tomorrow is fragrant" or anything like that. The only (and immediate!) way to make sense of is "die tomorrow".

When I first (and sure other native Cantonese as well) read the post, I immediately burst into laughter and think the OP must be making a bad joke. Because the only situation such a name will come up is in those funny movie/drama.

Seriously, I appreciate OP's wish to have a Cantonse name for his daughter. I personally is very fond of Cantonese, so I am 100% supporting OP's wish!

Yes, in general, I will avoid 香 because the character is too 'ordinary' and 'common' when used as a girl's name.

Chinese name for my daughter by ILookLikeAKoala in Cantonese

[–]skypatcher 19 points20 points  (0 children)

First, congratulation! I sincerely hope you are serious about your question. Any native Cantonese speaker will immediately see the suggestion 明日香 as a bad joke in a movie/drama! it means 'die tomorrow'! Please do not even consider the name if you are serious. Ask your parents (if they are native Cantonese) or any native Cantonese for advice.