[Cuis-dev] creating a Dictionary

Stephen Travis Pope stephen at heaveneverywhere.com
Tue Jul 9 08:12:19 PDT 2024


With just a couple of methods in Object , Association and Dictionary, you can have an immediate notation for Dictionaries that looks like:    dict := (a -> 'apple'), (#b ->
              'banana'), (#c -> 'cherry').stp--------Stephen Travis Pope - Ojai, CA, USAhttp://heaveneverywhere.com
-------- Original message --------From: Juan Vuletich via Cuis-dev <cuis-dev at lists.cuis.st> Date: 7/8/24  5:39 AM  (GMT-08:00) To: Discussion of Cuis Smalltalk <cuis-dev at lists.cuis.st> Cc: Juan Vuletich <juan at cuis.st>, Mark Volkmann <r.mark.volkmann at gmail.com> Subject: Re: [Cuis-dev] creating a Dictionary 
    On 7/7/2024 6:06 PM, Mark Volkmann via Cuis-dev wrote:
    
      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:
        
          as := {#a -> 'apple'. #b ->
              'banana'. #c -> 'cherry'}.
              d2 := Dictionary newFrom: as.
            
          
          but this gives the error "MessageNotUnderstood:
            Symbol>>key".
          
          
          
          
            
              as := #(#a -> 'apple' #b
                  -> 'banana' #c -> 'cherry').
                  d2 := Dictionary newFrom: as.
              
              
            
            Can someone explain why?
          
        
      
    
    
    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.
    
    
      
        
          -- 
            
              
                
                  
                    
                      
                        
                          R.
                              Mark Volkmann
                          Object
                                Computing, Inc.
                        
                      
                    
                  
                
              
            
          
        
      
    
    
    HTH,
    -- 
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
  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240709/225628d0/attachment.htm>


More information about the Cuis-dev mailing list