Comparation protocol

34 views
Skip to first unread message

Mikhail

unread,
Apr 9, 2014, 2:24:10 PM4/9/14
to elixir-l...@googlegroups.com
Hi folks,

Tried to find out something like <=> in Ruby. Tried to find out a corresponding protocol without success. Might be I missed something. What is the right way to compare records? 

--
Sincerely,
Mikhail S. Pobolovets
sty...@gmail.com | skype: styx.mp | http://gplus.to/styx.mp

José Valim

unread,
Apr 9, 2014, 2:33:08 PM4/9/14
to elixir-l...@googlegroups.com
In Elixir you can compare a value with another value:

    true > 13
    true

So depending on your data, you can just structure your record in a way that the regular <, > and friends work. If not, the best is to provide your own function with your own comparison implementation.



José Valim
Skype: jv.ptec
Founder and Lead Developer


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

Mikhail

unread,
Apr 9, 2014, 3:01:25 PM4/9/14
to elixir-l...@googlegroups.com
José, thanks for lightning flash response! Will try the first one but seems only second will work for me.

--
Sincerely,
Mikhail S. Pobolovets
sty...@gmail.com | skype: styx.mp | http://gplus.to/styx.mp


Reply all
Reply to author
Forward
0 new messages