Skip to main content
Commonmark migration
Source Link

TI-89 Basic

#TI-89 Basic JustJust because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.

#TI-89 Basic Just because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.

TI-89 Basic

Just because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.

added 3 characters in body
Source Link
Justin
  • 21.4k
  • 9
  • 68
  • 117

#TI-89 Basic Just because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.

#TI Basic Just because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.

#TI-89 Basic Just because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.

Source Link
Justin
  • 21.4k
  • 9
  • 68
  • 117

#TI Basic Just because I wanted to see a Christmas Tree on my calculator. I shall type it here as it appears on my calculator.

:tree() :Prgm : :Local size :Prompt size : :Local d,x,y,str,orn :size→x :0→y :{" "," "," "," "," "," "," "," ","°","∫","θ","O","©"}→orn :size→d : :While d≥0 : d-1→d : ""→str : : While x≥0 : str&" "→str : x-1→x : EndWhile : : str&"/"→str : 2*y→x : : While x>0 : str&elementAt(orn,rand(colDim(list▶mat(orn))))→str : x-1→x : EndWhile : : str&"\"→str : Disp str : y+1→y : d→x :EndWhile : :""→str : :For x,1,2*(size+2) : str&"-"→str :EndFor :Disp str : :""→str :For x,1,size+1 : str&" "→str :EndFor :str&"||"→str :Disp str : :EndPrgm :elementAt(l,i) :Func :Local m :list▶mat(l)→m : :Local cd :colDim(m)→cd : :If i>cd or i≤0 Then : 1/0 :Else : If i=cd Then : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : Else : Return sum(mat▶list(subMat(m,1,i))) - sum(mat▶list(subMat(m,1,i+1))) : EndIf :EndIf :EndFunc 

This works the same way as my Befunge answer, but I use different ornaments. Yes, my elementAt function's repeated uses slows the program down because of many conversions between lists and matrices, but as I wrote it before, I decided against editing it. Also, I learned while typing this answer that © makes a comment (I thought it looked like @, but that is another character). Never knew what it was before now.

Sample output:

size? 7 /\ / O\ /∫ \ / © ∫°\ / θ ∫ ∫\ /° ° © ©\ /O ∫ O ° \ / θ °© ∫ O θ\ ------------------ || 

I love those 's; they look like candy canes.