set multiple symbols from list values at once

Started by vetelko, February 11, 2017, 07:22:22 AM

Previous topic - Next topic

vetelko

Hi guys,



is it possible to achieve something like this in newLISP?
(assign name city age '("john", "new york", 22))
newLISP v.10.7.6 64-bit on BSD IPv4/6 UTF-8 libffi

jopython

#1
You can't. unless you want to use title case.



: (bind (unify '(Name City Age) '("john" "new york" 22)))
22
: Name
john
: City
new york
: Age
22

Lutz

#2
use map and set

> (map set '(name city age) '("john" "new york" 22))
("john" "new york" 22)

> name
"john"
> city
"new york"
> age
22
>