lisp-help needed

Recommended Posts

hi all

i need a little lisp-help...

i want to split things like this perhaps 'an3 into '(a n 3)

is there a way?

thanx

andré

(explode 'an3)

=> (a n 3)

Nigel

Share on other sites

thanx, but i see my idea don't work with that...

concrete: i want to split 2/20 into exactly '(2 20)

function with numerator/denominator it will be '(1 10) - not what i need

also with (explode '2/20) => (1 / 1 0)

is there any solution?

2/20 = 1/10

Share on other sites

i know, but only mathematically!! -> you remember the problem with gen-stacc? => we discussed that with rangarajan?

for some functions it's necessary that 2/20 will not be "reduced" to 1/20

Quote

Yes, I have also experienced this difficulty, for example, can't distinguish between 4/4 and 2/2 because both reduce to 1! As JP points out, this is a Lisp issue, nothing to do with OM. If we are adventurous, we could implement our own "data type", for example keeping numerator and denominator separately as a cons pair (numerator . denominator) or something similar. We can write a set of functions that operate on this, and then apply reduction when actually needed. More work, of course, but Lisp gives you control.

Regards,

Rangarajan

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
• Browser

• Video Gallery

• Lessons