Hashes not yet supported?

39 views
Skip to first unread message

Joaquin Menchaca

unread,
Aug 7, 2014, 7:39:49 PM8/7/14
to pash-p...@googlegroups.com
My basic hash test doesn't work. :'(

PASH /Users/testuser/pubarea/script-tut/powershell> h00.associative.ps1
The expression type 'System.Management.Automation.Language.IndexExpressionAst' is currently not supported for assignments
  +CategoryInfo: InvalidOperation, Reason: NotImplementedException
  +FullyQualifiedErrorId: PipelineError

PASH /Users/testuser/pubarea/script-tut/powershell> cat h00.associative.ps1
# create empty hash
$ages = @{}
# individually build hash
$ages["bob"]=34
$ages["ed"]=58
$ages["steve"]=32
$ages["ralph"]=23
$ages["deb"]=46
$ages["kate"]=19
# print out results
"Keys  (names): " + $ages.keys    # print enumerated list of keys
"Values (ages): " + $ages.values  # print enumerated list of values

Joaquin Menchaca

unread,
Aug 7, 2014, 7:42:16 PM8/7/14
to pash-p...@googlegroups.com
Also...

PASH /Users/testuser/pubarea/script-tut/powershell> h10.associative.ps1

Operator `+' cannot be applied to operands of type `System.Collections.Hashtable' and `System.Collections.Hashtable'
  +CategoryInfo: InvalidOperation, Reason: RuntimeBinderException
  +FullyQualifiedErrorId: PipelineError

PASH /Users/testuser/pubarea/script-tut/powershell> cat h10.associative.ps1
# build/populate hash
$ages = @{"bob"=34; "ed"=58; "steve"=32; "ralph"=23}
# merge new hash into existing hash
$ages += @{"deb"=46; "kate"=19}
# output results
foreach ($name in $ages.keys) {   # cycle through whole list
  " ages[$name]=" + $ages[$name]  # print out each element
}


Stefan Burnicki

unread,
Aug 8, 2014, 3:06:43 PM8/8/14
to pash-p...@googlegroups.com
The missing feature of concatenating Hashsets will be part of a commit that will find its way to the project in the next days. Then this should work

Stefan Burnicki

unread,
Aug 8, 2014, 3:07:33 PM8/8/14
to pash-p...@googlegroups.com
Oh, and the feature with indexing a Hashset via [] will also be part of that commit.

Joaquin Menchaca

unread,
Aug 17, 2014, 6:41:34 PM8/17/14
to pash-p...@googlegroups.com
I hope it is alright that I express:

AWESOMENESS
Reply all
Reply to author
Forward
0 new messages