From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andreas Reuleaux Newsgroups: gmane.lisp.guile.user Subject: Re: hashmark in symbols Date: Mon, 02 Jan 2023 16:20:36 +0000 Message-ID: <87h6x8x60b.fsf@laptop> References: <87y1qlvfg2.fsf@laptop> <87sfgtzc4u.fsf@laptop> <6e2158f1-4c28-85f3-4283-4aee63332529@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14899"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jan 02 17:20:19 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCNXt-0003Z0-Un for guile-user@m.gmane-mx.org; Mon, 02 Jan 2023 17:20:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCNXX-0008Dp-Qu; Mon, 02 Jan 2023 11:19:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCNXW-0008Dg-7B for guile-user@gnu.org; Mon, 02 Jan 2023 11:19:54 -0500 Original-Received: from sender4-of-o51.zoho.com ([136.143.188.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCNXU-0007wa-CF for guile-user@gnu.org; Mon, 02 Jan 2023 11:19:53 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1672676388; cv=none; d=zohomail.com; s=zohoarc; b=Qft4qrgGt1uYrm4UAxjwleBb32dta9sttrt52CpAPwXCSXpLxSASISvXlk7JBJQlhwEMNjh0KqfUz2LVPtjMP4lNO2pYY9FCxPowM+8OGuvxP7jC9rLlLFnfeMRWUbv4h6+X2BF98qlpLbm453hPeGMDRcbrPW7Oi3S19UGAsbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672676388; h=Content-Type:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=d6qzyk3tRD7os4iO2QPKz9CKaoTnLT8wyITeH2NRczk=; b=npNYl8K5hXM8kqsJYdBFSfWz8zKZhdMx0Y8oowFDRgJA3lKY3l8kwdYQZYl4TjAirXMsPEYLXh15V8nw3DvS2+bMtH8T7mFZPOV6q/IJlo9oND2W+WZeEOct7e2cA2qXGcsbpDmQCLe2X9ZPIIogF5siYuZS9I9ZCKSeMJ6pMUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=a-rx.info; spf=pass smtp.mailfrom=rx@a-rx.info; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1672676388; s=zoho; d=a-rx.info; i=rx@a-rx.info; h=From:From:To:To:Subject:Subject:References:Date:Date:In-Reply-To:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To:Cc; bh=d6qzyk3tRD7os4iO2QPKz9CKaoTnLT8wyITeH2NRczk=; b=R3C3KDeVA0fZof5ocprQdPfz96AxsPF6wRSLCfGKVZmBYnNj00ZYf+IfcrSYtghE AhuuSFAKw6itDlRD+UTyE3hbm+Ht0CFrQXi9IcRrsuY7ULaiIwYNyJHEVH0CmAelSEp jvCdmjF1sx+i5e7h+9anAeRqqIL+fKr69vHoIowE= Original-Received: from laptop (85.255.237.49 [85.255.237.49]) by mx.zohomail.com with SMTPS id 1672676386180295.383743835059; Mon, 2 Jan 2023 08:19:46 -0800 (PST) Original-Received: from rx by laptop with local (Exim 4.96) (envelope-from ) id 1pCNYC-0006BU-22 for guile-user@gnu.org; Mon, 02 Jan 2023 16:20:36 +0000 In-Reply-To: <6e2158f1-4c28-85f3-4283-4aee63332529@gmail.com> (Taylan Kammer's message of "Mon, 2 Jan 2023 07:59:40 +0100") X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rx@a-rx.info; helo=sender4-of-o51.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18821 Archived-At: Hi, thanks for getting back to me in this regard, and yes, you are right: Basically my code is a translation of (common lisp) https://github.com/Inaimathi/cl-css to guile. So things like this work: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (css '((body :margin 5px :padding 0px))) $75 = "body { margin: 5px; padding: 0px; }" --8<---------------cut here---------------end--------------->8--- And more rules, of course, (and compound selectors etc.) like so: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (%display (css '((body :margin 5px :padding 0px)(".label, li p.desc" :font-size .8em :font-family sans-serif :color |#444|)))) body { margin: 5px; padding: 0px; } .label, li p.desc { font-size: .8em; font-family: sans-serif; color: #444; } scheme@(guile-user)> --8<---------------cut here---------------end--------------->8--- with %display being defined as --8<---------------cut here---------------start------------->8--- #!curly-infix ;; aka "after" (define $. compose) (define %display {(lambda _ (newline)) $. display} ) --8<---------------cut here---------------end--------------->8--- which brings me back to the hashmark in symbols issue. - I will shorten the above example to just: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (css '((body :margin 5px :padding 0px :color |#444|))) $79 = "body { margin: 5px; padding: 0px; color: #444; }" --8<---------------cut here---------------end--------------->8--- This works - thanks to --8<---------------cut here---------------start------------->8--- (read-enable 'r7rs-symbols) --8<---------------cut here---------------end--------------->8--- now. - Alternatively, as you suggested: just as a string: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (css '((body :margin 5px :padding 0px :color "#444"))) $82 = "body { margin: 5px; padding: 0px; color: #444; }" --8<---------------cut here---------------end--------------->8--- And (your second suggestion) - with string->symbol (but then I have to interrupt the code with a quote - not sure if this is a win, it does seem less readable to me: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (css `((body :margin 5px :padding 0px :color ,(string->symbol "#444")))) $84 = "body { margin: 5px; padding: 0px; color: #444; }" --8<---------------cut here---------------end--------------->8--- Maybe I can make my code available some time. - It needs a little more polishing though. Thanks again. -A Taylan Kammer writes: > On 02.01.2023 07:25, Andreas Reuleaux wrote: >> Ah, OK, this helps indeed >> >> --8<---------------cut here---------------start------------->8--- >> (read-enable 'r7rs-symbols) >> --8<---------------cut here---------------end--------------->8--- >> > Another option would be to use string->symbol: > > (string->symbol "#444") > > That being said, I wonder if it's not better to use strings for this. > > Is there any particular reason you want to use symbols to represent CSS > color values? I assume that your main requirements are: > > - Easy to represent as literal values in code. > > - Easy to splice into a bigger string (or write into an output stream) that > will become an entire CSS code snippet or file. > > Strings seem like the most straightforward choice. All in all there's not > much difference though, given that symbols are basically just automatically > interned immutable strings.