[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: X-to-Y or Y-from-X?

William James

1/22/2016 11:27:00 PM

Marco Antoniotti wrote:

> "Vassili Bykov" <vassili@objectpeople.com> writes:
>
> > David Cooper wrote in message <3659C27D.7FF151E0@genworks.com>...
> > >Stig Hemmer wrote:
> > >>
> > >> I was just writing a couple of functions for converting from hash to
> > >> alist and vice versa.
> > >>
> > >> I'm wondering what to name these functions. Is it customary to use
> > >> "hash-to-alist" or "alist-from-hash" or something else?
> > >>
> > >
> > >You could get cute and name them hash2alist and alist2hash
> >
> > Cute would be hash->alist, like in Scheme.
> >
>
> Nope! The '->' is not CL style.

This is indicative of some of the traits of worshippers of CL (COBOL-Like).

1. All of them are grovelling conformists and lickspittles.

2. None of them have any taste.

3. They will do anything, no matter how idiotic, mindless, and perverse,
to vent their hatred for and envy of Scheme, which they perceive as a
heresy and a rival religion.

4. All of them are, at best, morons.

5. They behave as a pack of hyenas.

Do not ever make the egregious mistake of hiring a worshipper
of CL (COBOL-Like).

Do not ever make the egregious mistake of paying for software
written in CL (COBOL-Like).


> 'alist-to-hash-table' and
> 'hash-table-to-alist' seem more sensible.


To say that something is more sensible to an imbecile is
to damn that something.


>
> ;;; Just a start...
>
> (defun alist-to-hash-table (alist &key (test #'eql))
> (let ((new-ht (make-hash-table :test test)))
> (loop for assoc in alist
> do (setf (gethash (car assoc) new-ht) (cdr assoc)))
> new-ht))

MatzLisp (Ruby):

Hash[*[[:foo,2],[:bar,3]].flatten]
==>{:bar=>3, :foo=>2}

Another way:

table = Hash.new
[[:foo,2],[:bar,3]].each{|k,v| table[k]=v}


>
> (defun hash-table-to-alist (ht)
> (let ((new-alist ()))
> (loop for k being each hash-key in ht
> do (setf new-alist (acons k (gethash k ht) new-alist)))
> new-alist))
>
> ;;; The USING clause does not work well in CMUCL.


{:foo=>2, :bar=>3}.to_a
==>[[:foo, 2], [:bar, 3]]


--

2 Answers

bigdog

1/3/2013 10:08:00 PM

0

On Thursday, January 3, 2013 7:54:05 AM UTC-5, betweentheeyes wrote:
> >"bigdog" wrote in message
>
> >news:4e72619e-45c4-4dfe-875b-3387c0c3df61@googlegroups.com...
>
>
>
> >http://www.centurylink.net/news/read.php?rip_id=%3CDA3ID0A02%40news.ap..org%3E&ps=1018&...
>
> >'nuff said.
>
> When I was overseas (Greece) in 2011, the hotel had limited
> stations and one of the few English was Al-Jazeera. I was
>
> VERY surprised at the new reporting. Contrary to what you
> and I perceived in 2011 and what you may still perceive.
> The Al-Jazeera news isn't as slanted as what you see when
> you watch ABC/CBS/NBC show what Al-Jazeera shows. In other
> words, if your only impression of Al-Jazeera is what you see
> on ABC/CBS/NBC, you're not getting the whole story.

> Now in regards Al-Jazeera purchasing "current tv", WTF is
> 'current tv'? <chuckle>

Current TV is a cable channel where they send people who are too fucked up for even MSNBC. They hired Keith Olbermann after he got canned by MSNBC but he was too looney even for them and he got sacked there too.

Like King Midas, everything Al-Gore touches turns to shit. He was losing money hand over fist and he was looking for a parachute so Al-Jazeera bailed out Al-Gore. According to Rush Limbaugh, Glenn Beck had offered him even more money than Al-Jazeera but like the astute businessman Al-Gore is, he turned that down. Apparently he does have some accountants who know what they are doing because they convinced him to sell before the start of the new year soo he could dodge Obama's tax increase.

Yardpilot

1/4/2013 7:28:00 AM

0

On Thursday, January 3, 2013 5:13:00 AM UTC-8, Klaus Schadenfreude wrote:
> >"betweentheeyes" <betweentheeyes@defendingThe2nd.org> wrote in talk.politics.guns :
>
>
>
> >>"bigdog" wrote in message
>
> >>news:4e72619e-45c4-4dfe-875b-3387c0c3df61@googlegroups.com...
>
> >
>
> >>http://www.centurylink.net/news/read.php?rip_id=%3CDA3ID0A02%40news.ap.org%3E&ps=1018&...
>
> >
>
> >>'nuff said.
>
> >
>
> >When I was overseas (Greece) in 2011, the hotel had limited
>
> >stations and one of the few English was Al-Jazeera. I was
>
> >VERY surprised at the new reporting. Contrary to what you
>
> >and I perceived in 2011 and what you may still perceive.
>
> >The Al-Jazeera news isn't as slanted as what you see when
>
> >you watch ABC/CBS/NBC show what Al-Jazeera shows. In other
>
> >words, if your only impression of Al-Jazeera is what you see
>
> >on ABC/CBS/NBC, you're not getting the whole story.
>
> >
>
> >Now in regards Al-Jazeera purchasing "current tv", WTF is
>
> >'current tv'? <chuckle>
>
>
>
> It's either a slanted "progressive media company" or a TV which gets
>
> its current from electricity generated by the hot air Al Gore
>
> produces.
>
>
>
> Personally, Al-Jazeera is one of my regularly checked news sources.
>
> But then, so is the KOREAN CENTRAL NEWS AGENCY of DPRK
>
> http://www.kcna.co.jp/i...

I keep Al-Jazeera on a link set that loads a dozen different sources from around the world. Saves time. BBC, those nice Canudians, CNS, FOX, a semi-American source or three from the MSM, Huffpo just for laughs, and others North, South, East and West. Oh, and www.daybydaycartoon.com, where Chris Muir holds forth solidly on the world today.