Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Your nature demands love and your happiness depends on it.


comp / comp.lang.scheme / Gauche Lrange -- to the maximum value that doesn’t exceed end.

SubjectAuthor
o Gauche Lrange -- to the maximum value that doesn’t exceed end.HenHanna

1
Subject: Lprint = ( Lisp-style printing ( of lists and strings (etc.) ) in Python )
From: HenHanna
Newsgroups: comp.lang.python, comp.lang.lisp, comp.lang.scheme
Organization: A noiseless patient Spider
Date: Fri, 31 May 2024 04:47 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: HenHanna@devnull.tb (HenHanna)
Newsgroups: comp.lang.python,comp.lang.lisp,comp.lang.scheme
Subject: Lprint = ( Lisp-style printing ( of lists and strings (etc.) ) in
Python )
Date: Thu, 30 May 2024 21:47:14 -0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <v3bkoj$23bck$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 31 May 2024 06:47:15 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="512d4da52372882ea9ed0f897c428d2f";
logging-data="2207124"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5ulEZE+GyhAhJ2d2KszZcSeWnKsObUNI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ZcI1L5Avh6iv8URcX8Qy2CRJuG8=
Content-Language: en-US
View all headers

;;; Pls tell me about little tricks you use in Python or Lisp.

[('the', 36225), ('and', 17551), ('of', 16759), ('i', 16696), ('a',
15816), ('to', 15722), ('that', 11252), ('in', 10743), ('it', 10687)]

((the 36225) (and 17551) (of 16759) (i 16696) (a 15816) (to 15722) (that
11252) (in 10743) (it 10687))

i think the latter is easier-to-read, so i use this code
(by Peter Norvig)

def lispstr(exp):
# "Convert a Python object back into a Lisp-readable string."
if isinstance(exp, list):
return '(' + ' '.join(map(lispstr, exp)) + ')'
else:
return str(exp)

def Lprint(x): print(lispstr(x))

1

rocksolid light 0.9.8
clearnet tor