> We keep tripes in a freezer. We tried a database but the
> smell was... I better leave it there.
No no. He's talking about REFRIED tripes; can't you read, man!?
http://www.cooks.com/rec/view/0,1726,153182-228204,00.html
On Jun 16, 2:35 am, gavino <·········@gmail.com> wrote:
> http://www.franz.com/products/allegrograph/
And here we go again :
(**) Determine the prime factors of a given positive integer.
Construct a flat list containing the prime factors in ascending order.
Example:
* (prime-factors 315)
(3 3 5 7)
You know the rules . You solve above correctly and get an answer else
silence.
Slobodan Blazeski
My apologies to those who like Java, C#, PHP, Delphi, Visual Basic,
Perl, Python, Ruby, COBOL, or any other language. I know you think
you
know a better language than lisp. All I can say is I do, too!
On Jun 16, 5:14 am, fireblade <·················@gmail.com> wrote:
> On Jun 16, 2:35 am, gavino <·········@gmail.com> wrote:
>
> >http://www.franz.com/products/allegrograph/
>
> And here we go again :
>
> (**) Determine the prime factors of a given positive integer.
> Construct a flat list containing the prime factors in ascending order.
> Example:
> * (prime-factors 315)
> (3 3 5 7)
>
> You know the rules . You solve above correctly and get an answer else
> silence.
>
> Slobodan Blazeski
>
> My apologies to those who like Java, C#, PHP, Delphi, Visual Basic,
> Perl, Python, Ruby, COBOL, or any other language. I know you think
> you
> know a better language than lisp. All I can say is I do, too!
any relation to milosevitch?
On 2007-06-18 13:36:13 -0400, gavino <·········@gmail.com> said:
> any relation to milosevitch?
O.K., not we have proof positive that gavino is an intentional troll.
On 2007-06-18 16:16:19 -0400, Raffael Cavallaro
<················@pas-d'espam-s'il-vous-plait-mac.com> said:
> O.K., not we have proof positive that gavino is an intentional troll.
^^^^
now
Raffael Cavallaro <················@pas-d'espam-s'il-vous-plait-mac.com> writes:
> On 2007-06-18 13:36:13 -0400, gavino <·········@gmail.com> said:
>
>> any relation to milosevitch?
>
> O.K., not we have proof positive that gavino is an intentional troll.
And a stupid one, at that.
From: Jens Teich
Subject: Re: prime factors (was: what is an RDF tripes database?)
Date:
Message-ID: <uzm2qu3cr.fsf_-_@jensteich.de>
fireblade <·················@gmail.com> writes:
> (**) Determine the prime factors of a given positive integer.
> Construct a flat list containing the prime factors in ascending order.
> Example:
> * (prime-factors 315)
> (3 3 5 7)
Gavino didn't solve this one, so here is my suggestion:
(defun prime-p (n)
(let ((result t))
(loop for i from 2 to (isqrt n) do
(when (integerp (/ n i))
(setq result nil)
(return)))
result))
(defun prime-factors (n)
(cond ((= n 1) nil)
(t (loop for i from 2 to n do
(when (and (prime-p i)
(integerp (/ n i)))
(return (cons i (prime-factors (/ n i)))))))))
jens
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jens Teich <····@jensteich.de> writes:
> fireblade <·················@gmail.com> writes:
>
> > (**) Determine the prime factors of a given positive integer.
> > Construct a flat list containing the prime factors in ascending order.
> > Example:
> > * (prime-factors 315)
> > (3 3 5 7)
>
> Gavino didn't solve this one, so here is my suggestion:
>
> (defun prime-p (n)
> (let ((result t))
> (loop for i from 2 to (isqrt n) do
> (when (integerp (/ n i))
> (setq result nil)
> (return)))
> result))
If you're using LOOP, you can use its own WHEN
(defun prime-p (n)
(not
(loop for i from 2 to (isqrt n)
when (integerp (/ n i))
do
(return t))))
And if you need a local variable in a LOOP, there's WITH to introduce
it with (no need for an outer LET).
>
> (defun prime-factors (n)
> (cond ((= n 1) nil)
> (t (loop for i from 2 to n do
> (when (and (prime-p i)
> (integerp (/ n i)))
> (return (cons i (prime-factors (/ n i)))))))))
>
There's really no need for a COND here:
(defun prime-factors (n)
(unless (= n 1)
(loop for i from 2 to n
when (and (prime-p i)
(integerp (/ n i)))
do
(return (cons i (prime-factors (/ n i)))))))
It'd probably also make sense to swap the two test here to save some
cycles. But if you were striving for efficiency, you'd probably choose
a different algorithm anyway.
Andras
On Jun 24, 4:50 am, Andras Simon <······@math.bme.hu> wrote:
> Jens Teich <····@jensteich.de> writes:
> > fireblade <·················@gmail.com> writes:
>
> > > (**) Determine the prime factors of a given positive integer.
> > > Construct a flat list containing the prime factors in ascending order.
> > > Example:
> > > * (prime-factors 315)
> > > (3 3 5 7)
>
> > Gavino didn't solve this one, so here is my suggestion:
>
> > (defun prime-p (n)
> > (let ((result t))
> > (loop for i from 2 to (isqrt n) do
> > (when (integerp (/ n i))
> > (setq result nil)
> > (return)))
> > result))
>
> If you're using LOOP, you can use its own WHEN
If you're doing that, you ought to use its own return as well...
> (defun prime-p (n)
> (not
> (loop for i from 2 to (isqrt n)
> when (integerp (/ n i))
> do
> (return t))))
(defun prime-p (n)
(not
(loop for i from 2 to (isqrt n)
when (zerop (mod n i)) return t)))
"Thomas F. Burdick" <········@gmail.com> writes:
> If you're doing that, you ought to use its own return as well...
>
> (defun prime-p (n)
> (not
> (loop for i from 2 to (isqrt n)
> when (zerop (mod n i)) return t)))
Better:
(defun prime-p (n)
(loop for i from 2 to (isqrt n)
never (zerop (mod n i))))
Nicolas
Nicolas Neuss <········@mathematik.uni-karlsruhe.de> writes:
> "Thomas F. Burdick" <········@gmail.com> writes:
>
> > If you're doing that, you ought to use its own return as well...
> >
> > (defun prime-p (n)
> > (not
> > (loop for i from 2 to (isqrt n)
> > when (zerop (mod n i)) return t)))
How true!
>
> Better:
>
> (defun prime-p (n)
> (loop for i from 2 to (isqrt n)
> never (zerop (mod n i))))
Indeed!
Thanks,
Andras
On Jun 17, 4:18 pm, Tim Bradshaw <··········@tfeb.org> wrote:
> On Jun 16, 1:35 am, gavino <·········@gmail.com> wrote:
>
> >http://www.franz.com/products/allegrograph/
>
> http://justfuckinggoogleit.com/
I've had my Monday-morning laugh. Thanks!
-- david