the same expression in Scheme would be:
(set! xp (/ (- x (* v t)) (sqrt (- 1 (/ (expt v 2) (expt c 2))
> xp
-1102228130.2405226
a bit less readable than:
{xp <- {x - v * t} / (sqrt {1 - v ** 2 / c ** 2})}
-1102228130.2405226
or:
{xp ← {x - v * t} / (sqrt {1 - v ** 2 / c ** 2})}
-1102228130.
it works pretty well again now the new version is debugged, this code is
related to infix evaluation in Scheme+ with operator precedence , here is
an example:
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/Scheme+.scm.go
scheme@(guile-user)> { 4 + 3 * 2
my problem is solved by quoting the variable that CAN store a special form
(example: <-) and forcing its evaluation ! : (eval (quote opspecial)
(interaction-environment))
here is my 'else clause:
(else (! ident (eval (quote opspecial) (current-namespace)) term1 op
term2))
for Racket, in Gui
yes i tried it, i often get this answer :-) with this sort of problem i
recurrent have with macros and it never helps ,at the point i never
understood what is the use of this option in syntax-rules.
My error i think was to forget the expansion stage of macro expansion that
is always done for all t
Did you try using the following?
(define-syntax $nfx$
(syntax-rules (<-)
((...
On 4/14/23 4:02 AM, Damien Mattei wrote:
hello,
i have 2 macros used in one expression like this:
scheme@(guile-user)> (define i 2)
scheme@(guile-user)> {i <- i + 1}
and i got this error:
While compiling expr
just understood my error:
quote is a macro, so it stop the evaluation of the other macro <- and <- is
expanded in the else even if this branch will not be executed and the error
arise.
On Fri, Apr 14, 2023 at 9:36 PM Damien Mattei
wrote:
> i test my previous problem both with Racket and Guile, i
i test my previous problem both with Racket and Guile, it gave the same
error , i isolated the problem out of SRFI 105 ,so it is not related to
SRFI 105, here is a simple code to test:
(define-syntax $nfx$
(syntax-rules ()
((_ ident opspecial term1 op term2) (cond ((or (equal? (quote
opspec
i have found that the error is related with this :
(define-syntax $nfx$
(syntax-rules ()
((_ ident opspecial term1 op term2) (cond ((or (equal? (quote
opspecial) (quote <-)) (equal? (quote opspecial) (quote ←)))
(begin
(display "$nfx$") (newline)
(opspecial ident (op term1 term2 ;