set multiple symbols from list values at once

Q&A's, tips, howto's
Post Reply
vetelko
Posts: 21
Joined: Thu Oct 13, 2016 4:47 pm

set multiple symbols from list values at once

Post by vetelko »

Hi guys,

is it possible to achieve something like this in newLISP?

Code: Select all

(assign name city age '("john", "new york", 22))
newLISP v.10.7.4 64-bit on OpenBSD IPv4/6 UTF-8 libffi

jopython
Posts: 123
Joined: Tue Sep 14, 2010 3:08 pm

Re: set multiple symbols from list values at once

Post by jopython »

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

Code: Select all

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

Lutz
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: set multiple symbols from list values at once

Post by Lutz »

use map and set

Code: Select all

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

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

Post Reply