Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > pt.comp.programacao > #279

Re: o resto é Python

From Daniel Cerqueira <dan.list@lispclub.com>
Newsgroups pt.comp.programacao
Subject Re: o resto é Python
Date 2024-03-08 22:13 +0000
Organization A noiseless patient Spider
Message-ID <87edckz81j.fsf@lispclub.com> (permalink)
References <87sf10flsh.fsf@example.com>

Show all headers | View raw


Patricia Ferreira <pferreira@example.com> writes:

> Preciso de um procedimento que testa (sem sequência) se dois valors u, s
> são nulos.  Se forem, retorne NIL.  Se não for, obtenha uns valores.
> Eis como fazer:
>
> (defun last-time-seen (username)
>   (let ((u (get-account username)))
>     (and u (let ((s (account-seen u)))
>              (and s (universal-to-human s))))))
>
> Moleza.  Mas eis como um Lisper realmente faz:
>
> (defun last-time-seen (username)
>   (when-let* ((u (get-account username))
>               (s (account-seen u))
>     (universal-to-human s)))
>
> When-let*.  Isso é linguagem de /programação/.  O resto é Python.

Uuuauuuuuuu! Desconhecia o when-let.
Acho que vai-me ser muito útil.
:-)

Back to pt.comp.programacao | Previous | NextPrevious in thread | Find similar


Thread

o resto é Python Patricia Ferreira <pferreira@example.com> - 2024-03-08 18:36 -0300
  Re: o resto é Python Patricia Ferreira <pferreira@example.com> - 2024-03-08 18:48 -0300
  Re: o resto é Python Daniel Cerqueira <dan.list@lispclub.com> - 2024-03-08 22:13 +0000

csiph-web