<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body dir="auto"><div dir="auto"><br></div><div dir="auto">With just a couple of methods in Object , Association and Dictionary, you can have an immediate notation for Dictionaries that looks like:</div><div dir="auto"><br></div><div id="composer_signature" dir="auto"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><div dir="auto"><div><font face="monospace"> dict := (a -> 'apple'), (#b ->
'banana'), (#c -> 'cherry').</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">stp</font></div><div><font face="monospace"><br></font></div></div><div dir="auto">--------</div><div dir="auto"><br></div>Stephen Travis Pope - Ojai, CA, USA<div dir="auto">http://heaveneverywhere.com</div><div dir="auto"><br></div></div><div dir="auto"><br></div><div><br></div><div align="left" dir="auto" style="font-size:100%;color:#000000"><div>-------- Original message --------</div><div>From: Juan Vuletich via Cuis-dev <cuis-dev@lists.cuis.st> </div><div>Date: 7/8/24 5:39 AM (GMT-08:00) </div><div>To: Discussion of Cuis Smalltalk <cuis-dev@lists.cuis.st> </div><div>Cc: Juan Vuletich <juan@cuis.st>, Mark Volkmann <r.mark.volkmann@gmail.com> </div><div>Subject: Re: [Cuis-dev] creating a Dictionary </div><div><br></div></div>
On 7/7/2024 6:06 PM, Mark Volkmann via Cuis-dev wrote:
<blockquote type="cite">
<div dir="ltr">It seems that `Dictionary newFrom:` works with a
run-time literal Array of Association objects and does not work
with a compile-time literal Array or Association objects. For
example, this works:
<div><br>
<div><font face="monospace">as := {#a -> 'apple'. #b ->
'banana'. #c -> 'cherry'}.<br>
d2 := Dictionary newFrom: as.</font><br>
<br class="gmail-Apple-interchange-newline">
</div>
<div>but this gives the error "MessageNotUnderstood:
Symbol>>key".<br>
</div>
<div><br>
</div>
<div>
<div>
<div><font face="monospace">as := #(#a -> 'apple' #b
-> 'banana' #c -> 'cherry').<br>
d2 := Dictionary newFrom: as.</font></div>
<div><br>
</div>
</div>
<div>Can someone explain why?</div>
</div>
</div>
</div>
</blockquote>
<br>
It would really be the best for YOU to start flexing your Smalltalk
muscles. A quick dive with the debugger, and use of inspectors and
browsers, will give you waaaaay more insight that the best
explanation anyone could write.<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><span class="gmail_signature_prefix">-- </span><br>
<div data-smartmail="gmail_signature" class="gmail_signature" dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica, sans-serif">R.
Mark Volkmann</font></div>
<div><span style="font-size: 12.8px;"><font face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
HTH,<br>
<pre cols="72" class="moz-signature">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body></html>