Lisphp equivalent of $foo['bar']['baz'] = 'A';

12 views
Skip to first unread message

Jonathan Aquino

unread,
Mar 4, 2014, 1:45:01 PM3/4/14
to lis...@googlegroups.com
I was wondering, what is the Lisphp equivalent of doing:

$foo['bar']['baz'] = 'A';
$foo['bar']['qux'] = 'B';

To do this, I implemented by own array-set function, but using it is rather ugly:

(setf! foo (array-set foo 'bar' 'baz' 'A'))
(setf! foo (array-set foo 'bar' 'qux' 'B'))

Jonathan

Jonathan Aquino

unread,
Mar 5, 2014, 8:14:49 PM3/5/14
to lis...@googlegroups.com
Oh, actually if I use array_replace_recursive (defined as "arr"), I can do this:

(arr foo
     (hash 'bar' (hash 'baz' 'A'
                       'qux' 'B')))


which is better.
Reply all
Reply to author
Forward
0 new messages