Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I'm stuck with code in a quoted list

28 views
Skip to first unread message

Bigos

unread,
Jun 6, 2012, 9:16:54 PM6/6/12
to
Hi,

I am trying to write a Lisp script for generation of Ruby code.

Here you can see what I have do so far:
https://github.com/bigos/cl-script/blob/master/script.lisp

I have problem with generate function. When I run it in repl with
example data: (generate "NewPost" "new_post" "NewPosts" "new_posts" )
I get following

(index all)
(show find :id)
(new new)
(edit find :id)
(create new (FORMAT NIL ~A SING_UNDER) (FORMAT NIL if @~A.save SING_UNDER))
(update find :id
(FORMAT NIL if @~A.update_attributes(params[:~A]) SING_UNDER SING_UNDER))
(destroy find :id)

What can I do to have a string instead of (format nil ...) ?

Jack

Alberto Riva

unread,
Jun 7, 2012, 12:35:25 AM6/7/12
to
You can use backquote:

(let ((sing_under "new_post"))
`(create new ,(format nil "~a" sing_under)))

=> (CREATE NEW "new_post")


Alberto

--
Give a man a fish and he will eat for one day. Teach him programming,
and he will develop a multi tasking intelligent planning algorithm to
optimize the route of a fleet of deep sea fishing boats, with
real-time GPS tracking, weather satellite link, automatic analysis of
fish market prices, the whole thing controlled by an AJAX-enabled web
interface. In the meantime, he will die of hunger.

Bigos

unread,
Jun 7, 2012, 9:10:09 AM6/7/12
to
On 07/06/12 05:35, Alberto Riva wrote:

>
> You can use backquote:
>
> (let ((sing_under "new_post"))
> `(create new ,(format nil "~a" sing_under)))
>
> => (CREATE NEW "new_post")
>
>
> Alberto
>

It works. Thank you
0 new messages