Is there a Haskell function for calculating the power of one Integer to another?

-3

I am currently solving a Haskell problem where the question asks me to use as few tokens as possible. As a function used between backticks (including the backticks) marks counts as one token, it would make my code very efficent to have a pow function I can use.

This is an extract of my code, and how I am trying to use this function 1 `shiftL` 16 ^ x `shiftL` 5

The problem is that 1 `shiftL` 16 ^ x `shiftL` 5 does not compile, and I am trying to avoid using parenthesis in my equation (((1 `shiftL` 16) ^ x) `shiftL` 5) as they count for 2 tokens.

Does anyone know of an Import or standard function that can solve my problem?

More info in the comments of my initial stack exchange question: https://stackoverflow.com/questions/60455683/is-there-a-haskell-function-for-calculating-the-power-of-one-integer-to-another?noredirect=1#comment106950394_60455683

FatBaz

Posted 2020-02-28T16:46:12.737

Reputation: 11

Question was closed 2020-02-28T19:51:54.047

Free imports seem ripe for exploitation. What modules are fair game? I'm wondering if there's some combinator or plumbing modules that can help a lot. Can you do import ... as ... for free too? – xnor – 2020-02-28T17:24:19.153

Also, please include information from the SO question and comments in the question body rather than in a link. How parens and imports count for scoring is important to know. More generally, the token-based scoring is not how code golf usually works here, and answers might need to know exactly how the score is counted. Can you which things count as a token and/or link to somewhere that can gives counts on examples? – xnor – 2020-02-28T17:35:48.403

This is all the information I am given on the topic, so I am not too sure about that: – FatBaz – 2020-02-28T17:51:12.487

"The shortest (in terms of the number of tokens) solution wins! Our official token-counting program is available here. Library imports and the module declaration are excluded from the token count." With the token counter being http://people.inf.ethz.ch/mraszyk/fpcomp/Tokenize.hs

– FatBaz – 2020-02-28T17:51:15.687

8

The competition page has this as an ongoing contest and says "Finally, the MC employs a zero tolerance policy against plagiarism. Please compete fairly and individually." So it looks like it's not fair game to solicit help here.

– xnor – 2020-02-28T18:01:03.147

Fair enough, my bad. I was was thinking of only getting a single function to work with, and though that might be ok. Upon rethinking, I agree with you, so I'll try to find a solution on my own. Thank you for trying to help anyways. – FatBaz – 2020-02-28T23:20:12.973

No answers