Веб Зображення Новини Групи Блоги Перекладач Gmail Ще »
Групи, які ви переглядали нещодавно | Довідка | Увійти
Головна сторінка Груп Google
How to set the value?
Занадто багато тем, що мають бути показані першими. Для того, щоб показати тему першою, зніміть цю опцію з іншої теми.
Під час обробки вашого запиту сталася помилка. Будь ласка, повторіть вашу спробу пізніше.
флаг
  18 повідомлення - Згорнути всі  -  Перекласти все вказаною мовою: Перекладено (переглянути всі оригінали)
Група, до якої ви додаєте допис, - група Usenet. Відтак, будь-хто в Інтернеті бачитиме вашу електронну адресу.
Вашу відповідь не було надіслано.
Ваш допис надіслано
 
Від:
Кому:
Копія:
Продолжить:
Додати копію: | Додати продовження: | Редагувати тему
Тема:
Підтвердження:
З метою підтвердження введіть символи, наведені на зображенні нижче, або числа, які чуєте, натиснувши значок доступу. Прослухайте і введіть цифри, що чуєте
 
Hi All,

I have been programming in LISP for couple of months now.
Today, came across a new notation and had a question on that.
Let me give an example:

I have an access to an "object" [i don't know what the technical term
is for a variable of this data-type].

(setq some_var data.some_val)

by doing the above, i can read the value into some_var.

but the following piece of code is not working and i am not sure if i
am even on the right track.

(setq read_var data.some_val) # read the value
(print read_var) # say the value was originally set to 5, we would see
5 here
(setq some_var 18) # sets the value to 18
(setq data.some_val some_var) # i expect data.some_val to be set to 18
now
(setq read_var data.some_val) # read the value just set
(print read_var) # i would expect 18 to be displayed. but i still see
5.

why would this be?

TIA


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 7 Лис, 06:15
Групи новин: comp.lang.lisp
Від: p...@informatimago.com (Pascal J. Bourguignon)
Дата: Sat, 07 Nov 2009 05:15:09 +0100
Місцевий час: Сб 7 Лис 2009 06:15
Тема: Re: How to set the value?

vj <harik...@gmail.com> writes:
> I have been programming in LISP for couple of months now.

To really answer to your following question, we would have to know
what decendent of LISP do you really use?

Is that Common Lisp, ISOLisp, LeLisp, Scheme, MacLisp, emacs lisp,
ZetaLisp, InterLisp, etc, etc, etc?

> Today, came across a new notation and had a question on that.
> Let me give an example:

> I have an access to an "object" [i don't know what the technical term
> is for a variable of this data-type].

> (setq some_var data.some_val)

> by doing the above, i can read the value into some_var.

Assuming it's Common Lisp, and no special reader trick is active,
data.some_val is a mere symbol and therefore it is either a normal
variable as well as some_var, or it is a symbol macro, and probably
represents some place that is both readable and writeable like a
normal variable.

In either case, you can get its value by evaluating directly
data.some_val, you don't need to store it in some_var.

Actually, since you've not shown us that you defined the variable
some_var, some strange things may occur in a Common Lisp
implementation when you evaluate this setq out of white at the
toplevel...

> but the following piece of code is not working and i am not sure if i
> am even on the right track.

> (setq read_var data.some_val) # read the value
> (print read_var) # say the value was originally set to 5, we would see
> 5 here
> (setq some_var 18) # sets the value to 18
> (setq data.some_val some_var) # i expect data.some_val to be set to 18
> now
> (setq read_var data.some_val) # read the value just set
> (print read_var) # i would expect 18 to be displayed. but i still see
> 5.

> why would this be?

It could occur that data.some_val is a symbol macro that expands to an
accessor, and that the writer method for this accessor doesn't write
the value for some reason (perhaps the new value is invalid for this
object?).

In any case you are not giving us the context, we don't even know what
language you're speaking of!  So how can we give you a meaningful answer?

--
__Pascal Bourguignon__


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

wouldn't setf also cause interesting effects?

Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 7 Лис, 06:42
Групи новин: comp.lang.lisp
Від: p...@informatimago.com (Pascal J. Bourguignon)
Дата: Sat, 07 Nov 2009 05:42:41 +0100
Місцевий час: Сб 7 Лис 2009 06:42
Тема: Re: How to set the value?

Anti Vigilante <antivigila...@pyrabang.com> writes:
> wouldn't setf also cause interesting effects?

SETF would be more explicit.

SETQ must actually work like SETF when given a symbol macro as target.

--
__Pascal Bourguignon__


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

vj <harik...@gmail.com> writes:
> Hi All,

> I have been programming in LISP for couple of months now.
> Today, came across a new notation and had a question on that.

Um, what "new notation" did you come across?
Having a "." as part of a symbol name doesn't mean anything special in
lisp.  It is similar to having an "_", a "-", or any other character in
the name.

Are you expecting something different?

> Let me give an example:

> I have an access to an "object" [i don't know what the technical term
> is for a variable of this data-type].

> (setq some_var data.some_val)

> by doing the above, i can read the value into some_var.

> but the following piece of code is not working and i am not sure if i
> am even on the right track.

> (setq read_var data.some_val) # read the value

OK.  What happens here is that the value of read_var [more lisp-like
would be read-var] is set to the value of data.some_val.  This only sets
teh value of read_var.  It doesn't establish any other link between
those variables.

I also wonder about your use of the unusual (for lisp) dot notation in
the names of your variables.  This doesn't really create objects with
slots.  It just creates ordinary variables that happen to have a "." in
their name.

> (print read_var) # say the value was originally set to 5, we would see
> 5 here

Even simpler is to just type "read_var" at the interactive prompt.  It
will then print the value for you.

> (setq some_var 18) # sets the value to 18
> (setq data.some_val some_var) # i expect data.some_val to be set to 18
> now

OK.  This should set the value as you expect.

> (setq read_var data.some_val) # read the value just set

OK.

> (print read_var) # i would expect 18 to be displayed. but i still see
> 5.

Well, this seems a bit odd.  What lisp system are you using when doing
this?  # isn't a line comment character in any lisp system that I'm
aware of.  Can you paste the actual transcript of your session?

When I try your example, I get the expected results:

CL-USER> (setq data.some_val 5)
5
CL-USER> (setq read_var data.some_val)
5
CL-USER> (print read_var)

5
5
CL-USER> (setq some_var 18)
18
CL-USER> (setq data.some_val some_var)
18
CL-USER> (setq read_var data.some_val)
18
CL-USER> (print read_var)

18
18

--
Thomas A. Russ,  USC/Information Sciences Institute


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon <p...@informatimago.com> wrote:
+---------------
| Actually, since you've not shown us that you defined the variable
| some_var, some strange things may occur in a Common Lisp implementation
| when you evaluate this setq out of white at the toplevel...
+---------------

Aha! Interesting difference in idioms here: in the U.S. one would say
"out of the blue" instead of "white".

-Rob

-----
Rob Warnock                     <r...@rpw3.org>
627 26th Avenue                 <URL:http://rpw3.org/>
San Mateo, CA 94403             (650)572-2607


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 7 Лис, 14:45
Групи новин: comp.lang.lisp
Від: p...@informatimago.com (Pascal J. Bourguignon)
Дата: Sat, 07 Nov 2009 13:45:10 +0100
Місцевий час: Сб 7 Лис 2009 14:45
Тема: Re: How to set the value?

r...@rpw3.org (Rob Warnock) writes:
> Pascal J. Bourguignon <p...@informatimago.com> wrote:
> +---------------
> | Actually, since you've not shown us that you defined the variable
> | some_var, some strange things may occur in a Common Lisp implementation
> | when you evaluate this setq out of white at the toplevel...
> +---------------

> Aha! Interesting difference in idioms here: in the U.S. one would say
> "out of the blue" instead of "white".

Well, not being a native speaker, I must have misremembered the idiom.
So: s/white/the blue/

--
__Pascal Bourguignon__


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
webmasterATflymagnetic.co m  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 7 Лис, 16:56
Групи новин: comp.lang.lisp
Від: "webmasterATflymagnetic.com" <webmas...@flymagnetic.com>
Дата: Sat, 7 Nov 2009 06:56:01 -0800 (PST)
Місцевий час: Сб 7 Лис 2009 16:56
Тема: Re: How to set the value?
On Nov 7, 12:45 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:

Naw -- Europe's cloudier than the US; white skies rather than blue
skies.

Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

"webmasterATflymagnetic.com" <webmas...@flymagnetic.com> writes:
> Naw -- Europe's cloudier than the US; white skies rather than blue
> skies.

Surely even grass is greener in the US, am I right?

--
Adam Michalik
 vel Dodek Dodecki
<dodek[]dodecki.net>


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Thanks Pascal and Thomas.

Your comments were useful and made me dig further. Turns out that lisp
was running on top of a plugin. So, data.some_val would actually
execute a method [data here] in the plugin and return the value for
the variable of name some_val.

As Pascal rightly expected, the some_val was only "readable" and not
"writeable" (for lack of a corresponding method in the plugin
implementation).

hagw.

On Nov 7, 8:33 pm, Adam Michalik <dode...@gmail.com> wrote:


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
webmasterATflymagnetic.com <webmas...@flymagnetic.com> wrote:

+---------------
| p...@informatimago.com (Pascal J. Bourguignon) wrote:
| > r...@rpw3.org (Rob Warnock) writes:
| > > Pascal J. Bourguignon <p...@informatimago.com> wrote:
| > > +---------------
| > > | ...strange things may occur in a Common Lisp implementation
| > > | when you evaluate this setq out of white at the toplevel...
| > > +---------------
| >
| > > Aha! Interesting difference in idioms here: in the U.S. one would say
| > > "out of the blue" instead of "white".
| >
| > Well, not being a native speaker, I must have misremembered the idiom.
| > So: s/white/the blue/
|
| Naw -- Europe's cloudier than the US; white skies rather than blue skies.
+---------------

Actually, looking at Wiktionary[1] it would seem that in most European
countries the analogous idiom to the English "out of the blue" has
more to do with "clear sky" rather than "the blue" [albeit clear skies
*are* typically blue], and *not* "white" [though see (Russia#2) below]:

    - From clear sky (Germany)

    - Like a lightning bolt out of a clear sky (Finland, Sweden)

    - Like a thunder {from,in} {the,a} clear sky (Bosnia, Serbia,
      Croatia, Lithuania, Russia#1, Iceland#1)

Some more... indirect phrases were also given as alternates:

    - Like snow onto the head (Russia#2)

    - Like the devil from the sheep's leg (Iceland#2)

Alternatives in English include "out of nowhere" and "[a] bolt from
the blue", the latter being *quite* similar to the Finnish/Swedish,
since "bolt" here means a lightening bolt.

But I'm sorry, Pascal. I couldn't find one that was uniquely French...

-Rob

[1] http://en.wiktionary.org/wiki/out_of_the_blue

-----
Rob Warnock                     <r...@rpw3.org>
627 26th Avenue                 <URL:http://rpw3.org/>
San Mateo, CA 94403             (650)572-2607


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 8 Лис, 12:46
Групи новин: comp.lang.lisp
Від: p...@informatimago.com (Pascal J. Bourguignon)
Дата: Sun, 08 Nov 2009 11:46:52 +0100
Місцевий час: Нд 8 Лис 2009 12:46
Тема: Re: How to set the value?

I guess the corresponding expression would be "un éclair en plein jour",  
which is quite rareley used.  (Google finds 13 occurences, of which
only 3 have the English idiom meaning, the others being literal
meaning).

--
__Pascal Bourguignon__


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

On Sun, 08 Nov 2009 02:50:57 -0600, r...@rpw3.org (Rob Warnock) said:

> ...
>     - Like a thunder {from,in} {the,a} clear sky (Bosnia, Serbia,
>       Croatia, Lithuania, Russia#1, Iceland#1)

  Add Bulgaria to this list.

  As a sidenote, there is (at least in Bulgarian) an expression that
  literally means "see stars in the middle of a white day", which
  refers to the "stars" one "sees" after a strike on the head, but
  that is a rather special case of surprise.

  ---Vassil.

--
"Even when the muse is posting on Usenet, Alexander Sergeevich?"


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
On Sun, 08 Nov 2009 03:33:50 +0100, Adam Michalik <dode...@gmail.com>
wrote:

>"webmasterATflymagnetic.com" <webmas...@flymagnetic.com> writes:

>> Naw -- Europe's cloudier than the US; white skies rather than blue
>> skies.

>Surely even grass is greener in the US, am I right?

You mean browner - the US being the source of global warming and
whatnot.

Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon <p...@informatimago.com> wrote:
+---------------
| r...@rpw3.org (Rob Warnock) writes:
| > But I'm sorry, Pascal. I couldn't find one that was uniquely French...
|
| I guess the corresponding expression would be "un éclair en plein jour",  
| which is quite rareley used.
+---------------

My sister (who speaks *much* better French than I!) says that the
Harper/Collins/Robert dictionary lists "coup de tonnerre" -- literally
"a clap of thunder" or "thunderclap", but figuratively meaning
"bombshell", "bolt from the blue", or "thunderbolt". Does that
sound appropriate here?

[A friend of hers also suggested "sans crier gare" -- "without any
warning or unexpectedly" -- but I'm not sure that's quite the same.]

-Rob

-----
Rob Warnock                     <r...@rpw3.org>
627 26th Avenue                 <URL:http://rpw3.org/>
San Mateo, CA 94403             (650)572-2607


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Pascal J. Bourguignon  
Переглянути профіль   Перекласти вказаною мовою: Перекладено (переглянути оригінал)
 Більше налаштувань 10 Лис, 10:17
Групи новин: comp.lang.lisp
Від: p...@informatimago.com (Pascal J. Bourguignon)
Дата: Tue, 10 Nov 2009 09:17:48 +0100
Місцевий час: Вт 10 Лис 2009 10:17
Тема: Re: How to set the value?

Yes, "sans crier gare" would mean the same.

On the other hand, I'm not sure about "coup de tonnerre", since it's
usually preceded by the flash...

--
__Pascal Bourguignon__
http://www.informatimago.com


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

In Italian we have "fulmine a ciel sereno", which is essentially the
same as the Finnish and Swedish expression above. It's normally used for
things that are totally surprising and unexpected, so it has a
"stronger" meaning than the English idiom...

Alberto


Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.

On Sun, 08 Nov 2009 11:18:06 -0500, <vniko...@pobox.com> wrote:

> On Sun, 08 Nov 2009 02:50:57 -0600, r...@rpw3.org (Rob Warnock) said:
>> ...
>>     - Like a thunder {from,in} {the,a} clear sky (Bosnia, Serbia,
>>       Croatia, Lithuania, Russia#1, Iceland#1)

>   Add Bulgaria to this list.

>   As a sidenote, there is (at least in Bulgarian) an expression that
>   literally means "see stars in the middle of a white day", which
>   refers to the "stars" one "sees" after a strike on the head, but
>   that is a rather special case of surprise.

Ah, the things I learn in c.l.l that bring a smile to my face.

Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
Кінець повідомлень
« Повернутися до обговорень « Новіша тема     Старіша тема »

Створити групу - Групи Google - Домашня сторінка Google - Правила користування послугою - Заява про конфіденційність і нерозголошення інформації
©2009 Google