Skip to main content

Haskell, 31 bytes

Haskell functionfunction - 31

import List
f=(.sort).(==).sort

Haskell programprogram - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Usage:

$ runghc anagram.hs
boat
boat
True
$ runghc anagram.hs
toab
boat
True
$ runghc anagram.hs
a
aa
False

Kudos to lambdabot and its pointfree refactoring.

Haskell function - 31

import List
f=(.sort).(==).sort

Haskell program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Usage:

$ runghc anagram.hs
boat
boat
True
$ runghc anagram.hs
toab
boat
True
$ runghc anagram.hs
a
aa
False

Kudos to lambdabot and its pointfree refactoring.

Haskell, 31 bytes

function - 31

import List
f=(.sort).(==).sort

program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Usage:

$ runghc anagram.hs
boat
boat
True
$ runghc anagram.hs
toab
boat
True
$ runghc anagram.hs
a
aa
False

Kudos to lambdabot and its pointfree refactoring.

added 173 characters in body
Source Link
Joey Adams
  • 10.6k
  • 3
  • 35
  • 56

Haskell function - 31

import List
f=(.sort).(==).sort

Haskell program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Usage:

$ runghc anagram.hs
boat
boat
True
$ runghc anagram.hs
toab
boat
True
$ runghc anagram.hs
a
aa
False

Kudos to lambdabot and its pointfree refactoring.

Haskell function - 31

import List
f=(.sort).(==).sort

Haskell program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Kudos to lambdabot and its pointfree refactoring.

Haskell function - 31

import List
f=(.sort).(==).sort

Haskell program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Usage:

$ runghc anagram.hs
boat
boat
True
$ runghc anagram.hs
toab
boat
True
$ runghc anagram.hs
a
aa
False

Kudos to lambdabot and its pointfree refactoring.

Added the function back
Source Link
Joey Adams
  • 10.6k
  • 3
  • 35
  • 56

Haskell programfunction - 5831

import List
g=getLine
main=f=(`fmap`g.sort).(==).sort

Haskell program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==).sort=<<g=<<g

Kudos to lambdabot and its pointfree refactoring.

Haskell program - 58

import List
g=getLine
main=(`fmap`g).(.sort).(==).sort=<<g

Kudos to lambdabot and its pointfree refactoring.

Haskell function - 31

import List
f=(.sort).(==).sort

Haskell program - 81 58 55

import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Kudos to lambdabot and its pointfree refactoring.

added 67 characters in body
Source Link
Joey Adams
  • 10.6k
  • 3
  • 35
  • 56
Loading
Source Link
Joey Adams
  • 10.6k
  • 3
  • 35
  • 56
Loading