Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #54513
| From | "Robert L." <No_spamming@noWhere_7073.org> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | .re: listo-to-hash |
| Date | 2017-01-29 05:11 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <o6jtha$e9a$1@gioia.aioe.org> (permalink) |
Pascal Costanza wrote:
> javuchi wrote:
> > I've been search the hyperspec for a solution to this problem, and
> > ended up writing this code:
>
> > (defun list-to-hash (rest)
> > (let ((hash (make-hash-table)))
> > (labels ((genera-hash (lista)
> > (when (not (null lista))
> > (setf (gethash (car lista) hash) (cadr lista))
> > (genera-hash (cddr lista)))))
> > (genera-hash rest))
> > hash))
>
> (loop with hash-table = (make-hash-table)
> for (key value) on list by #'cddr
> do (setf (gethash key hash-table) value)
> finally (return hash-table))
Ruby:
Hash[ *[:foo,2,:bar,3,:zoo,4] ]
==>{:foo=>2, :bar=>3, :zoo=>4}
In Forth?
--
Sweden: Non-White Invaders Stream Rape of Swedish Woman Live on Facebook
The Jewish-controlled media have censored the racial aspect of this horrific
crime, in most cases describing the assailants only as "men" or even "Swedish
men" in their reports.
nationalvanguard.org/2017/01/sweden-non-white-invaders-stream-rape-of-swedish-woman-live-on-facebook/
Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread
.re: listo-to-hash "Robert L." <No_spamming@noWhere_7073.org> - 2017-01-29 05:11 +0000
csiph-web