On Tue, Feb 6, 2018 at 1:34 AM, roger peppe <rogpe...@gmail.com> wrote:
> ... tick, tick, tick, tick... dide-dudi-diddlidedum...di!
>
>     func comparable(xs []int) interface{} {
>         type elem struct {
>             first int
>             rest  interface{}
>         }
>         var r interface{}
>         for _, x := range xs {
>             r = elem{x, r}
>         }
>         return r
>     }
>
> https://play.golang.org/p/7VG1MWDI-l-
>
> or, somewhat more generally:
>
> https://play.golang.org/p/_vfh2nT5cZL
>
> You can even use this technique to compare arbitrary DAGs.
> Not that it would be a good idea :)

Very nice.

Ian


> On 5 February 2018 at 17:49, roger peppe <rogpe...@gmail.com> wrote:
>> On 5 February 2018 at 11:38, Peter Waller <pe...@pdftables.com> wrote:
>>> On 5 February 2018 at 11:04, roger peppe <rogpe...@gmail.com> wrote:
>>>>
>>>> > I'll bite, does it involve struct { len int; content [maxCount]int }, or
>>>> > did
>>>> > you have something else in mind?
>>>>
>>>> Something else. No size limit. Not what one might call efficient though.
>>>> :)
>>>
>>>
>>> [low growling]
>>>
>>> (ok, so I've been watching Stranger Things with subtitles too much...)
>>>
>>> I'm... not sure I can figure out what you're thinking of, dangit.
>>>
>>> Does it involve gratuitous numbers of calls to the fmt package?
>>
>> Nope. No fmt at all.
>>
>> A clue: struct{x interface{}}{12} == struct{x interface{}}{12}
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to