Re: [Jbeta] conditionals
Doesn't work on my machine :( and it's not quite the same as doing a naked conditional. Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Oct 30, 2011 at 4:16 PM, Raul Miller rauldmil...@gmail.com wrote: On Sun, Oct 30, 2011 at 3:40 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? You can do this: monad :0'' if.happy do. clap hands end. ) -- Raul -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jbeta] conditionals
What's the difference between =: and =. ? Cheers, Andrew Pennebaker www.yellosoft.us 2011/10/30 Björn Helgason gos...@gmail.com happy=.0 happy # 'clap hands' happy=.1 happy # 'clap hands' clap hands 2011/10/30 Andrew Pennebaker andrew.penneba...@gmail.com J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? By the way, what's the preferred notation for long variable and function names? camelCase? with_underscores? Cheers, Andrew Pennebaker www.yellosoft.us -- For information about J forums see http://www.jsoftware.com/forums.htm -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jbeta] conditionals
if=. do=.# happy=.0 if happy do 'clap hands' happy=.1 if happy do 'clap hands' clap hands 2011/10/30 Björn Helgason gos...@gmail.com happy=.0 happy # 'clap hands' happy=.1 happy # 'clap hands' clap hands 2011/10/30 Andrew Pennebaker andrew.penneba...@gmail.com J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? By the way, what's the preferred notation for long variable and function names? camelCase? with_underscores? Cheers, Andrew Pennebaker www.yellosoft.us -- For information about J forums see http://www.jsoftware.com/forums.htm -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jbeta] conditionals
=: is a global copula. =. is a local copula within explicit definitions. In immediate mode or not enclosed in an explicit definition is the same as =: . Need to be aware that if you use load that puts the script within an explicit definition. So =. produces a local definition that disappears when the load verb ends. On Sun, Oct 30, 2011 at 2:37 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: What's the difference between =: and =. ? Cheers, Andrew Pennebaker www.yellosoft.us 2011/10/30 Björn Helgason gos...@gmail.com happy=.0 happy # 'clap hands' happy=.1 happy # 'clap hands' clap hands 2011/10/30 Andrew Pennebaker andrew.penneba...@gmail.com J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? By the way, what's the preferred notation for long variable and function names? camelCase? with_underscores? Cheers, Andrew Pennebaker www.yellosoft.us -- For information about J forums see http://www.jsoftware.com/forums.htm -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jbeta] conditionals
Thanks Don. If there's no particular reason to use globals, should I use =. every place in my code? Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Oct 30, 2011 at 5:03 PM, Don Guinn dongu...@gmail.com wrote: =: is a global copula. =. is a local copula within explicit definitions. In immediate mode or not enclosed in an explicit definition is the same as =: . Need to be aware that if you use load that puts the script within an explicit definition. So =. produces a local definition that disappears when the load verb ends. On Sun, Oct 30, 2011 at 2:37 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: What's the difference between =: and =. ? Cheers, Andrew Pennebaker www.yellosoft.us 2011/10/30 Björn Helgason gos...@gmail.com happy=.0 happy # 'clap hands' happy=.1 happy # 'clap hands' clap hands 2011/10/30 Andrew Pennebaker andrew.penneba...@gmail.com J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? By the way, what's the preferred notation for long variable and function names? camelCase? with_underscores? Cheers, Andrew Pennebaker www.yellosoft.us -- For information about J forums see http://www.jsoftware.com/forums.htm -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jbeta] conditionals
In immediate mode it makes no difference. With explicit verbs or whatever names which are to be retained after the verb finishes should be assigned using global copula (=:). Other assignments in the definition should be local (=.) so the names go away after the verb ends. That way the names don't clutter up your work space and possibly accidentally overwrite a name you want to retain. On Sun, Oct 30, 2011 at 7:13 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Thanks Don. If there's no particular reason to use globals, should I use =. every place in my code? Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Oct 30, 2011 at 5:03 PM, Don Guinn dongu...@gmail.com wrote: =: is a global copula. =. is a local copula within explicit definitions. In immediate mode or not enclosed in an explicit definition is the same as =: . Need to be aware that if you use load that puts the script within an explicit definition. So =. produces a local definition that disappears when the load verb ends. On Sun, Oct 30, 2011 at 2:37 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: What's the difference between =: and =. ? Cheers, Andrew Pennebaker www.yellosoft.us 2011/10/30 Björn Helgason gos...@gmail.com happy=.0 happy # 'clap hands' happy=.1 happy # 'clap hands' clap hands 2011/10/30 Andrew Pennebaker andrew.penneba...@gmail.com J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? By the way, what's the preferred notation for long variable and function names? camelCase? with_underscores? Cheers, Andrew Pennebaker www.yellosoft.us -- For information about J forums see http://www.jsoftware.com/forums.htm -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm
Re: [Jbeta] conditionals
I think I understand, but I want to put it in my words to double-check. Declarations that are to be exposed to code that loads this J file should use =: for assignment, and local declarations inside of code blocks should use =. Right? Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Oct 30, 2011 at 10:18 PM, Don Guinn dongu...@gmail.com wrote: In immediate mode it makes no difference. With explicit verbs or whatever names which are to be retained after the verb finishes should be assigned using global copula (=:). Other assignments in the definition should be local (=.) so the names go away after the verb ends. That way the names don't clutter up your work space and possibly accidentally overwrite a name you want to retain. On Sun, Oct 30, 2011 at 7:13 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Thanks Don. If there's no particular reason to use globals, should I use =. every place in my code? Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Oct 30, 2011 at 5:03 PM, Don Guinn dongu...@gmail.com wrote: =: is a global copula. =. is a local copula within explicit definitions. In immediate mode or not enclosed in an explicit definition is the same as =: . Need to be aware that if you use load that puts the script within an explicit definition. So =. produces a local definition that disappears when the load verb ends. On Sun, Oct 30, 2011 at 2:37 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: What's the difference between =: and =. ? Cheers, Andrew Pennebaker www.yellosoft.us 2011/10/30 Björn Helgason gos...@gmail.com happy=.0 happy # 'clap hands' happy=.1 happy # 'clap hands' clap hands 2011/10/30 Andrew Pennebaker andrew.penneba...@gmail.com J won't let me write if. ... end. by itself; it must be enclosed in a function definition. E.g., I'd like to do this: if. happy do. clapHands end. Rather than: arewehappy =: monad : 0 if. happy do. clapHands end. ) arewehappy 0 Can we add the ability to do the former to J? By the way, what's the preferred notation for long variable and function names? camelCase? with_underscores? Cheers, Andrew Pennebaker www.yellosoft.us -- For information about J forums see http://www.jsoftware.com/forums.htm -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .---. ,' .\ / | Með léttri lund verður| ,--'_,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. |`---' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )'()_() ☃☠ -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm