From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Authentication-Results: nullring.xyz; dkim=pass header.d=gmail.com header.i=@gmail.com; spf=pass reason="matched ip" smtp.helo=mail-pl1-x62e.google.com smtp.mailfrom=gmail.com; dmarc=pass header.from=gmail.com Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [2607:f8b0:4864:20::62e]) by nullring.xyz (envelope-sender ) with ESMTPS id 33b35752; Tue, 17 Feb 2026 17:53:54 -0800 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2a3e79fe2b8so5808165ad.1 for ; Tue, 17 Feb 2026 17:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771379633; x=1771984433; darn=nullring.xyz; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=vntT9dtQvAcZSdI3o54PmOgICbNufEtAG34cUNycxJs=; b=UR325tHJE/geGDQMNomWk4SV1NXHwe8PYuZ8Zb2ttkP3BvtQousRhwyfVHLfuf5/Nr tAPz3ZbYl6BWNHfdcGorL4HtVw1YwWgRlg0SWR9C+AZwSEBT6m+i4xj7KDmMpjAEmfRM EVlMOVNrhnfi8d3BREExLCFbH+ktJ3W4kE3Dh50cG36Xd9rYLo4bI1fTRVqhvKWN06uU /FRv4r456oeuJts4GG1Cye0t3CcGJ/mg2JTsR1tByf9pZvoe51ft103aJkCE0okhU9hc YaRRQh1HUMlGoEO/2QtLHZZ386aEzngcrHXNnVs6DclC+BP6TkpC9SMoDnYlDd9V/e4h zilQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771379633; x=1771984433; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=vntT9dtQvAcZSdI3o54PmOgICbNufEtAG34cUNycxJs=; b=PYxX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ab4caff700mr120893935ad.0.1771379633033; Tue, 17 Feb 2026 17:53:53 -0800 (PST) Return-Path: Received: from safehouse ([2604:3d08:9d78:38b0::90f]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ad1aae9e0esm112229205ad.79.2026.02.17.17.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Feb 2026 17:53:52 -0800 (PST) From: =?utf-8?Q?Andrei_=C8=98ova?= To: Preston Pan Cc: nullerbot@nullring.xyz Subject: Re: [PATCH] abstractions for different cities In-Reply-To: <20260217223004.11278-1-ret2pop@nullring.xyz> (Preston Pan's message of "Tue, 17 Feb 2026 14:30:04 -0800") References: <20260217223004.11278-1-ret2pop@nullring.xyz> User-Agent: mu4e 1.12.12; emacs 30.2 Date: Tue, 17 Feb 2026 17:53:51 -0800 Message-ID: <871piirf4g.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" --=-=-= Content-Type: text/plain Preston Pan writes: > --- > src/main.lisp | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/src/main.lisp b/src/main.lisp > index d789921..fb74901 100644 > --- a/src/main.lisp > +++ b/src/main.lisp > @@ -19,12 +19,13 @@ > (defparameter +feed-room-id+ "!ShuXi5ohrPUtKHkrNO:matrix.nullring.xyz") > (defparameter +feed-cache-path+ #P"./nullbot_cache.sexp") > (defparameter +feed-sleep-minutes+ 1) > +(defparameter +weather-vancouver+ ) These are supposed to be constants but defining them with `defconstant` is annoying because the repl complains when they are redefined. Usually in CL when a variable is wrapped with '+' signs it means that it's supposed to be constant. > > (defparameter +prefix+ "$") > > -(defun get-temp > - (&aux > - (endpoint "https://api.weather.gc.ca/collections/swob-realtime/items?f=json&lang=en&url=CYVR&sortby=-date_tm-value&limit=1&properties=date_tm-value,air_temp,air_temp-uom,air_temp-qa") > +(defun get-temp (weather-station > + &aux > + (endpoint (format nil "https://api.weather.gc.ca/collections/swob-realtime/items?f=json&lang=en&url=C~A&sortby=-date_tm-value&limit=1&properties=date_tm-value,air_temp,air_temp-uom,air_temp-qa" weather-station)) > (data (jzon:parse (dex:get endpoint)))) > (hash-get (aref (gethash "features" data) 0) '("properties" "air_temp"))) > > @@ -41,7 +42,7 @@ > ((string= command "$help") > (mapi:sendmsg *bot* room-id "Unlike some other bots, I'm nice :3")) > ((string= command "$weather") > - (mapi:sendmsg *bot* room-id (format nil "It's ~a degrees in Vancouver" (get-temp))))))) > + (mapi:sendmsg *bot* room-id (format nil "It's ~a degrees in Vancouver~%It's ~a degrees in Victoria" (get-temp "YVR") (get-temp "YYJ"))))))) > > (defmethod mapi:on-event > ((obj nullbot) event room-id Looks good to me though - sova --=-=-= Content-Type: text/html

Preston Pan <ret2pop@nullring.xyz> writes:

— src/main.lisp | 9 +-— 1 file changed, 5 insertions(), 4 deletions(-)

diff –git a/src/main.lisp b/src/main.lisp index d789921..fb74901 100644 — a/src/main.lisp ++ b/src/main.lisp @@ -19,12 19,13 @@ (defparameter +feed-room-id "!ShuXi5ohrPUtKHkrNO:matrix.nullring.xyz") (defparameter feed-cache-path #P"./nullbotcache.sexp") (defparameter feed-sleep-minutes 1) (defparameter +weather-vancouver )

These are supposed to be constants but defining them with `defconstant` is annoying because the repl complains when they are redefined. Usually in CL when a variable is wrapped with '+' signs it means that it's supposed to be constant.

(defparameter prefix "$")

-(defun get-temp - (&aux - (endpoint "https://api.weather.gc.ca/collections/swob-realtime/items?f=json&lang=en&url=CYVR&sortby=-date_tm-value&limit=1&properties=date_tm-value,air_temp,air_temp-uom,air_temp-qa") +(defun get-temp (weather-station + &aux + (endpoint (format nil "https://api.weather.gc.ca/collections/swob-realtime/items?f=json&lang=en&url=C~A&sortby=-date_tm-value&limit=1&properties=date_tm-value,air_temp,air_temp-uom,air_temp-qa" weather-station)) (data (jzon:parse (dex:get endpoint)))) (hash-get (aref (gethash "features" data) 0) '("properties" "airtemp")))

@@ -41,7 +42,7 @@ ((string= command "$help") (mapi:sendmsg bot room-id "Unlike some other bots, I'm nice :3")) ((string= command "$weather") - (mapi:sendmsg bot room-id (format nil "It's ~a degrees in Vancouver" (get-temp))))))) + (mapi:sendmsg bot room-id (format nil "It's ~a degrees in Vancouver~%It's ~a degrees in Victoria" (get-temp "YVR") (get-temp "YYJ")))))))

(defmethod mapi:on-event ((obj nullbot) event room-id

Looks good to me though

  • sova
--=-=-=--