HackerTrans
TopNewTrendsCommentsPastAskShowJobs

efdb

no profile record

Submissions

Russia Launches 'Vodkabot'

theregister.com
4 points·by efdb·il y a 8 mois·0 comments

comments

efdb
·il y a 2 ans·discuss
H
efdb
·il y a 2 ans·discuss
J
efdb
·il y a 2 ans·discuss
[flagged]
efdb
·il y a 3 ans·discuss
Did you have a look at https://rqlite.io/ ?
efdb
·il y a 4 ans·discuss
Not so unfortunate according to Socrates: 'the hardest task needs the lightest hand..' ;-)
efdb
·il y a 4 ans·discuss
see https://github.com/nalgeon/sqlean for 'All the missing SQLite functions'
efdb
·il y a 5 ans·discuss
self documenting code ;-)

  def descending(lst):
    if len(lst) < 2:
        return False
    first, second = lst[:2]
    if first > second:
        return False
    if first < second:
        return True
    descending(lst[1:])

  def monotonic(lst):
    if len(lst) < 2:
        return lst
    result = []
    status = 0
    temp = [lst[0]]
    for v in lst[1:]:
        if v >= temp[-1] and status >= 0:
            if v > temp[-1]:
                status = 1
            temp.append(v)    
            continue
        if v <= temp[-1] and status <= 0:
            if v < temp[-1]:
                status = -1
            temp.append (v)    
            continue
        result.append(temp)
        temp = [v]
        status = 0
    result.append(temp)          
    return [list(reversed(x)) if descending(x) else x for x in     result]
efdb
·il y a 5 ans·discuss
i really like the syntax, very intuitive use of ->