JSON/q

A JSON-based data access specification

Arguments

[
  [
    "from   ", 
    " salt", 
    " earn ", 
    "  last   ", 
    " near ", 
    " form  "
  ]
]

Query

{
  "group": {
    "using": "anagram_comparator", 
    "into": "words", 
    "by": "w.trim()"
  }, 
  "as": "w", 
  "from": "args[0]", 
  "select": {
    "words": "words", 
    "key": "words.key"
  }
}

Results

[
  {
    "words": [
      "from", 
      "form"
    ], 
    "key": "fomr"
  }, 
  {
    "words": [
      "salt", 
      "last"
    ], 
    "key": "alst"
  }, 
  {
    "words": [
      "earn", 
      "near"
    ], 
    "key": "aenr"
  }
]