guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: expression


From: Michael Lucy
Subject: Re: expression
Date: Wed, 23 Jun 2010 18:23:45 -0500

Doesn't look like it ignores it:

scheme@(guile-user)> ,c (begin (set! x 1))
Disassembly of #<objcode bdc6e48>:

   0    (assert-nargs-ee/locals 0)
   2    (make-int8:1)                   ;; 1
   3    (load-symbol "x")               ;; x
   8    (link-now)
   9    (variable-set)
  10    (void)
  11    (return)

scheme@(guile-user)> ,c (begin (set! x 1) *unspecified*)
Disassembly of #<objcode 9a05d08>:

   0    (assert-nargs-ee/locals 0)
   2    (make-int8:1)                   ;; 1
   3    (load-symbol "x")               ;; x
   8    (link-now)
   9    (variable-set)
  10    (load-symbol "*unspecified*")   ;; *unspecified*
  27    (link-now)
  28    (variable-ref)
  29    (return)

scheme@(guile-user)>

If it's idiomatic I'll do that till I find something else though.  Thanks!

On Wed, Jun 23, 2010 at 6:14 PM, No Itisnt <address@hidden> wrote:
> On Wed, Jun 23, 2010 at 4:09 PM, Michael Lucy <address@hidden> wrote:
>> Hey,
>>
>> Is there any scheme expression that will just get ignored when the
>> scheme code is compiled?
>>
>> I'm generating some code with a function like:
>>
>> (define (gen-update-ab updatea updateb)
>>  `(begin
>>     ,(if updatea `(set! a (+ a 1)) `(donothing))
>>     ,(if updateb `(set! b (+ b 1)) `(donothing))))
>>
>> And ideally I could replace the donothing function with something that
>> will get discarded during compilation.
>
> I'm not sure if Guile will discard the result, but I think
> *unspecified* is the idiomatic value for those sorts of situations.
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]