The "solve" way seems to some closest to doing it.
~/lisp/miniPicoLisp
$ cat t.l
(be a (3))
(be foo (@C)
# (@C -> @C)
# (call @C)
(@ print (solve (list (-> @C
)
$ ./pil t.l
: (? a foo (foo (a @Z)))
1 (foo (a @Z))
(((@Z . 3)))-> T
So I can see that it is correctly solving for @Z
Nice! I like that site rosettacode.org lots. (I stopped counting how many
computer 'languages' I have assimilated over the years!)
This example again shows off picolisp/pilog nicely.
http://rosettacode.org/wiki/24_game/Solve#PicoLisp
I think the perl solution may be a tad smaller. But mos
Here's the issue boiled down to a simpler test case :-) First, swi-prolog:
# cat t.pl
a(3).
foo(N) :- N.
bar(a(X)) :- a(X).
# swipl -f t.pl
% /root/prolog/t.pl compiled 0.00 sec, 2,800 bytes ...
?- trace.
true.
[trace] ?- bar(a(Z)).
Call: (6) bar(a(_G386)) ? creep
Call: (7) a(_G386
Good bye Sven Klose :-(
You are now unsubscribed
--
Software-Architekturbüro Sven Klose
Beckhausstr. 143
33611 Bielefeld
Tel.: 0521 / 989 0 354
PGP encryption fingerprint:
ED3B E06A 0D39 6B6C C776 389F B28D 9CD1 2F23 E383
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=U
Hi dexen + all,
I accepted the challenge, and posted a new task to RosettaCode:
http://rosettacode.org/wiki/First_class_environments
The PicoLisp solution is quite clean, IMHO.
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
http://itunes.apple.com/ca/podcast/the-stack-exchange-podcast/id279215411
Hi Doug,
> (be holds (@A @S)
>(or
> ((restoreSitArg @A @S @F) (@ -> @F))
> ((not (restoreSitArg @A @S @F)) (isAtom @A) (@ -> @A)) ) )
>
> gives me the same results as using the (@ solve (list (-> @F)))
> clause. Neither that nor (@ -> @F) seem to unify variables in @F (which
> is b
Hi Alex,
Thanks for your help!
holds(A,S) :- restoreSitArg(A,S,F), F ;
\+ restoreSitArg(A,S,F), isAtom(A), A.
What I really want is this:
(be holds (@A @S)
(or
((restoreSitArg @A @S @F) @F)
((not (restoreSitArg @A @S @F)) (isAtom @A) @A) ) )
But the above (with a @F or
On Thu, Jun 30, 2011 at 09:20:43AM +0200, Alexander Burger wrote:
> At least, a simple (@ . @A) should work. Doesn't it?
Wait ... probably not a good idea.
But this should work: (@ -> @A)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Hi Doug,
> > So this should be written as
> >
> >(be holds (@A @S)
> > (or
> > ((restoreSitArg @A @S @F) (@ solve (list (-> @F
> > ((not (restoreSitArg @A @S @F)) (isAtom @A) (@ solve (list (-> @A ) )
I didn't test it, but I think the construct using 'solve' is more
complicated than nec
10 matches
Mail list logo