[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: '{}' feature or bug?



>>      ; '{}'
>>      ; '{echo strange}'
>>      strange
>>      ; 
>
>I'd have to call this a feature

And, I must confess, I've taken advantage of it (though not for anything
terribly practical).  I implemented conses (using message-passing closures)
and various list operations, and implemented list-copy as

        fn list-copy { %flatten ' ' $* }

which is used to implement e.g. the following functions:

        fn reverse { $0^! <={ list-copy $* } }

        fn reverse!    list \
        {
          let (p = $list
               q = <={ cdr $list }
               r =)
            {
              set-cdr! $p
              while {} \
                {
                  r = <={ cdr $q }
                  set-cdr! $q $p
                  p = $q
                  if { ~ $r () } \
                       { break } \
                     { q = $r }
                }
              result $q
            }
        }

I suppose I should be beaten with a stick.